linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / char / vr41xx_rtc.c
index a6dbe4d..bc1b4a1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Driver for NEC VR4100 series  Real Time Clock unit.
  *
- *  Copyright (C) 2003-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *  Copyright (C) 2003-2005  Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/fs.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
@@ -37,7 +37,7 @@
 #include <asm/uaccess.h>
 #include <asm/vr41xx/vr41xx.h>
 
-MODULE_AUTHOR("Yoichi Yuasa <yuasa@hh.iij4u.or.jp>");
+MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>");
 MODULE_DESCRIPTION("NEC VR4100 series RTC driver");
 MODULE_LICENSE("GPL");
 
@@ -127,8 +127,6 @@ struct resource rtc_resource[2] = {
                .flags  = IORESOURCE_MEM,       },
 };
 
-#define RTC_NUM_RESOURCES      sizeof(rtc_resource) / sizeof(struct resource)
-
 static inline unsigned long read_elapsed_second(void)
 {
        unsigned long first_low, first_mid, first_high;
@@ -560,13 +558,11 @@ static struct miscdevice rtc_miscdevice = {
        .fops   = &rtc_fops,
 };
 
-static int rtc_probe(struct device *dev)
+static int rtc_probe(struct platform_device *pdev)
 {
-       struct platform_device *pdev;
        unsigned int irq;
        int retval;
 
-       pdev = to_platform_device(dev);
        if (pdev->num_resources != 2)
                return -EBUSY;
 
@@ -635,7 +631,7 @@ static int rtc_probe(struct device *dev)
        return 0;
 }
 
-static int rtc_remove(struct device *dev)
+static int rtc_remove(struct platform_device *dev)
 {
        int retval;
 
@@ -655,11 +651,12 @@ static int rtc_remove(struct device *dev)
 
 static struct platform_device *rtc_platform_device;
 
-static struct device_driver rtc_device_driver = {
-       .name           = rtc_name,
-       .bus            = &platform_bus_type,
+static struct platform_driver rtc_device_driver = {
        .probe          = rtc_probe,
        .remove         = rtc_remove,
+       .driver         = {
+               .name   = rtc_name,
+       },
 };
 
 static int __devinit vr41xx_rtc_init(void)
@@ -687,11 +684,12 @@ static int __devinit vr41xx_rtc_init(void)
                break;
        }
 
-       rtc_platform_device = platform_device_register_simple("RTC", -1, rtc_resource, RTC_NUM_RESOURCES);
+       rtc_platform_device = platform_device_register_simple("RTC", -1,
+                             rtc_resource, ARRAY_SIZE(rtc_resource));
        if (IS_ERR(rtc_platform_device))
                return PTR_ERR(rtc_platform_device);
 
-       retval = driver_register(&rtc_device_driver);
+       retval = platform_driver_register(&rtc_device_driver);
        if (retval < 0)
                platform_device_unregister(rtc_platform_device);
 
@@ -700,7 +698,7 @@ static int __devinit vr41xx_rtc_init(void)
 
 static void __devexit vr41xx_rtc_exit(void)
 {
-       driver_unregister(&rtc_device_driver);
+       platform_driver_unregister(&rtc_device_driver);
 
        platform_device_unregister(rtc_platform_device);
 }