aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-12-05 09:37:56 -0500
committerDavid Howells <dhowells@warthog.cambridge.redhat.com>2006-12-05 09:37:56 -0500
commit4c1ac1b49122b805adfa4efc620592f68dccf5db (patch)
tree87557f4bc2fd4fe65b7570489c2f610c45c0adcd /drivers/rtc
parentc4028958b6ecad064b1a6303a6a5906d4fe48d73 (diff)
parentd916faace3efc0bf19fe9a615a1ab8fa1a24cd93 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/infiniband/core/iwcm.c drivers/net/chelsio/cxgb2.c drivers/net/wireless/bcm43xx/bcm43xx_main.c drivers/net/wireless/prism54/islpci_eth.c drivers/usb/core/hub.h drivers/usb/input/hid-core.c net/core/netpoll.c Fix up merge failures with Linus's head and fix new compilation failures. Signed-Off-By: David Howells <dhowells@redhat.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/interface.c16
-rw-r--r--drivers/rtc/rtc-at91.c3
-rw-r--r--drivers/rtc/rtc-dev.c25
-rw-r--r--drivers/rtc/rtc-ds1553.c3
-rw-r--r--drivers/rtc/rtc-rs5c372.c6
-rw-r--r--drivers/rtc/rtc-test.c2
6 files changed, 40 insertions, 15 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 579cd667b16f..6f11f6dfdd9d 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -145,6 +145,13 @@ int rtc_set_alarm(struct class_device *class_dev, struct rtc_wkalrm *alarm)
145} 145}
146EXPORT_SYMBOL_GPL(rtc_set_alarm); 146EXPORT_SYMBOL_GPL(rtc_set_alarm);
147 147
148/**
149 * rtc_update_irq - report RTC periodic, alarm, and/or update irqs
150 * @class_dev: the rtc's class device
151 * @num: how many irqs are being reported (usually one)
152 * @events: mask of RTC_IRQF with one or more of RTC_PF, RTC_AF, RTC_UF
153 * Context: in_interrupt(), irqs blocked
154 */
148void rtc_update_irq(struct class_device *class_dev, 155void rtc_update_irq(struct class_device *class_dev,
149 unsigned long num, unsigned long events) 156 unsigned long num, unsigned long events)
150{ 157{
@@ -201,12 +208,12 @@ int rtc_irq_register(struct class_device *class_dev, struct rtc_task *task)
201 if (task == NULL || task->func == NULL) 208 if (task == NULL || task->func == NULL)
202 return -EINVAL; 209 return -EINVAL;
203 210
204 spin_lock(&rtc->irq_task_lock); 211 spin_lock_irq(&rtc->irq_task_lock);
205 if (rtc->irq_task == NULL) { 212 if (rtc->irq_task == NULL) {
206 rtc->irq_task = task; 213 rtc->irq_task = task;
207 retval = 0; 214 retval = 0;
208 } 215 }
209 spin_unlock(&rtc->irq_task_lock); 216 spin_unlock_irq(&rtc->irq_task_lock);
210 217
211 return retval; 218 return retval;
212} 219}
@@ -216,10 +223,10 @@ void rtc_irq_unregister(struct class_device *class_dev, struct rtc_task *task)
216{ 223{
217 struct rtc_device *rtc = to_rtc_device(class_dev); 224 struct rtc_device *rtc = to_rtc_device(class_dev);
218 225
219 spin_lock(&rtc->irq_task_lock); 226 spin_lock_irq(&rtc->irq_task_lock);
220 if (rtc->irq_task == task) 227 if (rtc->irq_task == task)
221 rtc->irq_task = NULL; 228 rtc->irq_task = NULL;
222 spin_unlock(&rtc->irq_task_lock); 229 spin_unlock_irq(&rtc->irq_task_lock);
223} 230}
224EXPORT_SYMBOL_GPL(rtc_irq_unregister); 231EXPORT_SYMBOL_GPL(rtc_irq_unregister);
225 232
@@ -265,3 +272,4 @@ int rtc_irq_set_freq(struct class_device *class_dev, struct rtc_task *task, int
265 } 272 }
266 return err; 273 return err;
267} 274}
275EXPORT_SYMBOL_GPL(rtc_irq_set_freq);
diff --git a/drivers/rtc/rtc-at91.c b/drivers/rtc/rtc-at91.c
index bd61e99540a3..5c8addcaf1fb 100644
--- a/drivers/rtc/rtc-at91.c
+++ b/drivers/rtc/rtc-at91.c
@@ -292,7 +292,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
292 AT91_RTC_CALEV); 292 AT91_RTC_CALEV);
293 293
294 ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, 294 ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt,
295 IRQF_SHARED, "at91_rtc", pdev); 295 IRQF_DISABLED | IRQF_SHARED,
296 "at91_rtc", pdev);
296 if (ret) { 297 if (ret) {
297 printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", 298 printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n",
298 AT91_ID_SYS); 299 AT91_ID_SYS);
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index dcf5f86461f7..828b329e08e0 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -62,7 +62,9 @@ static void rtc_uie_task(struct work_struct *work)
62 int err; 62 int err;
63 63
64 err = rtc_read_time(&rtc->class_dev, &tm); 64 err = rtc_read_time(&rtc->class_dev, &tm);
65 spin_lock_irq(&rtc->irq_lock); 65
66 local_irq_disable();
67 spin_lock(&rtc->irq_lock);
66 if (rtc->stop_uie_polling || err) { 68 if (rtc->stop_uie_polling || err) {
67 rtc->uie_task_active = 0; 69 rtc->uie_task_active = 0;
68 } else if (rtc->oldsecs != tm.tm_sec) { 70 } else if (rtc->oldsecs != tm.tm_sec) {
@@ -75,11 +77,11 @@ static void rtc_uie_task(struct work_struct *work)
75 } else if (schedule_work(&rtc->uie_task) == 0) { 77 } else if (schedule_work(&rtc->uie_task) == 0) {
76 rtc->uie_task_active = 0; 78 rtc->uie_task_active = 0;
77 } 79 }
78 spin_unlock_irq(&rtc->irq_lock); 80 spin_unlock(&rtc->irq_lock);
79 if (num) 81 if (num)
80 rtc_update_irq(&rtc->class_dev, num, RTC_UF | RTC_IRQF); 82 rtc_update_irq(&rtc->class_dev, num, RTC_UF | RTC_IRQF);
83 local_irq_enable();
81} 84}
82
83static void rtc_uie_timer(unsigned long data) 85static void rtc_uie_timer(unsigned long data)
84{ 86{
85 struct rtc_device *rtc = (struct rtc_device *)data; 87 struct rtc_device *rtc = (struct rtc_device *)data;
@@ -215,7 +217,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
215 struct rtc_wkalrm alarm; 217 struct rtc_wkalrm alarm;
216 void __user *uarg = (void __user *) arg; 218 void __user *uarg = (void __user *) arg;
217 219
218 /* check that the calles has appropriate permissions 220 /* check that the calling task has appropriate permissions
219 * for certain ioctls. doing this check here is useful 221 * for certain ioctls. doing this check here is useful
220 * to avoid duplicate code in each driver. 222 * to avoid duplicate code in each driver.
221 */ 223 */
@@ -239,10 +241,10 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
239 241
240 /* avoid conflicting IRQ users */ 242 /* avoid conflicting IRQ users */
241 if (cmd == RTC_PIE_ON || cmd == RTC_PIE_OFF || cmd == RTC_IRQP_SET) { 243 if (cmd == RTC_PIE_ON || cmd == RTC_PIE_OFF || cmd == RTC_IRQP_SET) {
242 spin_lock(&rtc->irq_task_lock); 244 spin_lock_irq(&rtc->irq_task_lock);
243 if (rtc->irq_task) 245 if (rtc->irq_task)
244 err = -EBUSY; 246 err = -EBUSY;
245 spin_unlock(&rtc->irq_task_lock); 247 spin_unlock_irq(&rtc->irq_task_lock);
246 248
247 if (err < 0) 249 if (err < 0)
248 return err; 250 return err;
@@ -300,6 +302,17 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
300 302
301 err = rtc_set_time(class_dev, &tm); 303 err = rtc_set_time(class_dev, &tm);
302 break; 304 break;
305
306 case RTC_IRQP_READ:
307 if (ops->irq_set_freq)
308 err = put_user(rtc->irq_freq, (unsigned long *) arg);
309 break;
310
311 case RTC_IRQP_SET:
312 if (ops->irq_set_freq)
313 err = rtc_irq_set_freq(class_dev, rtc->irq_task, arg);
314 break;
315
303#if 0 316#if 0
304 case RTC_EPOCH_SET: 317 case RTC_EPOCH_SET:
305#ifndef rtc_epoch 318#ifndef rtc_epoch
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index 78552e6e76aa..001eb1123a65 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -340,7 +340,8 @@ static int __init ds1553_rtc_probe(struct platform_device *pdev)
340 340
341 if (pdata->irq >= 0) { 341 if (pdata->irq >= 0) {
342 writeb(0, ioaddr + RTC_INTERRUPTS); 342 writeb(0, ioaddr + RTC_INTERRUPTS);
343 if (request_irq(pdata->irq, ds1553_rtc_interrupt, IRQF_SHARED, 343 if (request_irq(pdata->irq, ds1553_rtc_interrupt,
344 IRQF_DISABLED | IRQF_SHARED,
344 pdev->name, pdev) < 0) { 345 pdev->name, pdev) < 0) {
345 dev_warn(&pdev->dev, "interrupt not available.\n"); 346 dev_warn(&pdev->dev, "interrupt not available.\n");
346 pdata->irq = -1; 347 pdata->irq = -1;
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 2a86632580f1..a44fe4efa216 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -126,13 +126,13 @@ static int rs5c372_get_trim(struct i2c_client *client, int *osc, int *trim)
126 return -EIO; 126 return -EIO;
127 } 127 }
128 128
129 dev_dbg(&client->dev, "%s: raw trim=%x\n", __FUNCTION__, *trim);
130
131 if (osc) 129 if (osc)
132 *osc = (buf & RS5C372_TRIM_XSL) ? 32000 : 32768; 130 *osc = (buf & RS5C372_TRIM_XSL) ? 32000 : 32768;
133 131
134 if (trim) 132 if (trim) {
135 *trim = buf & RS5C372_TRIM_MASK; 133 *trim = buf & RS5C372_TRIM_MASK;
134 dev_dbg(&client->dev, "%s: raw trim=%x\n", __FUNCTION__, *trim);
135 }
136 136
137 return 0; 137 return 0;
138} 138}
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c
index bc4bd24508a2..6ef9c62d5032 100644
--- a/drivers/rtc/rtc-test.c
+++ b/drivers/rtc/rtc-test.c
@@ -99,6 +99,7 @@ static ssize_t test_irq_store(struct device *dev,
99 struct rtc_device *rtc = platform_get_drvdata(plat_dev); 99 struct rtc_device *rtc = platform_get_drvdata(plat_dev);
100 100
101 retval = count; 101 retval = count;
102 local_irq_disable();
102 if (strncmp(buf, "tick", 4) == 0) 103 if (strncmp(buf, "tick", 4) == 0)
103 rtc_update_irq(&rtc->class_dev, 1, RTC_PF | RTC_IRQF); 104 rtc_update_irq(&rtc->class_dev, 1, RTC_PF | RTC_IRQF);
104 else if (strncmp(buf, "alarm", 5) == 0) 105 else if (strncmp(buf, "alarm", 5) == 0)
@@ -107,6 +108,7 @@ static ssize_t test_irq_store(struct device *dev,
107 rtc_update_irq(&rtc->class_dev, 1, RTC_UF | RTC_IRQF); 108 rtc_update_irq(&rtc->class_dev, 1, RTC_UF | RTC_IRQF);
108 else 109 else
109 retval = -EINVAL; 110 retval = -EINVAL;
111 local_irq_enable();
110 112
111 return retval; 113 return retval;
112} 114}