Pull battery into release branch
[firefly-linux-kernel-4.4.55.git] / arch / sh / drivers / heartbeat.c
index bc59cb6cd78b24a9799cb2ebd8ee60e6b32a5474..10c1828c9ff51b5fbd3cf5d104153ef77fb40afd 100644 (file)
@@ -40,16 +40,9 @@ static void heartbeat_timer(unsigned long data)
        static unsigned bit = 0, up = 1;
 
        ctrl_outw(1 << hd->bit_pos[bit], (unsigned long)hd->base);
-       if (up)
-               if (bit == (ARRAY_SIZE(hd->bit_pos) - 1)) {
-                       bit--;
-                       up = 0;
-               } else
-                       bit++;
-       else if (bit == 0)
-               up = 1;
-       else
-               bit--;
+       bit += up;
+       if ((bit == 0) || (bit == ARRAY_SIZE(hd->bit_pos)-1))
+               up = -up;
 
        mod_timer(&hd->timer, jiffies + (110 - ((300 << FSHIFT) /
                        ((avenrun[0] / 5) + (3 << FSHIFT)))));
@@ -85,7 +78,7 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
                        hd->bit_pos[i] = i;
        }
 
-       hd->base = (void __iomem *)res->start;
+       hd->base = (void __iomem *)(unsigned long)res->start;
 
        setup_timer(&hd->timer, heartbeat_timer, (unsigned long)hd);
        platform_set_drvdata(pdev, hd);