Skip to content

Commit fd928f3

Browse files
bebarinoKAGA-KOKO
authored andcommitted
alarmtimer: Make alarmtimer_get_rtcdev() a stub when CONFIG_RTC_CLASS=n
The stubbed version of alarmtimer_get_rtcdev() is not exported. so this won't work if this function is used in a module when CONFIG_RTC_CLASS=n. Move the stub function to the header file and make it inline so that callers don't have to worry about linking against this symbol. rtcdev isn't used outside of this ifdef so it's not required to be redefined to NULL. Drop that while touching this area. Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7c94cac commit fd928f3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

include/linux/alarmtimer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval);
6060
u64 alarm_forward_now(struct alarm *alarm, ktime_t interval);
6161
ktime_t alarm_expires_remaining(const struct alarm *alarm);
6262

63+
#ifdef CONFIG_RTC_CLASS
6364
/* Provide way to access the rtc device being used by alarmtimers */
6465
struct rtc_device *alarmtimer_get_rtcdev(void);
66+
#else
67+
static inline struct rtc_device *alarmtimer_get_rtcdev(void) { return NULL; }
68+
#endif
6569

6670
#endif

kernel/time/alarmtimer.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,6 @@ static void alarmtimer_rtc_interface_remove(void)
143143
class_interface_unregister(&alarmtimer_rtc_interface);
144144
}
145145
#else
146-
struct rtc_device *alarmtimer_get_rtcdev(void)
147-
{
148-
return NULL;
149-
}
150-
#define rtcdev (NULL)
151146
static inline int alarmtimer_rtc_interface_setup(void) { return 0; }
152147
static inline void alarmtimer_rtc_interface_remove(void) { }
153148
static inline void alarmtimer_rtc_timer_init(void) { }

0 commit comments

Comments
 (0)