From: Ladislav Michl <ladis@linux-mips.org>
To: Claudiu Beznea <Claudiu.Beznea@microchip.com>
Cc: linux-omap@vger.kernel.org, linux-pwm@vger.kernel.org,
Keerthy <j-keerthy@ti.com>,
daniel.lezcano@linaro.org, thierry.reding@gmail.com,
tony@atomide.com, aaro.koskinen@iki.fi, narmstrong@baylibre.com,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
sebastian.reichel@collabora.co.uk, robh+dt@kernel.org,
t-kristo@ti.com, grygorii.strashko@ti.com
Subject: Re: [PATCH 1/3] clocksource: timer-dm: Check prescaler value
Date: Mon, 22 Jan 2018 10:59:50 +0100 [thread overview]
Message-ID: <20180122095950.GA19401@lenoch> (raw)
In-Reply-To: <4688ef73-99ac-1295-2e3b-ed79e8670262@microchip.com>
On Mon, Jan 22, 2018 at 11:00:15AM +0200, Claudiu Beznea wrote:
>
>
> On 17.01.2018 23:47, Ladislav Michl wrote:
> > Invalid value silently disables use of the prescaler.
> > Use -1 explicitely for that purpose and error out on
> > invalid value.
> >
> > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > ---
> > drivers/clocksource/timer-dm.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/clocksource/timer-dm.c b/drivers/clocksource/timer-dm.c
> > index 60db1734ea3b..324ec93d3dd2 100644
> > --- a/drivers/clocksource/timer-dm.c
> > +++ b/drivers/clocksource/timer-dm.c
> > @@ -663,13 +663,13 @@ int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
> > {
> > u32 l;
> >
> > - if (unlikely(!timer))
> > + if (unlikely(!timer) || prescaler < -1 || prescaler > 7)
> You are checking the prescaller here to be in [0, 7] interval.
You mean [-1, 7] I suppose.
> > return -EINVAL;
> >
> > omap_dm_timer_enable(timer);
> > l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
> > l &= ~(OMAP_TIMER_CTRL_PRE | (0x07 << 2));
> > - if (prescaler >= 0x00 && prescaler <= 0x07) {
> > + if (prescaler >= 0) {
> Is this check still necessary?
Yes, as we need also some way to disable prescaler, see commit message.
> > l |= OMAP_TIMER_CTRL_PRE;
> > l |= prescaler << 2;
> > }
Best regards,
ladis
WARNING: multiple messages have this Message-ID (diff)
From: ladis@linux-mips.org (Ladislav Michl)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] clocksource: timer-dm: Check prescaler value
Date: Mon, 22 Jan 2018 10:59:50 +0100 [thread overview]
Message-ID: <20180122095950.GA19401@lenoch> (raw)
In-Reply-To: <4688ef73-99ac-1295-2e3b-ed79e8670262@microchip.com>
On Mon, Jan 22, 2018 at 11:00:15AM +0200, Claudiu Beznea wrote:
>
>
> On 17.01.2018 23:47, Ladislav Michl wrote:
> > Invalid value silently disables use of the prescaler.
> > Use -1 explicitely for that purpose and error out on
> > invalid value.
> >
> > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > ---
> > drivers/clocksource/timer-dm.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/clocksource/timer-dm.c b/drivers/clocksource/timer-dm.c
> > index 60db1734ea3b..324ec93d3dd2 100644
> > --- a/drivers/clocksource/timer-dm.c
> > +++ b/drivers/clocksource/timer-dm.c
> > @@ -663,13 +663,13 @@ int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
> > {
> > u32 l;
> >
> > - if (unlikely(!timer))
> > + if (unlikely(!timer) || prescaler < -1 || prescaler > 7)
> You are checking the prescaller here to be in [0, 7] interval.
You mean [-1, 7] I suppose.
> > return -EINVAL;
> >
> > omap_dm_timer_enable(timer);
> > l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
> > l &= ~(OMAP_TIMER_CTRL_PRE | (0x07 << 2));
> > - if (prescaler >= 0x00 && prescaler <= 0x07) {
> > + if (prescaler >= 0) {
> Is this check still necessary?
Yes, as we need also some way to disable prescaler, see commit message.
> > l |= OMAP_TIMER_CTRL_PRE;
> > l |= prescaler << 2;
> > }
Best regards,
ladis
next prev parent reply other threads:[~2018-01-22 9:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 21:46 [PATCH 0/3] omap: dmtimer: Fix and cleanup moved driver Ladislav Michl
2018-01-17 21:46 ` Ladislav Michl
2018-01-17 21:47 ` [PATCH 1/3] clocksource: timer-dm: Check prescaler value Ladislav Michl
2018-01-17 21:47 ` Ladislav Michl
2018-01-17 21:47 ` Ladislav Michl
2018-01-22 9:00 ` Claudiu Beznea
2018-01-22 9:00 ` Claudiu Beznea
2018-01-22 9:00 ` Claudiu Beznea
2018-01-22 9:59 ` Ladislav Michl [this message]
2018-01-22 9:59 ` Ladislav Michl
2018-01-22 10:04 ` Claudiu Beznea
2018-01-22 10:04 ` Claudiu Beznea
2018-01-22 10:04 ` Claudiu Beznea
2018-01-17 21:47 ` [PATCH 2/3] pwm: pwm-omap-dmtimer: Fix frequency when using prescaler Ladislav Michl
2018-01-17 21:47 ` Ladislav Michl
2018-01-17 21:47 ` Ladislav Michl
2018-01-22 9:17 ` Claudiu Beznea
2018-01-22 9:17 ` Claudiu Beznea
2018-01-22 9:17 ` Claudiu Beznea
2018-01-22 9:17 ` Claudiu Beznea
2018-01-22 10:53 ` Ladislav Michl
2018-01-22 10:53 ` Ladislav Michl
2018-01-24 5:26 ` Keerthy
2018-01-24 5:26 ` Keerthy
2018-01-24 5:26 ` Keerthy
2018-01-24 5:49 ` Keerthy
2018-01-24 5:49 ` Keerthy
2018-01-24 5:49 ` Keerthy
2018-01-17 21:48 ` [PATCH 3/3] clocksource: timer-dm: Make unexported functions static Ladislav Michl
2018-01-17 21:48 ` Ladislav Michl
2018-01-22 9:26 ` Claudiu Beznea
2018-01-22 9:26 ` Claudiu Beznea
2018-01-22 9:26 ` Claudiu Beznea
2018-01-22 10:39 ` Ladislav Michl
2018-01-22 10:39 ` Ladislav Michl
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=20180122095950.GA19401@lenoch \
--to=ladis@linux-mips.org \
--cc=Claudiu.Beznea@microchip.com \
--cc=aaro.koskinen@iki.fi \
--cc=daniel.lezcano@linaro.org \
--cc=grygorii.strashko@ti.com \
--cc=j-keerthy@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=narmstrong@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sebastian.reichel@collabora.co.uk \
--cc=t-kristo@ti.com \
--cc=thierry.reding@gmail.com \
--cc=tony@atomide.com \
/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.