mirror of https://gitee.com/openkylin/linux.git
pwm: Fixes for v4.7-rc4
These changes fix a bit of fallout from the introduction of the atomic API. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJXYtJfAAoJEN0jrNd/PrOhi8AQAI4vVCMV49mwF/hZO3pv7eTY QuDajyW+lj4fhgnzcbZn6X5N6PcRJ1qv8MiGymzX2KARUG/Q08auijdBwnM9rxRB p33Yje9VcYn0zbPxBypNlQKhUv0twADdCjmrZ4tBoB7+evIkPbSRICYXr/2DIIsX GUe8OLHJE5KdVFVy0V7Sfm9RpDq6pWQlxPrHmTAyiGberKud1IFYRt4jrenebqg0 0kldCQGsPBCIsoz7O37oFHy3AtAhnseIlOAo4drLqRf66583f6Z80hTWr2PrXWWD Mf+8BdvVWRNKx+7R8vXYgeGUEnQzcFK0F4IOs8Vf9BIfz70gh7WM0cYSLpnsg1wi /0fohWqjZ4zF8ZcTNko3fdeSW2Ff5Takz5LP2W8fM+veeP/sWVYk51uDuxuKbfsT 4k7bVQ62PaeeYeFcDcOoGuhZfqj2590zz5tl1P93/Ths5iu81PDICi2X7G+bxYj3 ZpT9jhxSYS6L7iiY9Ll29qomySArYTR5EeR+2P02WtalNv05ELcjlDKAgiFt/iHT z5FJG7KIQKcD3RSv86w+gNH42rQpOcicPW7VANaAkS1t89PA1LX5TtMtSiNf1llY OiK0aNS739+KHq4lUmdlE5w+Sy2t4HcFrl99uDSNxpwtmTiBFgQm3UlZmeMtpHL6 lu7XrhlP2mhcOOEXnVoM =usLT -----END PGP SIGNATURE----- Merge tag 'pwm/for-4.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm Pull pwm fixes from Thierry Reding: "These changes fix a bit of fallout from the introduction of the atomic API" * tag 'pwm/for-4.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: pwm: atmel-hlcdc: Fix default PWM polarity pwm: sysfs: Get return value from pwm_apply_state() pwm: Improve args checking in pwm_apply_state()
This commit is contained in:
commit
bb967271c0
|
@ -457,7 +457,8 @@ int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state)
|
|||
{
|
||||
int err;
|
||||
|
||||
if (!pwm)
|
||||
if (!pwm || !state || !state->period ||
|
||||
state->duty_cycle > state->period)
|
||||
return -EINVAL;
|
||||
|
||||
if (!memcmp(state, &pwm->state, sizeof(*state)))
|
||||
|
|
|
@ -272,7 +272,7 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
|
|||
chip->chip.of_pwm_n_cells = 3;
|
||||
chip->chip.can_sleep = 1;
|
||||
|
||||
ret = pwmchip_add(&chip->chip);
|
||||
ret = pwmchip_add_with_polarity(&chip->chip, PWM_POLARITY_INVERSED);
|
||||
if (ret) {
|
||||
clk_disable_unprepare(hlcdc->periph_clk);
|
||||
return ret;
|
||||
|
|
|
@ -152,7 +152,7 @@ static ssize_t enable_store(struct device *child,
|
|||
goto unlock;
|
||||
}
|
||||
|
||||
pwm_apply_state(pwm, &state);
|
||||
ret = pwm_apply_state(pwm, &state);
|
||||
|
||||
unlock:
|
||||
mutex_unlock(&export->lock);
|
||||
|
|
|
@ -235,6 +235,9 @@ static inline int pwm_config(struct pwm_device *pwm, int duty_ns,
|
|||
if (!pwm)
|
||||
return -EINVAL;
|
||||
|
||||
if (duty_ns < 0 || period_ns < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pwm_get_state(pwm, &state);
|
||||
if (state.duty_cycle == duty_ns && state.period == period_ns)
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue