summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@linux.intel.com>2020-08-24 16:55:39 +0200
committerThierry Reding <thierry.reding@gmail.com>2020-09-24 09:18:14 +0200
commit1f2bd2271a105767046e02ecabd39a608270a4c6 (patch)
tree0f75b0917d7ff30df9f650d69547bc41fdea4c31
parentpwm: img: Fix null pointer access in probe (diff)
downloadlinux-1f2bd2271a105767046e02ecabd39a608270a4c6.tar.xz
linux-1f2bd2271a105767046e02ecabd39a608270a4c6.zip
pwm: Allow store 64-bit duty cycle from sysfs interface
PWM core was converted to u64 by the commit a9d887dc1c60 ("pwm: Convert period and duty cycle to u64") but did not change the duty_cycle_store() so it will error out if trying to pass a numeric string bigger than 2^32-1. Fix this by using u64 and kstrtou64() in duty_cycle_store(). Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Acked-by: Guru Das Srinagesh <gurus@codeaurora.org> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
-rw-r--r--drivers/pwm/sysfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c
index 449dbc0f49ed..9903c3a7eced 100644
--- a/drivers/pwm/sysfs.c
+++ b/drivers/pwm/sysfs.c
@@ -87,10 +87,10 @@ static ssize_t duty_cycle_store(struct device *child,
struct pwm_export *export = child_to_pwm_export(child);
struct pwm_device *pwm = export->pwm;
struct pwm_state state;
- unsigned int val;
+ u64 val;
int ret;
- ret = kstrtouint(buf, 0, &val);
+ ret = kstrtou64(buf, 0, &val);
if (ret)
return ret;