diff mbox

clockevents: Introduce mode specific callbacks

Message ID CAKohpo=0cG1Bo8NgcrMVTLo=bDnUoD-R8fY5XKT=22X8bzRv2A@mail.gmail.com
State New
Headers show

Commit Message

Viresh Kumar Feb. 12, 2015, 1:09 a.m. UTC
On 11 February 2015 at 18:38, Peter Zijlstra <peterz@infradead.org> wrote:
> I think its better to be strict; esp. with new interfaces. It avoids
> confusion.
>
> Suppose a driver writer sees these new methods and thinks to use one
> while still having the set_mode() one -- ie. he didn't actually read the
> comment. We'd better make sure he fails and goes back to read it.

Okay, does below diff looks good to you ?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index e646fbe44b05..75d221c7e9cc 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -444,8 +444,12 @@  EXPORT_SYMBOL_GPL(clockevents_unbind);
 static int clockevents_sanity_check(struct clock_event_device *dev)
 {
        /* Legacy set_mode() callback */
-       if (dev->set_mode)
+       if (dev->set_mode) {
+               /* We shouldn't be supporting new modes now */
+               WARN_ON(dev->set_mode_periodic || dev->set_mode_oneshot ||
+                       dev->set_mode_shutdown || dev->set_mode_resume);
                return 0;
+       }

        if (dev->features & CLOCK_EVT_FEAT_DUMMY)
                return 0;