Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41074
b: refs/heads/master
c: d728b1e
h: refs/heads/master
v: v3
  • Loading branch information
David Brownell authored and Linus Torvalds committed Nov 25, 2006
1 parent 3929e98 commit 86bd037
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2601a46474db2dcbc08ee690e56f08a10abe65cb
refs/heads/master: d728b1e69fd5829ec2ab2434381e5a268d4f684a
15 changes: 11 additions & 4 deletions trunk/drivers/rtc/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ int rtc_set_alarm(struct class_device *class_dev, struct rtc_wkalrm *alarm)
}
EXPORT_SYMBOL_GPL(rtc_set_alarm);

/**
* rtc_update_irq - report RTC periodic, alarm, and/or update irqs
* @class_dev: the rtc's class device
* @num: how many irqs are being reported (usually one)
* @events: mask of RTC_IRQF with one or more of RTC_PF, RTC_AF, RTC_UF
* Context: in_interrupt(), irqs blocked
*/
void rtc_update_irq(struct class_device *class_dev,
unsigned long num, unsigned long events)
{
Expand Down Expand Up @@ -201,12 +208,12 @@ int rtc_irq_register(struct class_device *class_dev, struct rtc_task *task)
if (task == NULL || task->func == NULL)
return -EINVAL;

spin_lock(&rtc->irq_task_lock);
spin_lock_irq(&rtc->irq_task_lock);
if (rtc->irq_task == NULL) {
rtc->irq_task = task;
retval = 0;
}
spin_unlock(&rtc->irq_task_lock);
spin_unlock_irq(&rtc->irq_task_lock);

return retval;
}
Expand All @@ -216,10 +223,10 @@ void rtc_irq_unregister(struct class_device *class_dev, struct rtc_task *task)
{
struct rtc_device *rtc = to_rtc_device(class_dev);

spin_lock(&rtc->irq_task_lock);
spin_lock_irq(&rtc->irq_task_lock);
if (rtc->irq_task == task)
rtc->irq_task = NULL;
spin_unlock(&rtc->irq_task_lock);
spin_unlock_irq(&rtc->irq_task_lock);
}
EXPORT_SYMBOL_GPL(rtc_irq_unregister);

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/rtc/rtc-at91.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
AT91_RTC_CALEV);

ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt,
IRQF_SHARED, "at91_rtc", pdev);
IRQF_DISABLED | IRQF_SHARED,
"at91_rtc", pdev);
if (ret) {
printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n",
AT91_ID_SYS);
Expand Down
12 changes: 7 additions & 5 deletions trunk/drivers/rtc/rtc-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ static void rtc_uie_task(void *data)
int err;

err = rtc_read_time(&rtc->class_dev, &tm);
spin_lock_irq(&rtc->irq_lock);

local_irq_disable();
spin_lock(&rtc->irq_lock);
if (rtc->stop_uie_polling || err) {
rtc->uie_task_active = 0;
} else if (rtc->oldsecs != tm.tm_sec) {
Expand All @@ -74,11 +76,11 @@ static void rtc_uie_task(void *data)
} else if (schedule_work(&rtc->uie_task) == 0) {
rtc->uie_task_active = 0;
}
spin_unlock_irq(&rtc->irq_lock);
spin_unlock(&rtc->irq_lock);
if (num)
rtc_update_irq(&rtc->class_dev, num, RTC_UF | RTC_IRQF);
local_irq_enable();
}

static void rtc_uie_timer(unsigned long data)
{
struct rtc_device *rtc = (struct rtc_device *)data;
Expand Down Expand Up @@ -238,10 +240,10 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,

/* avoid conflicting IRQ users */
if (cmd == RTC_PIE_ON || cmd == RTC_PIE_OFF || cmd == RTC_IRQP_SET) {
spin_lock(&rtc->irq_task_lock);
spin_lock_irq(&rtc->irq_task_lock);
if (rtc->irq_task)
err = -EBUSY;
spin_unlock(&rtc->irq_task_lock);
spin_unlock_irq(&rtc->irq_task_lock);

if (err < 0)
return err;
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/rtc/rtc-ds1553.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ static int __init ds1553_rtc_probe(struct platform_device *pdev)

if (pdata->irq >= 0) {
writeb(0, ioaddr + RTC_INTERRUPTS);
if (request_irq(pdata->irq, ds1553_rtc_interrupt, IRQF_SHARED,
if (request_irq(pdata->irq, ds1553_rtc_interrupt,
IRQF_DISABLED | IRQF_SHARED,
pdev->name, pdev) < 0) {
dev_warn(&pdev->dev, "interrupt not available.\n");
pdata->irq = -1;
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/rtc/rtc-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ static ssize_t test_irq_store(struct device *dev,
struct rtc_device *rtc = platform_get_drvdata(plat_dev);

retval = count;
local_irq_disable();
if (strncmp(buf, "tick", 4) == 0)
rtc_update_irq(&rtc->class_dev, 1, RTC_PF | RTC_IRQF);
else if (strncmp(buf, "alarm", 5) == 0)
Expand All @@ -107,6 +108,7 @@ static ssize_t test_irq_store(struct device *dev,
rtc_update_irq(&rtc->class_dev, 1, RTC_UF | RTC_IRQF);
else
retval = -EINVAL;
local_irq_enable();

return retval;
}
Expand Down

0 comments on commit 86bd037

Please sign in to comment.