diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-05-17 15:56:16 +0530 |
---|---|---|
committer | Gary S. Robertson <gary.robertson@linaro.org> | 2015-01-19 19:13:58 -0600 |
commit | a02a5854d820ab77a3e961287348097c7cfcb415 (patch) | |
tree | e92ba9242db888cefca04d7d10572f901b07d421 /arch/microblaze | |
parent | b794203dd94856b76936183daf6d8df9d9e7a778 (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/microblaze')
-rw-r--r-- | arch/microblaze/kernel/timer.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index fb0c61443f19..35a512f67be2 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -98,7 +98,7 @@ static int xilinx_timer_set_next_event(unsigned long delta, return 0; } -static void xilinx_timer_set_mode(enum clock_event_mode mode, +static int xilinx_timer_set_mode(enum clock_event_mode mode, struct clock_event_device *evt) { switch (mode) { @@ -119,7 +119,10 @@ static void xilinx_timer_set_mode(enum clock_event_mode mode, case CLOCK_EVT_MODE_RESUME: pr_info("%s: resume\n", __func__); break; + default: + return -ENOSYS; } + return 0; } static struct clock_event_device clockevent_xilinx_timer = { @@ -128,7 +131,7 @@ static struct clock_event_device clockevent_xilinx_timer = { .shift = 8, .rating = 300, .set_next_event = xilinx_timer_set_next_event, - .set_mode = xilinx_timer_set_mode, + .set_dev_mode = xilinx_timer_set_mode, }; static inline void timer_ack(void) |