aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-cmos.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-10-16 04:28:16 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:13 -0400
commit97144c67566241db46633727f2860e6428373fe4 (patch)
treeb3863ed198037668cb80df710678a6e249842654 /drivers/rtc/rtc-cmos.c
parentd691eb901e044065de10756ea78a5758d457c7fd (diff)
rtc_irq_set_freq() requires power-of-two and associated kerneldoc
RTC periodic IRQs are only defined to work for 2^N Hz values. This patch moves that validity check into the infrastructure, so drivers don't need to check it; and adds kerneldoc for the two interface functions related to periodic IRQs. (One of which was quite mysterious until its first use was recently checked in!) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-cmos.c')
-rw-r--r--drivers/rtc/rtc-cmos.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 5d760bb6c2cd..6d0c35397b49 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -246,11 +246,9 @@ static int cmos_irq_set_freq(struct device *dev, int freq)
246 246
247 /* 0 = no irqs; 1 = 2^15 Hz ... 15 = 2^0 Hz */ 247 /* 0 = no irqs; 1 = 2^15 Hz ... 15 = 2^0 Hz */
248 f = ffs(freq); 248 f = ffs(freq);
249 if (f != 0) { 249 if (f-- > 16)
250 if (f-- > 16 || freq != (1 << f)) 250 return -EINVAL;
251 return -EINVAL; 251 f = 16 - f;
252 f = 16 - f;
253 }
254 252
255 spin_lock_irqsave(&rtc_lock, flags); 253 spin_lock_irqsave(&rtc_lock, flags);
256 CMOS_WRITE(RTC_REF_CLCK_32KHZ | f, RTC_FREQ_SELECT); 254 CMOS_WRITE(RTC_REF_CLCK_32KHZ | f, RTC_FREQ_SELECT);