From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755307AbbBLIYJ (ORCPT ); Thu, 12 Feb 2015 03:24:09 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:35046 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751610AbbBLIYH (ORCPT ); Thu, 12 Feb 2015 03:24:07 -0500 Date: Thu, 12 Feb 2015 09:23:59 +0100 From: Peter Zijlstra To: Viresh Kumar Cc: Thomas Gleixner , Linaro Kernel Mailman List , Linux Kernel Mailing List , Kevin Hilman , Frederic Weisbecker , Preeti U Murthy , Daniel Lezcano , Linaro Networking Subject: Re: [PATCH] clockevents: Introduce mode specific callbacks Message-ID: <20150212082359.GJ2896@worktop.programming.kicks-ass.net> References: <025ca1872df9ed8a9f7b6e0400e71ed296374183.1423034839.git.viresh.kumar@linaro.org> <20150210141541.GB7119@twins.programming.kicks-ass.net> <20150211103845.GR23123@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 12, 2015 at 09:09:30AM +0800, Viresh Kumar wrote: > On 11 February 2015 at 18:38, Peter Zijlstra 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; Yep, that looks entirely reasonable.