]> Pileus Git - ~andy/linux/blobdiff - drivers/rtc/rtc-dev.c
USB: add QL355P power supply ids to fdti_sio
[~andy/linux] / drivers / rtc / rtc-dev.c
index 3109865e8d7324d8e697ff7f04c5e1d51e20cef3..137330b8636b1192ec2965ee22defd28a600a4db 100644 (file)
@@ -53,15 +53,18 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
  * Routine to poll RTC seconds field for change as often as possible,
  * after first RTC_UIE use timer to reduce polling
  */
-static void rtc_uie_task(void *data)
+static void rtc_uie_task(struct work_struct *work)
 {
-       struct rtc_device *rtc = data;
+       struct rtc_device *rtc =
+               container_of(work, struct rtc_device, uie_task);
        struct rtc_time tm;
        int num = 0;
        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) {
@@ -74,11 +77,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;
@@ -238,10 +241,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;
@@ -302,7 +305,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
 
        case RTC_IRQP_READ:
                if (ops->irq_set_freq)
-                       err = put_user(rtc->irq_freq, (unsigned long *) arg);
+                       err = put_user(rtc->irq_freq, (unsigned long __user *)uarg);
                break;
 
        case RTC_IRQP_SET:
@@ -381,7 +384,7 @@ static int rtc_dev_fasync(int fd, struct file *file, int on)
        return fasync_helper(fd, file, on, &rtc->async_queue);
 }
 
-static struct file_operations rtc_dev_fops = {
+static const struct file_operations rtc_dev_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .read           = rtc_dev_read,
@@ -409,7 +412,7 @@ static int rtc_dev_add_device(struct class_device *class_dev,
        spin_lock_init(&rtc->irq_lock);
        init_waitqueue_head(&rtc->irq_queue);
 #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
-       INIT_WORK(&rtc->uie_task, rtc_uie_task, rtc);
+       INIT_WORK(&rtc->uie_task, rtc_uie_task);
        setup_timer(&rtc->uie_timer, rtc_uie_timer, (unsigned long)rtc);
 #endif
 
@@ -432,7 +435,7 @@ static int rtc_dev_add_device(struct class_device *class_dev,
                goto err_cdev_del;
        }
 
-       dev_info(class_dev->dev, "rtc intf: dev (%d:%d)\n",
+       dev_dbg(class_dev->dev, "rtc intf: dev (%d:%d)\n",
                MAJOR(rtc->rtc_dev->devt),
                MINOR(rtc->rtc_dev->devt));