commit 2601a46474db2dcbc08ee690e56f08a10abe65cb
tree 3b6ffb34023a252599b08b045db100a6ca6bfff7
parent 7531d8faa85f8880db433027bf2b04950e49baeb
author David Brownell <[EMAIL PROTECTED]> 1164481767 -0800
committer Linus Torvalds <[EMAIL PROTECTED]> 1164490113 -0800

[PATCH] rtc framework handles periodic irqs

The RTC framework has an irq_set_freq() method that should be used to manage
the periodic IRQ frequency, but the current ioctl logic doesn't know how to do
that.  This patch teaches it how.

This means that drivers implementing irq_set_freq() will automatically support
RTC_IRQP_{READ,SET} ioctls; that logic doesn't need duplication within the
driver.

[EMAIL PROTECTED]: export rtc_irq_set_freq]
Signed-off-by: David Brownell <[EMAIL PROTECTED]>
Acked-by: Alessandro Zummo <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 drivers/rtc/interface.c |    1 +
 drivers/rtc/rtc-dev.c   |   13 ++++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 579cd66..4783ec6 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -265,3 +265,4 @@ int rtc_irq_set_freq(struct class_device
        }
        return err;
 }
+EXPORT_SYMBOL_GPL(rtc_irq_set_freq);
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index 583789c..3109865 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -214,7 +214,7 @@ static int rtc_dev_ioctl(struct inode *i
        struct rtc_wkalrm alarm;
        void __user *uarg = (void __user *) arg;
 
-       /* check that the calles has appropriate permissions
+       /* check that the calling task has appropriate permissions
         * for certain ioctls. doing this check here is useful
         * to avoid duplicate code in each driver.
         */
@@ -299,6 +299,17 @@ static int rtc_dev_ioctl(struct inode *i
 
                err = rtc_set_time(class_dev, &tm);
                break;
+
+       case RTC_IRQP_READ:
+               if (ops->irq_set_freq)
+                       err = put_user(rtc->irq_freq, (unsigned long *) arg);
+               break;
+
+       case RTC_IRQP_SET:
+               if (ops->irq_set_freq)
+                       err = rtc_irq_set_freq(class_dev, rtc->irq_task, arg);
+               break;
+
 #if 0
        case RTC_EPOCH_SET:
 #ifndef rtc_epoch
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to