diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-05-17 15:56:16 +0530 |
---|---|---|
committer | Santosh Shukla <sshukla@mvista.com> | 2014-11-11 18:03:50 +0530 |
commit | 82724d7bd83d3d612be57a46389d258535ca8955 (patch) | |
tree | c3d865f5605d8c2fdfeb431306f038a88e87057a /arch/mips/kernel/cevt-ds1287.c | |
parent | 39cc89fb036f4d465fec56dd5c0713be4402ca67 (diff) |
clockevents: mips: migrate to ->set_dev_mode()
Clockevents core now supports ->set_dev_mode() (as a replacement to
->set_mode()), with capability to return error codes.
Migrate all MIPS specific clockevent drivers to implement this new callback.
Drivers now return -ENOSYS when a unsupported mode is passed to their
->set_dev_mode() callbacks and return 0 on success.
Most of the changes are automated with help of Coccinelle
(http://coccinelle.lip6.fr/) and the ones left are around the switch block which
are handled manually.
Some drivers had a WARN()/BUG()/pr_err()/empty-implementation for unsupported
modes. These statements and unsupported modes are removed now as proper error
handling with a WARN_ON() is done at clockevents core.
A simplified version of the semantic patch is:
@@
identifier m,c,setmode;
@@
-void
+int
setmode(enum clock_event_mode m, struct clock_event_device *c);
@@
identifier setmode;
@@
-void
+int
setmode(enum clock_event_mode, struct clock_event_device *);
@fixret@
identifier m,c,setmode;
@@
-void
+int
setmode(enum clock_event_mode m, struct clock_event_device *c)
{
...
+ return 0;
}
@depends on fixret@
identifier ced;
identifier fixret.setmode;
@@
... struct clock_event_device ced = {
...,
-.set_mode
+.set_dev_mode
= setmode,
};
@depends on fixret@
expression ced;
identifier fixret.setmode;
@@
- ced->set_mode
+ ced->set_dev_mode
= setmode
@depends on fixret@
identifier fixret.setmode;
@@
{
.
-set_mode
+set_dev_mode
= setmode
}
@depends on fixret@
expression ced;
identifier fixret.setmode;
@@
- ced.set_mode
+ ced.set_dev_mode
= setmode
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[
Backported from viresh branch tick/oneshot-stopped.
Applied below files manually
- arch/mips/kernel/cevt-r4k.c
- arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
]
Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
Diffstat (limited to 'arch/mips/kernel/cevt-ds1287.c')
-rw-r--r-- | arch/mips/kernel/cevt-ds1287.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/mips/kernel/cevt-ds1287.c b/arch/mips/kernel/cevt-ds1287.c index ff1f01b72270..db58c38dd1b8 100644 --- a/arch/mips/kernel/cevt-ds1287.c +++ b/arch/mips/kernel/cevt-ds1287.c @@ -59,10 +59,11 @@ static int ds1287_set_next_event(unsigned long delta, return -EINVAL; } -static void ds1287_set_mode(enum clock_event_mode mode, +static int ds1287_set_mode(enum clock_event_mode mode, struct clock_event_device *evt) { u8 val; + int ret = 0; spin_lock(&rtc_lock); @@ -73,6 +74,10 @@ static void ds1287_set_mode(enum clock_event_mode mode, val |= RTC_PIE; break; default: + ret = -ENOSYS; + case CLOCK_EVT_MODE_UNUSED: + case CLOCK_EVT_MODE_SHUTDOWN: + case CLOCK_EVT_MODE_RESUME: val &= ~RTC_PIE; break; } @@ -80,6 +85,7 @@ static void ds1287_set_mode(enum clock_event_mode mode, CMOS_WRITE(val, RTC_REG_B); spin_unlock(&rtc_lock); + return ret; } static void ds1287_event_handler(struct clock_event_device *dev) @@ -90,7 +96,7 @@ static struct clock_event_device ds1287_clockevent = { .name = "ds1287", .features = CLOCK_EVT_FEAT_PERIODIC, .set_next_event = ds1287_set_next_event, - .set_mode = ds1287_set_mode, + .set_dev_mode = ds1287_set_mode, .event_handler = ds1287_event_handler, }; |