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:23:26 +0530 |
commit | f3485ced9399a39720d4bf2c3119e612a4c8b1b6 (patch) | |
tree | 90c7fa014bfc3ff4393c83bcdc3d8cb0fae13550 /arch/unicore32/kernel/time.c | |
parent | 16598d8d764cb97e409548544605c1890139a0e8 (diff) |
clockevents: misc: migrate to ->set_dev_mode()
Clockevents core now supports ->set_dev_mode() (as a replacement to
->set_mode()), with capability to return error codes.
This patch migrates clockevent drivers for all architectures that had a single
clockevent driver (in order to limit patch count).
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 viresh branch tick/oneshot-stopped.
applied below file manually
- arch/powerpc/kernel/time.c
]
Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
Diffstat (limited to 'arch/unicore32/kernel/time.c')
-rw-r--r-- | arch/unicore32/kernel/time.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/unicore32/kernel/time.c b/arch/unicore32/kernel/time.c index d3824b2ff644..2a3f4c3d2096 100644 --- a/arch/unicore32/kernel/time.c +++ b/arch/unicore32/kernel/time.c @@ -46,7 +46,7 @@ puv3_osmr0_set_next_event(unsigned long delta, struct clock_event_device *c) return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; } -static void +static int puv3_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c) { switch (mode) { @@ -60,7 +60,10 @@ puv3_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c) case CLOCK_EVT_MODE_RESUME: case CLOCK_EVT_MODE_PERIODIC: break; + default: + return -ENOSYS; } + return 0; } static struct clock_event_device ckevt_puv3_osmr0 = { @@ -68,7 +71,7 @@ static struct clock_event_device ckevt_puv3_osmr0 = { .features = CLOCK_EVT_FEAT_ONESHOT, .rating = 200, .set_next_event = puv3_osmr0_set_next_event, - .set_mode = puv3_osmr0_set_mode, + .set_dev_mode = puv3_osmr0_set_mode, }; static cycle_t puv3_read_oscr(struct clocksource *cs) |