]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/rtc/rtc-m48t59.c
rtc: fix platform driver hotplug/coldplug
[linux-2.6-omap-h63xx.git] / drivers / rtc / rtc-m48t59.c
index 33b752350ab5c91b708eda96cbff4df7b5d53f2c..013e6c103b9c465f1cc66eabe1d3011e697b5704 100644 (file)
@@ -35,7 +35,7 @@
 struct m48t59_private {
        void __iomem *ioaddr;
        unsigned int size; /* iomem size */
-       unsigned int irq;
+       int irq;
        struct rtc_device *rtc;
        spinlock_t lock; /* serialize the NVRAM and RTC access */
 };
@@ -353,11 +353,12 @@ static ssize_t m48t59_nvram_write(struct kobject *kobj,
 static struct bin_attribute m48t59_nvram_attr = {
        .attr = {
                .name = "nvram",
-               .mode = S_IRUGO | S_IWUGO,
+               .mode = S_IRUGO | S_IWUSR,
                .owner = THIS_MODULE,
        },
        .read = m48t59_nvram_read,
        .write = m48t59_nvram_write,
+       .size = M48T59_NVRAM_SIZE,
 };
 
 static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
@@ -464,7 +465,10 @@ static int __devexit m48t59_rtc_remove(struct platform_device *pdev)
        return 0;
 }
 
-static struct platform_driver m48t59_rtc_platdrv = {
+/* work with hotplug and coldplug */
+MODULE_ALIAS("platform:rtc-m48t59");
+
+static struct platform_driver m48t59_rtc_driver = {
        .driver         = {
                .name   = "rtc-m48t59",
                .owner  = THIS_MODULE,
@@ -475,12 +479,12 @@ static struct platform_driver m48t59_rtc_platdrv = {
 
 static int __init m48t59_rtc_init(void)
 {
-       return platform_driver_register(&m48t59_rtc_platdrv);
+       return platform_driver_register(&m48t59_rtc_driver);
 }
 
 static void __exit m48t59_rtc_exit(void)
 {
-       platform_driver_unregister(&m48t59_rtc_platdrv);
+       platform_driver_unregister(&m48t59_rtc_driver);
 }
 
 module_init(m48t59_rtc_init);