]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sparc64/kernel/time.c
sparc64: Add missing null terminating entry to bq4802_match[].
[linux-2.6-omap-h63xx.git] / arch / sparc64 / kernel / time.c
index 226a0042d870631dca3f670a5485bde01d692ce9..141da375909129dea0ab0fffc9d5359d85e9a039 100644 (file)
@@ -396,17 +396,20 @@ static unsigned long timer_ticks_per_nsec_quotient __read_mostly;
 int update_persistent_clock(struct timespec now)
 {
        struct rtc_device *rtc = rtc_class_open("rtc0");
+       int err = -1;
 
-       if (rtc)
-               return rtc_set_mmss(rtc, now.tv_sec);
+       if (rtc) {
+               err = rtc_set_mmss(rtc, now.tv_sec);
+               rtc_class_close(rtc);
+       }
 
-       return -1;
+       return err;
 }
 
 unsigned long cmos_regs;
 EXPORT_SYMBOL(cmos_regs);
 
-struct resource rtc_cmos_resource;
+static struct resource rtc_cmos_resource;
 
 static struct platform_device rtc_cmos_device = {
        .name           = "rtc_cmos",
@@ -487,6 +490,7 @@ static struct of_device_id __initdata bq4802_match[] = {
                .name = "rtc",
                .compatible = "bq4802",
        },
+       {},
 };
 
 static struct of_platform_driver bq4802_driver = {
@@ -500,39 +504,16 @@ static struct of_platform_driver bq4802_driver = {
 static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
 {
        struct platform_device *pdev = to_platform_device(dev);
-       struct m48t59_plat_data *pdata = pdev->dev.platform_data;
-       void __iomem *regs;
-       unsigned char val;
-
-       regs = (void __iomem *) pdev->resource[0].start;
-       val = readb(regs + ofs);
-
-       /* the year 0 is 1968 */
-       if (ofs == pdata->offset + M48T59_YEAR) {
-               val += 0x68;
-               if ((val & 0xf) > 9)
-                       val += 6;
-       }
-       return val;
+       void __iomem *regs = (void __iomem *) pdev->resource[0].start;
+
+       return readb(regs + ofs);
 }
 
 static void mostek_write_byte(struct device *dev, u32 ofs, u8 val)
 {
        struct platform_device *pdev = to_platform_device(dev);
-       struct m48t59_plat_data *pdata = pdev->dev.platform_data;
-       void __iomem *regs;
-
-       regs = (void __iomem *) pdev->resource[0].start;
-       if (ofs == pdata->offset + M48T59_YEAR) {
-               if (val < 0x68)
-                       val += 0x32;
-               else
-                       val -= 0x68;
-               if ((val & 0xf) > 9)
-                       val += 6;
-               if ((val & 0xf0) > 0x9A)
-                       val += 0x60;
-       }
+       void __iomem *regs = (void __iomem *) pdev->resource[0].start;
+
        writeb(val, regs + ofs);
 }
 
@@ -618,7 +599,7 @@ fs_initcall(clock_init);
 static unsigned long sparc64_init_timers(void)
 {
        struct device_node *dp;
-       unsigned long clock;
+       unsigned long freq;
 
        dp = of_find_node_by_path("/");
        if (tlb_type == spitfire) {
@@ -631,17 +612,17 @@ static unsigned long sparc64_init_timers(void)
                if (manuf == 0x17 && impl == 0x13) {
                        /* Hummingbird, aka Ultra-IIe */
                        tick_ops = &hbtick_operations;
-                       clock = of_getintprop_default(dp, "stick-frequency", 0);
+                       freq = of_getintprop_default(dp, "stick-frequency", 0);
                } else {
                        tick_ops = &tick_operations;
-                       clock = local_cpu_data().clock_tick;
+                       freq = local_cpu_data().clock_tick;
                }
        } else {
                tick_ops = &stick_operations;
-               clock = of_getintprop_default(dp, "stick-frequency", 0);
+               freq = of_getintprop_default(dp, "stick-frequency", 0);
        }
 
-       return clock;
+       return freq;
 }
 
 struct freq_table {
@@ -833,16 +814,16 @@ EXPORT_SYMBOL(udelay);
 
 void __init time_init(void)
 {
-       unsigned long clock = sparc64_init_timers();
+       unsigned long freq = sparc64_init_timers();
 
-       tb_ticks_per_usec = clock / USEC_PER_SEC;
+       tb_ticks_per_usec = freq / USEC_PER_SEC;
 
        timer_ticks_per_nsec_quotient =
-               clocksource_hz2mult(clock, SPARC64_NSEC_PER_CYC_SHIFT);
+               clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT);
 
        clocksource_tick.name = tick_ops->name;
        clocksource_tick.mult =
-               clocksource_hz2mult(clock,
+               clocksource_hz2mult(freq,
                                    clocksource_tick.shift);
        clocksource_tick.read = tick_ops->get_tick;
 
@@ -853,7 +834,7 @@ void __init time_init(void)
 
        sparc64_clockevent.name = tick_ops->name;
 
-       setup_clockevent_multiplier(clock);
+       setup_clockevent_multiplier(freq);
 
        sparc64_clockevent.max_delta_ns =
                clockevent_delta2ns(0x7fffffffffffffffUL, &sparc64_clockevent);