lkml.org 
[lkml]   [2015]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH] clockevents: Introduce mode specific callbacks
From
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 ?

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;

\
 
 \ /
  Last update: 2015-02-12 02:21    [W:0.066 / U:12.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site