]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
I2C: TWL4030: Avoid declaring 1-use-only variables
authorFelipe Balbi <felipe.lima@indt.org.br>
Mon, 17 Dec 2007 23:40:03 +0000 (01:40 +0200)
committerTony Lindgren <tony@atomide.com>
Tue, 18 Dec 2007 01:03:38 +0000 (17:03 -0800)
Avoids declaring local variables used only once in
the function. This preserve a register allocation thus
avoiding extra MOVs from happening.

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/i2c/chips/twl4030_core.c
drivers/i2c/chips/twl4030_gpio.c

index 63ea7b5d2dbaeddc6c26830d9fcd4abf7d147da5..e7331956120b9ed142c3f4686c6f58d5d5512837 100644 (file)
@@ -356,14 +356,12 @@ int twl4030_i2c_read(u8 mod_no, u8 * value, u8 reg, u8 num_bytes)
  */
 int twl4030_i2c_write_u8(u8 mod_no, u8 value, u8 reg)
 {
-       int ret;
 
        /* 2 bytes offset 1 contains the data offset 0 is used by i2c_write */
        u8 temp_buffer[2] = { 0 };
        /* offset 1 contains the data */
        temp_buffer[1] = value;
-       ret = twl4030_i2c_write(mod_no, temp_buffer, reg, 1);
-       return ret;
+       return twl4030_i2c_write(mod_no, temp_buffer, reg, 1);
 }
 
 /**
@@ -377,10 +375,7 @@ int twl4030_i2c_write_u8(u8 mod_no, u8 value, u8 reg)
  */
 int twl4030_i2c_read_u8(u8 mod_no, u8 * value, u8 reg)
 {
-       int ret = 0;
-
-       ret = twl4030_i2c_read(mod_no, value, reg, 1);
-       return ret;
+       return twl4030_i2c_read(mod_no, value, reg, 1);
 }
 
 /* Helper Functions */
index b6b91021e46cdf8de99e6a15925c3f0199112a22..9054cc9e3da41ee0e02c9bb342546afa01d00639 100644 (file)
@@ -214,8 +214,6 @@ static int gpio_read_isr(unsigned int *isr)
 
 static int gpio_write_isr(unsigned int isr)
 {
-       int ret;
-
        isr &= GPIO_32_MASK;
        /*
         * The buffer passed to the twl4030_i2c_write() routine must have an
@@ -223,15 +221,12 @@ static int gpio_write_isr(unsigned int isr)
         */
        isr <<= 8;
        isr = cpu_to_le32(isr);
-       ret = twl4030_i2c_write(TWL4030_MODULE_GPIO, (u8 *) &isr,
+       return twl4030_i2c_write(TWL4030_MODULE_GPIO, (u8 *) &isr,
                                REG_GPIO_ISR1A, 3);
-       return ret;
 }
 
 static int gpio_write_imr(unsigned int imr)
 {
-       int ret;
-
        imr &= GPIO_32_MASK;
        /*
         * The buffer passed to the twl4030_i2c_write() routine must have an
@@ -239,9 +234,8 @@ static int gpio_write_imr(unsigned int imr)
         */
        imr <<= 8;
        imr = cpu_to_le32(imr);
-       ret = twl4030_i2c_write(TWL4030_MODULE_GPIO, (u8 *) &imr,
+       return twl4030_i2c_write(TWL4030_MODULE_GPIO, (u8 *) &imr,
                                REG_GPIO_IMR1A, 3);
-       return ret;
 }
 
 /*