public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: narmstrong@baylibre•com (Neil Armstrong)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 2/4] pwm: omap-dmtimer: add sanity checking for load and match values
Date: Wed, 3 Feb 2016 11:24:23 +0100	[thread overview]
Message-ID: <56B1D557.6040108@baylibre.com> (raw)
In-Reply-To: <20160201133503.53599493.drivshin.allworx@gmail.com>

On 02/01/2016 07:35 PM, David Rivshin (Allworx) wrote:
> On Fri, 29 Jan 2016 23:26:52 -0500
> "David Rivshin (Allworx)" <drivshin.allworx@gmail•com> wrote:
> 
>> From: David Rivshin <drivshin@allworx•com>
>>
>> Add sanity checking to ensure that we do not program load or match
>> values that are out of range if a user requests period or duty_cycle
>> values which are not achievable. The match value cannot be less than
>> the load value (but can be equal), and neither can be 0xffffffff.
>> This means that there must be at least one fclk cycle between load
>> and match, and another between match and overflow.
>>
>> Fixes: 6604c6556db9 ("pwm: Add PWM driver for OMAP using dual-mode
>> timers") Signed-off-by: David Rivshin <drivshin@allworx•com>
>> ---
>  [...]
>> @@ -149,6 +149,24 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip, 
>> period_cycles = pwm_omap_dmtimer_get_clock_cycles(clk_rate, period_ns); 
>> duty_cycles = pwm_omap_dmtimer_get_clock_cycles(clk_rate, duty_ns); 
>>
>> +	if (period_cycles < 2) {
>> +		dev_info(chip->dev,
>> +			"period %dns is too short for clock rate %luHz\n",
>> +			period_ns, clk_rate);
>> +		goto err_einval;
>> +	}
>  [...]
> 
> I had some second thoughts on this over the weekend:
> 1) Perhaps the return should be -ERANGE instead of -EINVAL for this case?
> 2) Is dev_info() too severe for this? Perhaps dev_dbg() would be better?
> Any preferences?
> 
The current management is OK for me.

Acked-by: Neil Armstrong <narmstrong@baylibre•com>

Thanks !

  reply	other threads:[~2016-02-03 10:24 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-30  4:26 [PATCH 0/4] pwm: omap-dmtimer: fix period/duty_cycle calculation David Rivshin (Allworx)
2016-01-30  4:26 ` [PATCH 1/4] pwm: omap-dmtimer: fix inaccurate " David Rivshin (Allworx)
2016-02-03 10:23   ` Neil Armstrong
2016-02-15 20:24     ` Adam Ford
2016-03-04 15:17   ` Thierry Reding
2016-01-30  4:26 ` [PATCH 2/4] pwm: omap-dmtimer: add sanity checking for load and match values David Rivshin (Allworx)
2016-02-01 18:35   ` David Rivshin (Allworx)
2016-02-03 10:24     ` Neil Armstrong [this message]
2016-01-30  4:26 ` [PATCH 3/4] pwm: omap-dmtimer: round load and match values rather than truncate David Rivshin (Allworx)
2016-02-03 10:24   ` Neil Armstrong
2016-03-04 15:18   ` Thierry Reding
2016-01-30  4:26 ` [PATCH 4/4] pwm: omap-dmtimer: add dev_dbg() message for effective period and duty cycle David Rivshin (Allworx)
2016-01-30 14:51   ` Neil Armstrong
2016-02-01 18:22     ` David Rivshin (Allworx)
2016-02-01 18:59       ` Tony Lindgren
2016-02-02 16:23         ` Thierry Reding
2016-02-02 23:44           ` David Rivshin (Allworx)
2016-02-03 14:14             ` Thierry Reding
2016-02-05 19:51               ` David Rivshin (Allworx)
2016-02-09 12:49                 ` Neil Armstrong
2016-01-30 14:52 ` [PATCH 0/4] pwm: omap-dmtimer: fix period/duty_cycle calculation Neil Armstrong
2016-02-01 20:14   ` David Rivshin (Allworx)
2016-02-27  1:31 ` David Rivshin (Allworx)
2016-03-04 15:19   ` Thierry Reding
2016-03-04 16:27     ` David Rivshin (Allworx)
     [not found]       ` <CAHCN7xJYi8VCe8ue_QuYmqTEo-8GPSPiwzM2F_631mMUrwajSA@mail.gmail.com>
2016-03-04 20:01         ` David Rivshin (Allworx)
2016-03-04 20:03           ` Adam Ford
2016-03-04 21:18       ` Thierry Reding
2016-03-04 23:20         ` David Rivshin (Allworx)
2016-03-08 23:23           ` Adam Ford

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=56B1D557.6040108@baylibre.com \
    --to=narmstrong@baylibre$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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