[PATCH] I2C: TWL4030: Avoid declaring 1-use-only variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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 8c2227b..9c1c037 100644
--- a/drivers/i2c/chips/twl4030_core.c
+++ b/drivers/i2c/chips/twl4030_core.c
@@ -357,14 +357,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);
 }
 
 /**
@@ -378,10 +376,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 b6b9102..9054cc9 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;
 }
 
 /*
-- 
1.5.4.rc0.56.g6fbe

-
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux