Skip to contentSkip to conversation

common: env_mmc: Use __weak annotation to simplify code

PATCH In review Fabio Estevam 4 participants 4 messages Jan 8, 2013 – Feb 4, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: env_mmc: Use __weak annotation to simplify code

Using the __weak annotation can make the code cleaner.

---
 common/env_mmc.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
common/env_mmc.c +1 -3
index ce21671..02bd5ae 100644
@@ -46,13 +46,11 @@ DECLARE_GLOBAL_DATA_PTR;
 #define CONFIG_ENV_OFFSET 0
 #endif
 
-static int __mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
+__weak int mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
 {
 	*env_addr = CONFIG_ENV_OFFSET;
 	return 0;
 }
-int mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
-	__attribute__((weak, alias("__mmc_get_env_addr")));
 
 int env_init(void)
 {
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 common: env_mmc: Use __weak annotation to simplify code

Dear Fabio Estevam,

Quoted 3 lines

Using the __weak annotation can make the code cleaner.

Just a quickie -- have you checked that noone is using the "default" versions of all these functions you annotate with __weak?

Other than that:

Quoted 13 lines
---
 common/env_mmc.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
common/env_mmc.c +0 -1
index ce21671..02bd5ae 100644
@@ -46,13 +46,11 @@ DECLARE_GLOBAL_DATA_PTR;
 #define CONFIG_ENV_OFFSET 0
 #endif
 
-static int __mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)

common/env_mmc.c DECLARE_GLOBAL_DATA_PTR; · line 56

Quoted 10 lines
common/env_mmc.c +1 -2
+__weak int mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
 {
 	*env_addr = CONFIG_ENV_OFFSET;
 	return 0;
 }
-int mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
-	__attribute__((weak, alias("__mmc_get_env_addr")));
 
 int env_init(void)
 {

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/1 common: env_mmc: Use __weak annotation to simplify code

In reply to Fabio Estevam
Quoted 4 lines · Fabio Estevam

Using the __weak annotation can make the code cleaner.

---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw
In reply to Fabio Estevam
Quoted 4 lines · Fabio Estevam

Using the __weak annotation can make the code cleaner.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130204/755bf57b/attachment.pgp>