mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org,
	Kevin Hilman <khilman@linaro.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Preeti U Murthy <preeti@linux.vnet.ibm.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linaro-networking@linaro.org
Subject: Re: [PATCH] clockevents: Introduce mode specific callbacks
Date: Tue, 10 Feb 2015 15:15:41 +0100	[thread overview]
Message-ID: <20150210141541.GB7119@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <025ca1872df9ed8a9f7b6e0400e71ed296374183.1423034839.git.viresh.kumar@linaro.org>

On Wed, Feb 04, 2015 at 01:06:23PM +0530, Viresh Kumar wrote:
> +	/*
> +	 * Mode transition callback(s): Only one of the two groups should be
> +	 * defined:
> +	 * - set_mode(), only for modes <= CLOCK_EVT_MODE_RESUME.
> +	 * - set_mode_{shutdown|periodic|oneshot|resume}().
> +	 */
>  	void			(*set_mode)(enum clock_event_mode mode,
>  					    struct clock_event_device *);
> +	int			(*set_mode_periodic)(struct clock_event_device *);
> +	int			(*set_mode_oneshot)(struct clock_event_device *);
> +	int			(*set_mode_shutdown)(struct clock_event_device *);
> +	int			(*set_mode_resume)(struct clock_event_device *);




> +/* Sanity check of mode transition callbacks */
> +static int clockevents_sanity_check(struct clock_event_device *dev)
> +{
> +	/* Legacy set_mode() callback */
> +	if (dev->set_mode)
> +		return 0;
> +
> +	if (dev->features & CLOCK_EVT_FEAT_DUMMY)
> +		return 0;
> +
> +	/* New mode-specific callbacks */
> +	if (!dev->set_mode_shutdown)
> +		return -EINVAL;
> +
> +	if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) &&
> +	    !dev->set_mode_periodic)
> +		return -EINVAL;
> +
> +	if ((dev->features & CLOCK_EVT_FEAT_ONESHOT) &&
> +	    !dev->set_mode_oneshot)
> +		return -EINVAL;
> +
> +	return 0;
> +}

It appears to me you've not actually checked that condition outlined
above, a driver could set both the legacy and the new callbacks.



  reply	other threads:[~2015-02-10 14:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04  7:36 Viresh Kumar
2015-02-10 14:15 ` Peter Zijlstra [this message]
2015-02-11  3:24   ` Viresh Kumar
2015-02-11 10:38     ` Peter Zijlstra
2015-02-12  1:09       ` Viresh Kumar
2015-02-12  8:23         ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150210141541.GB7119@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=fweisbec@gmail.com \
    --cc=khilman@linaro.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linaro-networking@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=preeti@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®