/*
  * drivers/rtc/rtc-twl4030.c
- * 
+ *
  * TWL4030 Real Time Clock interface
- * 
+ *
  * Copyright (C) 2007 MontaVista Software, Inc
  * Author: Alexandre Rusev <source@mvista.com>
  *
  * Based on original TI driver twl4030-rtc.c
  *   Copyright (C) 2006 Texas Instruments, Inc.
- * 
+ *
  * Based on rtc-omap.c
  *   Copyright (C) 2003 MontaVista Software, Inc.
  *   Author: George G. Davis <gdavis@mvista.com> or <source@mvista.com>
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
- * 
+ *
  */
 
 #include <linux/kernel.h>
 #include <linux/device.h>
 #include <linux/i2c/twl4030.h>
 #include <linux/i2c/twl4030-rtc.h>
+#include <linux/io.h>
+#include <linux/irq.h>
 
-#include <asm/io.h>
 #include <asm/mach/time.h>
 #include <asm/system.h>
 #include <asm/hardware.h>
-#include <asm/irq.h>
 
 #define ALL_TIME_REGS          6
 
  */
 static int epoch = 1900;       /* year corresponding to 0x00   */
 
-/* 
- * Supports 1 byte read from TWL4030 RTC register. 
+/*
+ * Supports 1 byte read from TWL4030 RTC register.
  */
-static int twl4030_rtc_read_u8(u8 * data, u8 reg)
+static int twl4030_rtc_read_u8(u8 *data, u8 reg)
 {
        int ret;
 
        return ret;
 }
 
-/* 
+/*
  * Supports 1 byte write to TWL4030 RTC registers.
  */
 static int twl4030_rtc_write_u8(u8 data, u8 reg)
 
        ret = twl4030_i2c_write_u8(TWL4030_MODULE_RTC, data, reg);
        if (ret < 0) {
-               printk(KERN_WARNING "twl4030_rtc: Could not write TWL4030" 
+               printk(KERN_WARNING "twl4030_rtc: Could not write TWL4030"
                       "register %X - returned %d[%x]\n", reg, ret, ret);
        }
        return ret;
 }
 
-/* 
+/*
  * Enables timer or alarm interrupts.
  */
 static int set_rtc_irq_bit(unsigned char bit)
 }
 
 #ifdef CONFIG_PM
-/* 
+/*
  * Read timer or alarm interrupts register.
  */
 static int get_rtc_irq_bit(unsigned char *val)
        return ret;
 }
 #endif
-/* 
+/*
  * Disables timer or alarm interrupts.
  */
 static int mask_rtc_irq_bit(unsigned char bit)
        ret = twl4030_rtc_read_u8(&val, REG_RTC_INTERRUPTS_REG);
        if (ret < 0)
                goto mask_irq_out;
-       
+
        val &= ~bit;
        ret = twl4030_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG);
 
        int ret;
 
        /* Allow ints for RTC ALARM updates.  */
-       if (enabled) 
+       if (enabled)
                ret = set_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
-       else 
+       else
                ret = mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
 
        return ret;
 }
 
-/* 
+/*
  * Gets current TWL4030 RTC time and date parameters.
  */
 static int get_rtc_time(struct rtc_time *rtc_tm)
 
        ret = twl4030_rtc_read_u8(&save_control, REG_RTC_CTRL_REG);
        if (ret < 0)
-               return ret;
+               return ret;
 
        save_control |= BIT_RTC_CTRL_REG_GET_TIME_M;
 
         * Account for differences between how the RTC uses the values
         * and how they are defined in a struct rtc_time;
         */
-       if ((rtc_tm->tm_year += (epoch - 1900)) <= 69)
+       rtc_tm->tm_year += (epoch - 1900);
+       if (rtc_tm->tm_year <= 69)
                rtc_tm->tm_year += 100;
 
        rtc_tm->tm_mon--;
 
        /* update all the alarm registers in one shot */
        ret = twl4030_i2c_write(TWL4030_MODULE_RTC, rtc_data,
-                               REG_SECONDS_REG, ALL_TIME_REGS);
+                       REG_SECONDS_REG, ALL_TIME_REGS);
        if (ret < 0) {
                printk(KERN_ERR "twl4030: twl4030_i2c_write error.\n");
                goto out;
        return ret;
 }
 
-/* 
+/*
  * Gets current TWL4030 RTC alarm time.
  */
 static int get_rtc_alm_time(struct rtc_time *alm_tm)
         * Account for differences between how the RTC uses the values
         * and how they are defined in a struct rtc_time;
         */
-       if ((alm_tm->tm_year += (epoch - 1900)) <= 69)
+       alm_tm->tm_year += (epoch - 1900);
+       if (alm_tm->tm_year <= 69)
                alm_tm->tm_year += 100;
 
        alm_tm->tm_mon--;
        return ret;
 }
 
-/* 
+/*
  * Gets current TWL4030 RTC alarm time.
  */
 static int twl4030_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
        int ret;
 
        /* Allow ints for RTC updates.  */
-       if (enabled) 
+       if (enabled)
                ret = set_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
-       else 
+       else
                ret = mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
-       
+
        return ret;
 }
 
 
        /* update all the alarm registers in one shot */
        ret = twl4030_i2c_write(TWL4030_MODULE_RTC, alarm_data,
-                               REG_ALARM_SECONDS_REG, ALL_TIME_REGS);
+                       REG_ALARM_SECONDS_REG, ALL_TIME_REGS);
        if (ret) {
                printk(KERN_ERR "twl4030: twl4030_i2c_write error.\n");
                goto out;
 
        case RTC_EPOCH_READ:
                return put_user(epoch, (unsigned long *)arg);
-       case RTC_EPOCH_SET:     
+       case RTC_EPOCH_SET:
                /*
                 * There were no RTC clocks before 1900.
                 */
        int ret = IRQ_NONE;
        int res;
        u8 rd_reg;
-       
+
        res = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
        if (res)
                goto out;
        if (res)
                goto out;
        /*
-        * Workaround for strange behaviour with T2. Need to write into ISR 
+        * Workaround for strange behaviour with T2. Need to write into ISR
         * register one more time to clear the interrupt. Otherwise, the same
         * RTC event generates 2 interrupts in a row.
         * (no errata document available)
         */
-       res = twl4030_i2c_write_u8(TWL4030_MODULE_INT, PWR_RTC_INT_CLR, REG_PWR_ISR1);
+       res = twl4030_i2c_write_u8(TWL4030_MODULE_INT,
+                       PWR_RTC_INT_CLR, REG_PWR_ISR1);
        if (res)
                goto out;
 
        struct rtc_device *rtc;
        int ret = 0;
        u8 rd_reg;
-       
+
        if (pdata != NULL && pdata->init != NULL) {
                ret = pdata->init();
                if (ret < 0)
        if (ret < 0) {
                dev_err(&pdev->dev, "IRQ is not free.\n");
                goto out1;
-       } 
+       }
 
        /* Check RTC module status, Enable if it is off */
        ret = twl4030_rtc_read_u8(&rd_reg, REG_RTC_CTRL_REG);
                goto out2;
 
        /* Rising edge detection enabled, needed for RTC alarm */
-       rd_reg |= 0x80;         
+       rd_reg |= 0x80;
        ret = twl4030_i2c_write_u8(TWL4030_MODULE_INT, rd_reg, REG_PWR_EDR1);
        if (ret < 0)
                goto out2;
 
        free_irq(TWL4030_MODIRQ_PWR, rtc);
 
-       if (pdata != NULL && pdata->exit != NULL) 
+       if (pdata != NULL && pdata->exit != NULL)
                pdata->exit();
 
        rtc_device_unregister(rtc);
 
 #ifdef CONFIG_PM
 
-static unsigned char irqstat = 0;
+static unsigned char irqstat;
 
 static int twl4030_rtc_suspend(struct platform_device *pdev, pm_message_t state)
 {