* [PATCH] pwm: Use -EINVAL for unsupported polarity
@ 2020-11-11 20:22 Thierry Reding
2020-11-12 7:53 ` Uwe Kleine-König
2020-11-12 8:11 ` Lee Jones
0 siblings, 2 replies; 3+ messages in thread
From: Thierry Reding @ 2020-11-11 20:22 UTC (permalink / raw)
To: Thierry Reding; +Cc: Uwe Kleine-König, Lee Jones, linux-pwm
Instead of using a mix of -EOPNOTSUPP and -ENOTSUPP, use the more
standard -EINVAL to signal that the specified polarity value was
invalid.
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
drivers/pwm/pwm-crc.c | 2 +-
drivers/pwm/pwm-iqs620a.c | 2 +-
drivers/pwm/pwm-rcar.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/pwm/pwm-crc.c b/drivers/pwm/pwm-crc.c
index ecfdfac0c2d9..1e2276808b7a 100644
--- a/drivers/pwm/pwm-crc.c
+++ b/drivers/pwm/pwm-crc.c
@@ -64,7 +64,7 @@ static int crc_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
}
if (state->polarity != PWM_POLARITY_NORMAL)
- return -EOPNOTSUPP;
+ return -EINVAL;
if (pwm_is_enabled(pwm) && !state->enabled) {
err = regmap_write(crc_pwm->regmap, BACKLIGHT_EN, 0);
diff --git a/drivers/pwm/pwm-iqs620a.c b/drivers/pwm/pwm-iqs620a.c
index 7d33e3646436..5ede8255926e 100644
--- a/drivers/pwm/pwm-iqs620a.c
+++ b/drivers/pwm/pwm-iqs620a.c
@@ -50,7 +50,7 @@ static int iqs620_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
int ret;
if (state->polarity != PWM_POLARITY_NORMAL)
- return -ENOTSUPP;
+ return -EINVAL;
if (state->period < IQS620_PWM_PERIOD_NS)
return -EINVAL;
diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index 3e23f1e4e1f6..002ab79a7ec2 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -168,7 +168,7 @@ static int rcar_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
/* This HW/driver only supports normal polarity */
if (state->polarity != PWM_POLARITY_NORMAL)
- return -ENOTSUPP;
+ return -EINVAL;
if (!state->enabled) {
rcar_pwm_disable(rp);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] pwm: Use -EINVAL for unsupported polarity
2020-11-11 20:22 [PATCH] pwm: Use -EINVAL for unsupported polarity Thierry Reding
@ 2020-11-12 7:53 ` Uwe Kleine-König
2020-11-12 8:11 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2020-11-12 7:53 UTC (permalink / raw)
To: Thierry Reding; +Cc: Lee Jones, linux-pwm
[-- Attachment #1: Type: text/plain, Size: 806 bytes --]
On Wed, Nov 11, 2020 at 09:22:57PM +0100, Thierry Reding wrote:
> Instead of using a mix of -EOPNOTSUPP and -ENOTSUPP, use the more
> standard -EINVAL to signal that the specified polarity value was
> invalid.
>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
I wonder if we should go further and do the same if the request cannot
be fulfilled for other reasons (usually: period to big)
-ERANGE and -EINVAL seem to be a common there, there is also an -ETIME
in drivers/pwm/pwm-imx-tpm.c and drivers/pwm/pwm-renesas-tpu.c uses
ENOTSUPP.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pwm: Use -EINVAL for unsupported polarity
2020-11-11 20:22 [PATCH] pwm: Use -EINVAL for unsupported polarity Thierry Reding
2020-11-12 7:53 ` Uwe Kleine-König
@ 2020-11-12 8:11 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2020-11-12 8:11 UTC (permalink / raw)
To: Thierry Reding; +Cc: Uwe Kleine-König, linux-pwm
On Wed, 11 Nov 2020, Thierry Reding wrote:
> Instead of using a mix of -EOPNOTSUPP and -ENOTSUPP, use the more
> standard -EINVAL to signal that the specified polarity value was
> invalid.
>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
> drivers/pwm/pwm-crc.c | 2 +-
> drivers/pwm/pwm-iqs620a.c | 2 +-
> drivers/pwm/pwm-rcar.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
Acked-by: Lee Jones <lee.jones@linaro.org>
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-12 8:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-11 20:22 [PATCH] pwm: Use -EINVAL for unsupported polarity Thierry Reding
2020-11-12 7:53 ` Uwe Kleine-König
2020-11-12 8:11 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox