On 11 February 2015 at 18:38, Peter Zijlstra <[email protected]> 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 ?

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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to