Skip to content

Commit

Permalink
[PATCH] rtc framework handles periodic irqs
Browse files Browse the repository at this point in the history
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.

[akpm@osdl.org: export rtc_irq_set_freq]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
David Brownell authored and Linus Torvalds committed Nov 25, 2006
1 parent 7531d8f commit 2601a46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/rtc/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,4 @@ int rtc_irq_set_freq(struct class_device *class_dev, struct rtc_task *task, int
}
return err;
}
EXPORT_SYMBOL_GPL(rtc_irq_set_freq);
13 changes: 12 additions & 1 deletion drivers/rtc/rtc-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
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.
*/
Expand Down Expand Up @@ -299,6 +299,17 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,

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
Expand Down

0 comments on commit 2601a46

Please sign in to comment.