diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2009-03-31 18:24:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 11:59:24 -0400 |
commit | 78d89ef40c2ff7265df077e20c4d76be7d415204 (patch) | |
tree | 68503b0252682a496495b7adb46f6aa278db88ae /include/linux/rtc.h | |
parent | 47367a3ba425d70467af0009782098235ddbf204 (diff) |
rtc: convert LEAP_YEAR into an inline
- the LEAP_YEAR macro is buggy - it references its arg multiple times.
Fix this by turning it into a C function.
- give it a more approriate name
- Move it to rtc.h so that other .c files can use it, instead of copying it.
Cc: dann frazier <dannf@hp.com>
Acked-by: Alessandro Zummo <alessandro.zummo@towertech.it>
Cc: stephane eranian <eranian@googlemail.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/rtc.h')
-rw-r--r-- | include/linux/rtc.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 4046b75563c1..60f88a7fb13d 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
@@ -99,6 +99,7 @@ struct rtc_pll_info { | |||
99 | 99 | ||
100 | #ifdef __KERNEL__ | 100 | #ifdef __KERNEL__ |
101 | 101 | ||
102 | #include <linux/types.h> | ||
102 | #include <linux/interrupt.h> | 103 | #include <linux/interrupt.h> |
103 | 104 | ||
104 | extern int rtc_month_days(unsigned int month, unsigned int year); | 105 | extern int rtc_month_days(unsigned int month, unsigned int year); |
@@ -232,6 +233,11 @@ int rtc_register(rtc_task_t *task); | |||
232 | int rtc_unregister(rtc_task_t *task); | 233 | int rtc_unregister(rtc_task_t *task); |
233 | int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); | 234 | int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); |
234 | 235 | ||
236 | static inline bool is_leap_year(unsigned int year) | ||
237 | { | ||
238 | return (!(year % 4) && (year % 100)) || !(year % 400); | ||
239 | } | ||
240 | |||
235 | #endif /* __KERNEL__ */ | 241 | #endif /* __KERNEL__ */ |
236 | 242 | ||
237 | #endif /* _LINUX_RTC_H_ */ | 243 | #endif /* _LINUX_RTC_H_ */ |