All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guru Das Srinagesh <gurus@codeaurora.org>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: linux-pwm@vger.kernel.org,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Lee Jones" <lee.jones@linaro.org>
Subject: Re: [PATCH] pwm: Allow store 64-bit duty cycle from sysfs interface
Date: Thu, 27 Aug 2020 13:37:15 -0700	[thread overview]
Message-ID: <20200827203715.GA18739@codeaurora.org> (raw)
In-Reply-To: <20200824145539.3160946-1-jarkko.nikula@linux.intel.com>

On Mon, Aug 24, 2020 at 05:55:39PM +0300, Jarkko Nikula wrote:
> 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>

I'd made the change to period_store(), but had missed doing the same for
duty_cycle_store(). Thanks Jarkko for catching this.

Guru Das.

> ---
> 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
> 

  reply	other threads:[~2020-08-27 20:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24 14:55 [PATCH] pwm: Allow store 64-bit duty cycle from sysfs interface Jarkko Nikula
2020-08-27 20:37 ` Guru Das Srinagesh [this message]
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=20200827203715.GA18739@codeaurora.org \
    --to=gurus@codeaurora.org \
    --cc=jarkko.nikula@linux.intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.