lkml.org 
[lkml]   [2020]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 3/4] alarmtimer: Make alarmtimer_get_rtcdev() a stub when CONFIG_RTC_CLASS=n
Date
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
\
 
 \ /
  Last update: 2020-01-24 06:59    [W:0.073 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site