From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: linux-pwm@vger.kernel.org
Cc: "Thierry Reding" <thierry.reding@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Lee Jones" <lee.jones@linaro.org>,
"Guru Das Srinagesh" <gurus@codeaurora.org>,
"Jarkko Nikula" <jarkko.nikula@linux.intel.com>
Subject: [PATCH] pwm: Allow store 64-bit duty cycle from sysfs interface
Date: Mon, 24 Aug 2020 17:55:39 +0300 [thread overview]
Message-ID: <20200824145539.3160946-1-jarkko.nikula@linux.intel.com> (raw)
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>
---
I don't think this qualifies for a Fixes tag since original commit doesn't
cause a regression while still might be good for v5.9 material.
---
drivers/pwm/sysfs.c | 4 ++--
1 file 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;
--
2.28.0
next reply other threads:[~2020-08-24 14:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-24 14:55 Jarkko Nikula [this message]
2020-08-27 20:37 ` [PATCH] pwm: Allow store 64-bit duty cycle from sysfs interface Guru Das Srinagesh
2020-09-07 15:22 ` Uwe Kleine-König
2020-09-23 12:11 ` Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200824145539.3160946-1-jarkko.nikula@linux.intel.com \
--to=jarkko.nikula@linux.intel.com \
--cc=gurus@codeaurora.org \
--cc=lee.jones@linaro.org \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox