[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210531154351.53614-2-andriy.shevchenko@linux.intel.com>
Date: Mon, 31 May 2021 18:43:48 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Flavio Suligoi <f.suligoi@...m.it>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Thierry Reding <thierry.reding@...il.com>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pwm@...r.kernel.org
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>, Lee Jones <lee.jones@...aro.org>
Subject: [PATCH v1 2/5] pwm: core: Always require PWM flags to be provided
It makes little sense to make PWM flags optional since in case
of multi-channel consumer the flags can be optional only for
the last listed channel. Thus always require PWM flags to be
provided.
Fixes: 4a6ef8e37c4d ("pwm: Add support referencing PWMs from ACPI")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/pwm/core.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index c165c5822703..25f7b3370672 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -852,8 +852,10 @@ static struct pwm_chip *device_to_pwmchip(struct device *dev)
*
* This is analogous to of_pwm_get() except con_id is not yet supported.
* ACPI entries must look like
- * Package () {"pwms", Package ()
- * { <PWM device reference>, <PWM index>, <PWM period> [, <PWM flags>]}}
+ * Package () { "pwms", Package () {
+ * <PWM device reference>, <PWM index>, <PWM period>, <PWM flags>,
+ * }
+ * }
*
* Returns: A pointer to the requested PWM device or an ERR_PTR()-encoded
* error code on failure.
@@ -877,7 +879,7 @@ static struct pwm_device *acpi_pwm_get(struct fwnode_handle *fwnode)
if (!acpi)
return ERR_PTR(-EINVAL);
- if (args.nargs < 2)
+ if (args.nargs < 3)
return ERR_PTR(-EPROTO);
chip = device_to_pwmchip(&acpi->dev);
@@ -891,7 +893,7 @@ static struct pwm_device *acpi_pwm_get(struct fwnode_handle *fwnode)
pwm->args.period = args.args[1];
pwm->args.polarity = PWM_POLARITY_NORMAL;
- if (args.nargs > 2 && args.args[2] & PWM_POLARITY_INVERTED)
+ if (args.args[2] & PWM_POLARITY_INVERTED)
pwm->args.polarity = PWM_POLARITY_INVERSED;
#endif
--
2.30.2
Powered by blists - more mailing lists