Move the power of 2 check on frequencies down into individual rtc drivers
This is to allow for non power of 2 real time clock periodic interrupts
such as those on the pxa27x to be found in the new pxa27x-rtc driver
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
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>
if (rtc->ops->irq_set_freq == NULL)
return -ENXIO;
if (rtc->ops->irq_set_freq == NULL)
return -ENXIO;
- if (!is_power_of_2(freq))
- return -EINVAL;
-
spin_lock_irqsave(&rtc->irq_task_lock, flags);
if (rtc->irq_task != NULL && task == NULL)
err = -EBUSY;
spin_lock_irqsave(&rtc->irq_task_lock, flags);
if (rtc->irq_task != NULL && task == NULL)
err = -EBUSY;
#include <linux/spinlock.h>
#include <linux/platform_device.h>
#include <linux/mod_devicetable.h>
#include <linux/spinlock.h>
#include <linux/platform_device.h>
#include <linux/mod_devicetable.h>
/* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */
#include <asm-generic/rtc.h>
/* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */
#include <asm-generic/rtc.h>
if (!is_valid_irq(cmos->irq))
return -ENXIO;
if (!is_valid_irq(cmos->irq))
return -ENXIO;
+ if (!is_power_of_2(freq))
+ return -EINVAL;
/* 0 = no irqs; 1 = 2^15 Hz ... 15 = 2^0 Hz */
f = ffs(freq);
if (f-- > 16)
/* 0 = no irqs; 1 = 2^15 Hz ... 15 = 2^0 Hz */
f = ffs(freq);
if (f-- > 16)
+ if (!is_power_of_2(freq))
+ return -EINVAL;
+
spin_lock_irq(&s3c_rtc_pie_lock);
tmp = readb(s3c_rtc_base + S3C2410_TICNT) & S3C2410_TICNT_ENABLE;
spin_lock_irq(&s3c_rtc_pie_lock);
tmp = readb(s3c_rtc_base + S3C2410_TICNT) & S3C2410_TICNT_ENABLE;
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/io.h>
#include <asm/rtc.h>
#define DRV_NAME "sh-rtc"
#include <asm/rtc.h>
#define DRV_NAME "sh-rtc"
static int sh_rtc_irq_set_freq(struct device *dev, int freq)
{
static int sh_rtc_irq_set_freq(struct device *dev, int freq)
{
+ if (!is_power_of_2(freq))
+ return -EINVAL;
return sh_rtc_ioctl(dev, RTC_IRQP_SET, freq);
}
return sh_rtc_ioctl(dev, RTC_IRQP_SET, freq);
}
#include <linux/rtc.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/rtc.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#include <asm/div64.h>
#include <asm/io.h>
#include <asm/div64.h>
#include <asm/io.h>
+ if (!is_power_of_2(freq))
+ return -EINVAL;
count = RTC_FREQUENCY;
do_div(count, freq);
count = RTC_FREQUENCY;
do_div(count, freq);