From d17ab340b754c88038c28152c933562531e4b594 Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Tue, 18 Dec 2007 01:40:03 +0200 Subject: [PATCH] I2C: TWL4030: Avoid declaring 1-use-only variables 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 Signed-off-by: Tony Lindgren --- drivers/i2c/chips/twl4030_core.c | 9 ++------- drivers/i2c/chips/twl4030_gpio.c | 10 ++-------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/i2c/chips/twl4030_core.c b/drivers/i2c/chips/twl4030_core.c index 63ea7b5d2db..e7331956120 100644 --- a/drivers/i2c/chips/twl4030_core.c +++ b/drivers/i2c/chips/twl4030_core.c @@ -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 */ diff --git a/drivers/i2c/chips/twl4030_gpio.c b/drivers/i2c/chips/twl4030_gpio.c index b6b91021e46..9054cc9e3da 100644 --- a/drivers/i2c/chips/twl4030_gpio.c +++ b/drivers/i2c/chips/twl4030_gpio.c @@ -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; } /* -- 2.41.1