pwm: Use -EINVAL for unsupported polarity
Subsystems (2)
PATCH 1/1 pwm: Use -EINVAL for unsupported polarity
Instead of using a mix of -EOPNOTSUPP and -ENOTSUPP, use the more standard -EINVAL to signal that the specified polarity value was invalid.
--- 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(-)
drivers/pwm/pwm-crc.c +1 -1
@@ -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 );
drivers/pwm/pwm-iqs620a.c +1 -1
@@ -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 ;
drivers/pwm/pwm-rcar.c +1 -1
@@ -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);
Signature · 1 line
2.29.2
Quoted 5 lines · Thierry Reding
Instead of using a mix of
-EOPNOTSUPPand-ENOTSUPP, use the more standard-EINVALto signal that the specified polarity value was invalid.Signed-off-by Thierry Reding <[email protected]>
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
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Quoted 10 lines · Thierry Reding
Instead of using a mix of
-EOPNOTSUPPand-ENOTSUPP, use the more standard-EINVALto signal that the specified polarity value was invalid.Signed-off-by Thierry Reding <[email protected]>--- 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(-)
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog