All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Viresh Kumar <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, tglx@linutronix.de,
	viresh.kumar@linaro.org, daniel.lezcano@linaro.org,
	mingo@kernel.org
Subject: [tip:timers/urgent] clockevents: Allow set-state callbacks to be optional
Date: Tue, 7 Jul 2015 01:49:12 -0700	[thread overview]
Message-ID: <tip-7c4a976cd55972b68c75a978f171b6db5df4ce66@git.kernel.org> (raw)
In-Reply-To: <1436256875-15562-1-git-send-email-daniel.lezcano@linaro.org>

Commit-ID:  7c4a976cd55972b68c75a978f171b6db5df4ce66
Gitweb:     http://git.kernel.org/tip/7c4a976cd55972b68c75a978f171b6db5df4ce66
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Tue, 7 Jul 2015 10:14:35 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 7 Jul 2015 10:44:45 +0200

clockevents: Allow set-state callbacks to be optional

Its mandatory for the drivers to provide set_state_{oneshot|periodic}()
(only if related modes are supported) and set_state_shutdown() callbacks
today, if they are implementing the new set-state interface.

But this leads to unnecessary noop callbacks for drivers which don't
want to implement them. Over that, it will lead to a full function call
for nothing really useful.

Lets make all set-state callbacks optional.

Suggested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: http://lkml.kernel.org/r/1436256875-15562-1-git-send-email-daniel.lezcano@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/time/clockevents.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 08ccc3d..50eb107 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -120,19 +120,25 @@ static int __clockevents_switch_state(struct clock_event_device *dev,
 		/* The clockevent device is getting replaced. Shut it down. */
 
 	case CLOCK_EVT_STATE_SHUTDOWN:
-		return dev->set_state_shutdown(dev);
+		if (dev->set_state_shutdown)
+			return dev->set_state_shutdown(dev);
+		return 0;
 
 	case CLOCK_EVT_STATE_PERIODIC:
 		/* Core internal bug */
 		if (!(dev->features & CLOCK_EVT_FEAT_PERIODIC))
 			return -ENOSYS;
-		return dev->set_state_periodic(dev);
+		if (dev->set_state_periodic)
+			return dev->set_state_periodic(dev);
+		return 0;
 
 	case CLOCK_EVT_STATE_ONESHOT:
 		/* Core internal bug */
 		if (!(dev->features & CLOCK_EVT_FEAT_ONESHOT))
 			return -ENOSYS;
-		return dev->set_state_oneshot(dev);
+		if (dev->set_state_oneshot)
+			return dev->set_state_oneshot(dev);
+		return 0;
 
 	case CLOCK_EVT_STATE_ONESHOT_STOPPED:
 		/* Core internal bug */
@@ -471,18 +477,6 @@ static int clockevents_sanity_check(struct clock_event_device *dev)
 	if (dev->features & CLOCK_EVT_FEAT_DUMMY)
 		return 0;
 
-	/* New state-specific callbacks */
-	if (!dev->set_state_shutdown)
-		return -EINVAL;
-
-	if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) &&
-	    !dev->set_state_periodic)
-		return -EINVAL;
-
-	if ((dev->features & CLOCK_EVT_FEAT_ONESHOT) &&
-	    !dev->set_state_oneshot)
-		return -EINVAL;
-
 	return 0;
 }
 

  reply	other threads:[~2015-07-07  8:49 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 10:54 [PATCH 00/18] ARM: Migrate clockevent drivers to 'set-state' Viresh Kumar
2015-07-06 10:54 ` [PATCH 01/18] ARM/smp_twd: Migrate to new 'set-state' interface Viresh Kumar
2015-07-06 10:54 ` [PATCH 02/18] ARM/cns3xxx/timer: " Viresh Kumar
2015-07-14  6:03   ` Krzysztof Hałasa
2015-07-06 10:54 ` [PATCH 03/18] ARM/davinci/time: " Viresh Kumar
2015-07-06 10:54 ` [PATCH 04/18] ARM/dc21285-timer: " Viresh Kumar
2015-07-06 10:54 ` [PATCH 05/18] ARM/gemini/time: " Viresh Kumar
2015-07-06 19:36   ` Hans Ulli Kroll
2015-07-06 10:54 ` [PATCH 06/18] ARM/imx/epit: " Viresh Kumar
2015-07-06 10:54 ` [PATCH 07/18] ARM/ixp4xx/timer: " Viresh Kumar
2015-07-14  6:04   ` Krzysztof Hałasa
2015-07-06 10:54 ` [PATCH 08/18] ARM/ks8695/time: " Viresh Kumar
2015-07-07 12:22   ` Greg Ungerer
2015-07-06 10:54 ` [PATCH 09/18] ARM/lpc32xx/timer: " Viresh Kumar
2015-07-06 10:54 ` [PATCH 10/18] ARM/mmp/time: " Viresh Kumar
2015-07-06 10:54 ` [PATCH 11/18] ARM/netx/time: " Viresh Kumar
2015-07-06 10:54 ` [PATCH 12/18] ARM/omap1/time: " Viresh Kumar
2015-07-06 15:20   ` santosh shilimkar
2015-07-09  9:48     ` Tony Lindgren
2015-07-06 10:54 ` [PATCH 13/18] ARM/omap1/timer32: " Viresh Kumar
2015-07-06 15:21   ` santosh shilimkar
2015-07-09  9:49     ` Tony Lindgren
2015-07-06 10:54 ` [PATCH 14/18] ARM/omap2/timer: " Viresh Kumar
2015-07-06 15:20   ` santosh shilimkar
2015-07-09  9:50     ` Tony Lindgren
2015-07-06 10:54 ` [PATCH 15/18] ARM/SPEAr/time: " Viresh Kumar
2015-07-06 10:54 ` [PATCH 16/18] ARM/w90x900/time: " Viresh Kumar
2015-07-06 10:54 ` [PATCH 17/18] ARM/iop/time: " Viresh Kumar
2015-07-06 10:54 ` [PATCH 18/18] ARM/orion/time: " Viresh Kumar
2015-07-06 17:26 ` [PATCH 00/18] ARM: Migrate clockevent drivers to 'set-state' Thomas Gleixner
2015-07-07  8:11   ` [PULL] clockevents: last minute patch for 4.2-rc2 Daniel Lezcano
2015-07-07  8:14     ` [PATCH] clockevents: Allow set-state callbacks to be optional Daniel Lezcano
2015-07-07  8:49       ` tip-bot for Viresh Kumar [this message]
2015-07-13  2:52 ` [PATCH 00/18] ARM: Migrate clockevent drivers to 'set-state' Viresh Kumar

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=tip-7c4a976cd55972b68c75a978f171b6db5df4ce66@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.