i2c: cmd: Relocate subcommands when MANUAL_RELOC
PATCH 1/2 i2c: cmd: Relocate subcommands when MANUAL_RELOC
Subcommands contain pointers to functions which are not updated when MANUAL_REALOC is enabled. This patch fix it.
---
common/cmd_i2c.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
common/cmd_i2c.c +12 -4
@@ -1944,11 +1944,15 @@ static cmd_tbl_t cmd_i2c_sub[] = { U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""), }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -void i2c_reloc (void ) { -fixup_cmdtable (cmd_i2c_sub,ARRAY_SIZE (cmd_i2c_sub)); +static __maybe_unused void i2c_reloc (void ) +{ +static int relocated; + +if (!relocated) { +fixup_cmdtable (cmd_i2c_sub,ARRAY_SIZE (cmd_i2c_sub)); + relocated =1 ; + }; } -#endif /** * do_i2c() - Handle the "i2c" command-line command
@@ -1964,6 +1968,10 @@ static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) {cmd_tbl_t *c; +#ifdef CONFIG_NEEDS_MANUAL_RELOC +i2c_reloc (); +#endif +if (argc <2 )return CMD_RET_USAGE ;
Signature · 1 line
1.9.1
PATCH 2/2 dm: cmd: Relocate subcommands when MANUAL_RELOC
Subcommands contain pointers to functions which are not updated when MANUAL_REALOC is enabled. This patch fix it.
---
test/dm/cmd_dm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
test/dm/cmd_dm.c +14 -0
@@ -46,11 +46,25 @@ static cmd_tbl_t test_commands[] = { U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""), }; +static __maybe_unused void dm_reloc (void ) +{ +static int relocated; + +if (!relocated) { +fixup_cmdtable (test_commands,ARRAY_SIZE (test_commands)); + relocated =1 ; + } +} +static int do_dm (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) {cmd_tbl_t *test_cmd;int ret; +#ifdef CONFIG_NEEDS_MANUAL_RELOC +dm_reloc (); +#endif +if (argc <2 )return CMD_RET_USAGE ; test_cmd = find_cmd_tbl(argv[1], test_commands,
Signature · 1 line
1.9.1
PATCH 2/2 dm: cmd: Relocate subcommands when MANUAL_RELOC
Quoted 8 lines · Michal Simek
Subcommands contain pointers to functions which are not updated when
MANUAL_REALOCis enabled. This patch fix it.Signed-off-by Michal Simek <[email protected]>---
test/dm/cmd_dm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
PATCH 1/2 i2c: cmd: Relocate subcommands when MANUAL_RELOC
In reply to Michal SimekQuoted 8 lines · Michal Simek
Subcommands contain pointers to functions which are not updated when
MANUAL_REALOCis enabled. This patch fix it.Signed-off-by Michal Simek <[email protected]>---
common/cmd_i2c.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
PATCH 1/2 i2c: cmd: Relocate subcommands when MANUAL_RELOC
In reply to Michal SimekHello Michal,
Am 04.12.2015 um 17:05 schrieb Michal Simek:
Quoted 8 lines
Subcommands contain pointers to functions which are not updated when
MANUAL_REALOCis enabled. This patch fix it.Signed-off-by Michal Simek <[email protected]>---
common/cmd_i2c.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
bye,
Heiko
Quoted 37 lines
common/cmd_i2c.c +12
-4@@ -1944,11 +1944,15 @@ static cmd_tbl_t cmd_i2c_sub[] = { U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""), }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -void i2c_reloc (void ) { -fixup_cmdtable (cmd_i2c_sub,ARRAY_SIZE (cmd_i2c_sub)); +static __maybe_unused void i2c_reloc (void ) +{ +static int relocated; + +if (!relocated) { +fixup_cmdtable (cmd_i2c_sub,ARRAY_SIZE (cmd_i2c_sub)); + relocated =1 ; + }; } -#endif /** * do_i2c() - Handle the "i2c" command-line command @@ -1964,6 +1968,10 @@ static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) {cmd_tbl_t *c; +#ifdef CONFIG_NEEDS_MANUAL_RELOC +i2c_reloc (); +#endif +if (argc <2 )return CMD_RET_USAGE ;
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany