[U-Boot] [PATCH V2 6/9] twl6035: make twl6030_i2c_[read|write]_u8 static inline

Nishanth Menon nm at ti.com
Fri Mar 22 22:33:21 CET 2013


twl6030_i2c_[read|write]_u8 can be used else where to access
multi-function device such as twl6035, we dont need to incurr
an function call overhead, so use static inline.

Signed-off-by: Nishanth Menon <nm at ti.com>
---
 drivers/power/twl6035.c |   11 -----------
 include/twl6035.h       |   13 +++++++++++--
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/power/twl6035.c b/drivers/power/twl6035.c
index d3de698..0c2cdfe 100644
--- a/drivers/power/twl6035.c
+++ b/drivers/power/twl6035.c
@@ -23,17 +23,6 @@
 #include <config.h>
 #include <twl6035.h>
 
-/* Functions to read and write from TWL6030 */
-int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg)
-{
-	return i2c_write(chip_no, reg, 1, &val, 1);
-}
-
-int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg)
-{
-	return i2c_read(chip_no, reg, 1, val, 1);
-}
-
 /* To align with i2c mw/mr address, reg, val command syntax */
 static inline int palmas_write_u8(u8 chip_no, u8 reg, u8 val)
 {
diff --git a/include/twl6035.h b/include/twl6035.h
index ce74348..89c2ab5 100644
--- a/include/twl6035.h
+++ b/include/twl6035.h
@@ -36,7 +36,16 @@
 #define LDO_MODE_SLEEP		(1 << 2)
 #define LDO_MODE_ACTIVE		(1 << 0)
 
-int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg);
-int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg);
+/* Functions to read and write from TWL6030 */
+static inline int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg)
+{
+	return i2c_write(chip_no, reg, 1, &val, 1);
+}
+
+static inline int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg)
+{
+	return i2c_read(chip_no, reg, 1, val, 1);
+}
+
 void twl6035_init_settings(void);
 int twl6035_mmc1_poweron_ldo(void);
-- 
1.7.9.5



More information about the U-Boot mailing list