]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/rtc/rtc-vt8500.c
drivers/rtc/rtc-vt8500.c: correct handling of CR_24H bitfield
[karo-tx-linux.git] / drivers / rtc / rtc-vt8500.c
index 07bf19364a74732baf2f34dfa3c1fdb984e8cb8a..737addff76631c3de65af8e241a789896a476ba3 100644 (file)
@@ -70,7 +70,7 @@
                                | ALARM_SEC_BIT)
 
 #define VT8500_RTC_CR_ENABLE   (1 << 0)        /* Enable RTC */
-#define VT8500_RTC_CR_24H      (1 << 1)        /* 24h time format */
+#define VT8500_RTC_CR_12H      (1 << 1)        /* 12h time format */
 #define VT8500_RTC_CR_SM_ENABLE        (1 << 2)        /* Enable periodic irqs */
 #define VT8500_RTC_CR_SM_SEC   (1 << 3)        /* 0: 1Hz/60, 1: 1Hz */
 #define VT8500_RTC_CR_CALIB    (1 << 4)        /* Enable calibration */
@@ -205,12 +205,13 @@ static const struct rtc_class_ops vt8500_rtc_ops = {
        .alarm_irq_enable = vt8500_alarm_irq_enable,
 };
 
-static int __devinit vt8500_rtc_probe(struct platform_device *pdev)
+static int vt8500_rtc_probe(struct platform_device *pdev)
 {
        struct vt8500_rtc *vt8500_rtc;
        int ret;
 
-       vt8500_rtc = kzalloc(sizeof(struct vt8500_rtc), GFP_KERNEL);
+       vt8500_rtc = devm_kzalloc(&pdev->dev,
+                          sizeof(struct vt8500_rtc), GFP_KERNEL);
        if (!vt8500_rtc)
                return -ENOMEM;
 
@@ -220,15 +221,13 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev)
        vt8500_rtc->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!vt8500_rtc->res) {
                dev_err(&pdev->dev, "No I/O memory resource defined\n");
-               ret = -ENXIO;
-               goto err_free;
+               return -ENXIO;
        }
 
        vt8500_rtc->irq_alarm = platform_get_irq(pdev, 0);
        if (vt8500_rtc->irq_alarm < 0) {
                dev_err(&pdev->dev, "No alarm IRQ resource defined\n");
-               ret = -ENXIO;
-               goto err_free;
+               return -ENXIO;
        }
 
        vt8500_rtc->res = request_mem_region(vt8500_rtc->res->start,
@@ -236,8 +235,7 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev)
                                             "vt8500-rtc");
        if (vt8500_rtc->res == NULL) {
                dev_err(&pdev->dev, "failed to request I/O memory\n");
-               ret = -EBUSY;
-               goto err_free;
+               return -EBUSY;
        }
 
        vt8500_rtc->regbase = ioremap(vt8500_rtc->res->start,
@@ -249,7 +247,7 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev)
        }
 
        /* Enable RTC and set it to 24-hour mode */
-       writel(VT8500_RTC_CR_ENABLE | VT8500_RTC_CR_24H,
+       writel(VT8500_RTC_CR_ENABLE,
               vt8500_rtc->regbase + VT8500_RTC_CR);
 
        vt8500_rtc->rtc = rtc_device_register("vt8500-rtc", &pdev->dev,
@@ -278,12 +276,10 @@ err_unmap:
 err_release:
        release_mem_region(vt8500_rtc->res->start,
                           resource_size(vt8500_rtc->res));
-err_free:
-       kfree(vt8500_rtc);
        return ret;
 }
 
-static int __devexit vt8500_rtc_remove(struct platform_device *pdev)
+static int vt8500_rtc_remove(struct platform_device *pdev)
 {
        struct vt8500_rtc *vt8500_rtc = platform_get_drvdata(pdev);
 
@@ -297,7 +293,6 @@ static int __devexit vt8500_rtc_remove(struct platform_device *pdev)
        release_mem_region(vt8500_rtc->res->start,
                           resource_size(vt8500_rtc->res));
 
-       kfree(vt8500_rtc);
        platform_set_drvdata(pdev, NULL);
 
        return 0;
@@ -310,7 +305,7 @@ static const struct of_device_id wmt_dt_ids[] = {
 
 static struct platform_driver vt8500_rtc_driver = {
        .probe          = vt8500_rtc_probe,
-       .remove         = __devexit_p(vt8500_rtc_remove),
+       .remove         = vt8500_rtc_remove,
        .driver         = {
                .name   = "vt8500-rtc",
                .owner  = THIS_MODULE,