All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <swboyd@chromium.org>
To: John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>
Subject: [PATCH v3 3/4] alarmtimer: Make alarmtimer_get_rtcdev() a stub when CONFIG_RTC_CLASS=n
Date: Thu, 23 Jan 2020 21:58:48 -0800	[thread overview]
Message-ID: <20200124055849.154411-4-swboyd@chromium.org> (raw)
In-Reply-To: <20200124055849.154411-1-swboyd@chromium.org>

The export isn't there for the stubbed version of
alarmtimer_get_rtcdev() so this won't work if someone tries to call this
function when CONFIG_RTC_CLASS=n. Export a stub function in the header
file so that callers don't have to worry about linking against this
symbol. And rtcdev isn't used outside of this ifdef so we don't need to
redefine it as NULL. Drop that because we're nearby.

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 include/linux/alarmtimer.h | 4 ++++
 kernel/time/alarmtimer.c   | 5 -----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 74748e306f4b..05e758b8b894 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -60,7 +60,11 @@ u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval);
 u64 alarm_forward_now(struct alarm *alarm, ktime_t interval);
 ktime_t alarm_expires_remaining(const struct alarm *alarm);
 
+#ifdef CONFIG_RTC_CLASS
 /* Provide way to access the rtc device being used by alarmtimers */
 struct rtc_device *alarmtimer_get_rtcdev(void);
+#else
+static inline struct rtc_device *alarmtimer_get_rtcdev(void) { return NULL; }
+#endif
 
 #endif
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 395d4a6db1b2..36124aea8d6f 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -145,11 +145,6 @@ static void alarmtimer_rtc_interface_remove(void)
 	class_interface_unregister(&alarmtimer_rtc_interface);
 }
 #else
-struct rtc_device *alarmtimer_get_rtcdev(void)
-{
-	return NULL;
-}
-#define rtcdev (NULL)
 static inline int alarmtimer_rtc_interface_setup(void) { return 0; }
 static inline void alarmtimer_rtc_interface_remove(void) { }
 static inline void alarmtimer_rtc_timer_init(void) { }
-- 
Sent by a computer, using git, on the internet


  parent reply	other threads:[~2020-01-24  5:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24  5:58 [PATCH v3 0/4] Fix alarmtimer suspend failure Stephen Boyd
2020-01-24  5:58 ` [PATCH v3 1/4] alarmtimer: Make alarmtimer platform device child of RTC device Stephen Boyd
2020-01-24 20:08   ` [tip: timers/core] " tip-bot2 for Stephen Boyd
2020-01-24  5:58 ` [PATCH v3 2/4] alarmtimer: Use wakeup source from alarmtimer platform device Stephen Boyd
2020-01-24 20:08   ` [tip: timers/core] " tip-bot2 for Stephen Boyd
2020-01-24  5:58 ` Stephen Boyd [this message]
2020-01-24 20:08   ` [tip: timers/core] alarmtimer: Make alarmtimer_get_rtcdev() a stub when CONFIG_RTC_CLASS=n tip-bot2 for Stephen Boyd
2020-01-24  5:58 ` [PATCH v3 4/4] alarmtimer: Update alarmtimer_get_rtcdev() docs to reflect reality Stephen Boyd
2020-01-24 20:08   ` [tip: timers/core] " tip-bot2 for Stephen Boyd

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=20200124055849.154411-4-swboyd@chromium.org \
    --to=swboyd@chromium.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    /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.