]> Pileus Git - ~andy/linux/blobdiff - drivers/rtc/rtc-wm831x.c
Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6
[~andy/linux] / drivers / rtc / rtc-wm831x.c
index dabbd456dfe11b56ab5c1c0dfe0045471e7dc0b9..3b6e6a67e765b34e7efd7e5cb82eea63a930d31e 100644 (file)
@@ -399,7 +399,7 @@ static int wm831x_rtc_probe(struct platform_device *pdev)
        int alm_irq = platform_get_irq_byname(pdev, "ALM");
        int ret = 0;
 
-       wm831x_rtc = kzalloc(sizeof(*wm831x_rtc), GFP_KERNEL);
+       wm831x_rtc = devm_kzalloc(&pdev->dev, sizeof(*wm831x_rtc), GFP_KERNEL);
        if (wm831x_rtc == NULL)
                return -ENOMEM;
 
@@ -434,7 +434,6 @@ static int wm831x_rtc_probe(struct platform_device *pdev)
        return 0;
 
 err:
-       kfree(wm831x_rtc);
        return ret;
 }
 
@@ -445,7 +444,6 @@ static int __devexit wm831x_rtc_remove(struct platform_device *pdev)
 
        free_irq(alm_irq, wm831x_rtc);
        rtc_device_unregister(wm831x_rtc->rtc);
-       kfree(wm831x_rtc);
 
        return 0;
 }
@@ -470,17 +468,7 @@ static struct platform_driver wm831x_rtc_driver = {
        },
 };
 
-static int __init wm831x_rtc_init(void)
-{
-       return platform_driver_register(&wm831x_rtc_driver);
-}
-module_init(wm831x_rtc_init);
-
-static void __exit wm831x_rtc_exit(void)
-{
-       platform_driver_unregister(&wm831x_rtc_driver);
-}
-module_exit(wm831x_rtc_exit);
+module_platform_driver(wm831x_rtc_driver);
 
 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
 MODULE_DESCRIPTION("RTC driver for the WM831x series PMICs");