public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/7] i2c: Use __weak instead of __attribute__((weak, alias))
@ 2012-11-13  0:34 Marek Vasut
  2012-11-13  0:34 ` [U-Boot] [PATCH 2/7] i2c: Staticize local functions in mxc i2c driver Marek Vasut
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Marek Vasut @ 2012-11-13  0:34 UTC (permalink / raw)
  To: u-boot

Use __weak from linux/compiler.h instead of __attribute__((weak, alias))
to define overridable function. This patch is intended as a cleanup patch
to bring some consistency into the code.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Heiko Schocher <hs@denx.de>
---
 common/cmd_i2c.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 4438db5..c8990ef 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -82,6 +82,7 @@
 #include <i2c.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
+#include <linux/compiler.h>
 
 /* Display values from last command.
  * Memory modify remembered values are different from display memory.
@@ -133,30 +134,27 @@ DECLARE_GLOBAL_DATA_PTR;
 #define DISP_LINE_LEN	16
 
 /* implement possible board specific board init */
-static void __def_i2c_init_board(void)
+__weak
+void i2c_init_board(void)
 {
 	return;
 }
-void i2c_init_board(void)
-	__attribute__((weak, alias("__def_i2c_init_board")));
 
 /* TODO: Implement architecture-specific get/set functions */
-static unsigned int __def_i2c_get_bus_speed(void)
+__weak
+unsigned int i2c_get_bus_speed(void)
 {
 	return CONFIG_SYS_I2C_SPEED;
 }
-unsigned int i2c_get_bus_speed(void)
-	__attribute__((weak, alias("__def_i2c_get_bus_speed")));
 
-static int __def_i2c_set_bus_speed(unsigned int speed)
+__weak
+int i2c_set_bus_speed(unsigned int speed)
 {
 	if (speed != CONFIG_SYS_I2C_SPEED)
 		return -1;
 
 	return 0;
 }
-int i2c_set_bus_speed(unsigned int)
-	__attribute__((weak, alias("__def_i2c_set_bus_speed")));
 
 /*
  * get_alen: small parser helper function to get address length
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-11-13 13:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-13  0:34 [U-Boot] [PATCH 1/7] i2c: Use __weak instead of __attribute__((weak, alias)) Marek Vasut
2012-11-13  0:34 ` [U-Boot] [PATCH 2/7] i2c: Staticize local functions in mxc i2c driver Marek Vasut
2012-11-13  0:34 ` [U-Boot] [PATCH 3/7] i2c: kerneldoc: Add kerneldoc annotations to cmd_i2c.c Marek Vasut
2012-11-13  0:34 ` [U-Boot] [PATCH 4/7] i2c: mxs: Abstract out the MXS I2C speed setup Marek Vasut
2012-11-13  8:29   ` Wolfgang Denk
2012-11-13 13:45     ` Marek Vasut
2012-11-13  0:34 ` [U-Boot] [PATCH 5/7] i2c: mxs: Implement i2c_get/set_bus_speed() Marek Vasut
2012-11-13  0:34 ` [U-Boot] [PATCH 6/7] i2c: mxs: Use i2c_set_bus_speed() in i2c_init() Marek Vasut
2012-11-13  0:34 ` [U-Boot] [PATCH 7/7] i2c: mxs: Fix TIMING2 register value Marek Vasut
2012-11-13  7:16 ` [U-Boot] [PATCH 1/7] i2c: Use __weak instead of __attribute__((weak, alias)) Wolfgang Denk
2012-11-13 13:48   ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox