Commit d17ab340 authored by Felipe Balbi's avatar Felipe Balbi Committed by Tony Lindgren

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: default avatarFelipe Balbi <felipe.lima@indt.org.br>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 587251e9
......@@ -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 */
......
......@@ -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;
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment