summaryrefslogtreecommitdiffstats
path: root/drivers/pwm/sysfs.c
diff options
context:
space:
mode:
authorGuru Das Srinagesh <gurus@codeaurora.org>2020-06-03 00:31:16 +0200
committerThierry Reding <thierry.reding@gmail.com>2020-06-17 20:42:11 +0200
commita9d887dc1c60ed67f2271d66560cdcf864c4a578 (patch)
treee82d315a396940caf32c373b260ed6c9e955ac6b /drivers/pwm/sysfs.c
parentclk: pwm: Use 64-bit division function (diff)
downloadlinux-a9d887dc1c60ed67f2271d66560cdcf864c4a578.tar.xz
linux-a9d887dc1c60ed67f2271d66560cdcf864c4a578.zip
pwm: Convert period and duty cycle to u64
Because period and duty cycle are defined as ints with units of nanoseconds, the maximum time duration that can be set is limited to ~2.147 seconds. Change their definitions to u64 in the structs of the PWM framework so that higher durations may be set. Also use the right format specifiers in debug prints in both core.c, pwm-stm32-lp.c as well as video/fbdev/ssd1307fb.c. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-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>
Diffstat (limited to 'drivers/pwm/sysfs.c')
-rw-r--r--drivers/pwm/sysfs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c
index 2389b8669846..449dbc0f49ed 100644
--- a/drivers/pwm/sysfs.c
+++ b/drivers/pwm/sysfs.c
@@ -42,7 +42,7 @@ static ssize_t period_show(struct device *child,
pwm_get_state(pwm, &state);
- return sprintf(buf, "%u\n", state.period);
+ return sprintf(buf, "%llu\n", state.period);
}
static ssize_t period_store(struct device *child,
@@ -52,10 +52,10 @@ static ssize_t period_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;
@@ -77,7 +77,7 @@ static ssize_t duty_cycle_show(struct device *child,
pwm_get_state(pwm, &state);
- return sprintf(buf, "%u\n", state.duty_cycle);
+ return sprintf(buf, "%llu\n", state.duty_cycle);
}
static ssize_t duty_cycle_store(struct device *child,