From: Ladislav Michl <ladis@linux-mips.org>
To: Keerthy <j-keerthy@ti.com>,
tony@atomide.com, aaro.koskinen@iki.fi, thierry.reding@gmail.com,
daniel.lezcano@linaro.org
Cc: grygorii.strashko@ti.com, linux-omap@vger.kernel.org,
robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-pwm@vger.kernel.org, sebastian.reichel@collabora.co.uk,
t-kristo@ti.com
Subject: [PATCH 2/5] clocksource: timer-dm: Check prescaler value
Date: Mon, 8 Jan 2018 16:41:04 +0100 [thread overview]
Message-ID: <20180108154104.GB4077@lenoch> (raw)
In-Reply-To: <20180108153926.GA3916@lenoch>
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>
diff --git a/drivers/clocksource/timer-dm.c b/drivers/clocksource/timer-dm.c
index 43531eecbe54..bde1014308f9 100644
--- a/drivers/clocksource/timer-dm.c
+++ b/drivers/clocksource/timer-dm.c
@@ -663,13 +663,13 @@ static int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer,
{
u32 l;
- if (unlikely(!timer))
+ if (unlikely(!timer) || prescaler < -1 || prescaler > 7)
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) {
l |= OMAP_TIMER_CTRL_PRE;
l |= prescaler << 2;
}
--
2.15.1
WARNING: multiple messages have this Message-ID (diff)
From: ladis@linux-mips.org (Ladislav Michl)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] clocksource: timer-dm: Check prescaler value
Date: Mon, 8 Jan 2018 16:41:04 +0100 [thread overview]
Message-ID: <20180108154104.GB4077@lenoch> (raw)
In-Reply-To: <20180108153926.GA3916@lenoch>
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>
diff --git a/drivers/clocksource/timer-dm.c b/drivers/clocksource/timer-dm.c
index 43531eecbe54..bde1014308f9 100644
--- a/drivers/clocksource/timer-dm.c
+++ b/drivers/clocksource/timer-dm.c
@@ -663,13 +663,13 @@ static int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer,
{
u32 l;
- if (unlikely(!timer))
+ if (unlikely(!timer) || prescaler < -1 || prescaler > 7)
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) {
l |= OMAP_TIMER_CTRL_PRE;
l |= prescaler << 2;
}
--
2.15.1
next prev parent reply other threads:[~2018-01-08 15:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-08 15:39 [PATCH 0/5] Add capture functionality to OMAP pwm driver Ladislav Michl
2018-01-08 15:39 ` Ladislav Michl
2018-01-08 15:40 ` [PATCH 1/5] clocksource: timer-dm: Make unexported functions static Ladislav Michl
2018-01-08 15:40 ` Ladislav Michl
2018-01-08 15:41 ` Ladislav Michl [this message]
2018-01-08 15:41 ` [PATCH 2/5] clocksource: timer-dm: Check prescaler value Ladislav Michl
2018-01-08 15:41 ` [PATCH 3/5] pwm: pwm-omap-dmtimer: Fix frequency when using prescaler Ladislav Michl
2018-01-08 15:41 ` Ladislav Michl
2018-01-08 15:42 ` [PATCH 4/5] clocksource: timer-dm: Add event capture Ladislav Michl
2018-01-08 15:42 ` Ladislav Michl
2018-01-08 15:43 ` [RFC 5/5] pwm: pwm-omap-dmtimer: Add capture functionality Ladislav Michl
2018-01-08 21:59 ` Tony Lindgren
2018-01-08 21:59 ` Tony Lindgren
2018-01-08 22:06 ` Ladislav Michl
2018-01-08 22:06 ` Ladislav Michl
2018-01-08 22:13 ` Tony Lindgren
2018-01-08 22:13 ` Tony Lindgren
2018-01-08 22:26 ` Ladislav Michl
2018-01-08 22:26 ` Ladislav Michl
2018-01-08 21:51 ` [PATCH 0/5] Add capture functionality to OMAP pwm driver Tony Lindgren
2018-01-08 21:51 ` Tony Lindgren
2018-01-08 21:57 ` Ladislav Michl
2018-01-08 21:57 ` 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=20180108154104.GB4077@lenoch \
--to=ladis@linux-mips.org \
--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-omap@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--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.