* [U-Boot] [PATCH 1/2] i2c: cmd: Relocate subcommands when MANUAL_RELOC
@ 2015-12-04 16:05 Michal Simek
2015-12-04 16:05 ` [U-Boot] [PATCH 2/2] dm: " Michal Simek
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Michal Simek @ 2015-12-04 16:05 UTC (permalink / raw)
To: u-boot
Subcommands contain pointers to functions which are not updated when
MANUAL_REALOC is enabled. This patch fix it.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
common/cmd_i2c.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 3d0de81c32f8..552c875f62dd 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -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;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 2/2] dm: cmd: Relocate subcommands when MANUAL_RELOC
2015-12-04 16:05 [U-Boot] [PATCH 1/2] i2c: cmd: Relocate subcommands when MANUAL_RELOC Michal Simek
@ 2015-12-04 16:05 ` Michal Simek
2015-12-06 16:44 ` Simon Glass
2015-12-06 16:44 ` [U-Boot] [PATCH 1/2] i2c: " Simon Glass
2015-12-07 5:25 ` Heiko Schocher
2 siblings, 1 reply; 5+ messages in thread
From: Michal Simek @ 2015-12-04 16:05 UTC (permalink / raw)
To: u-boot
Subcommands contain pointers to functions which are not updated when
MANUAL_REALOC is enabled. This patch fix it.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
test/dm/cmd_dm.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/test/dm/cmd_dm.c b/test/dm/cmd_dm.c
index caff49aa4f62..b6e71091497c 100644
--- a/test/dm/cmd_dm.c
+++ b/test/dm/cmd_dm.c
@@ -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,
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 1/2] i2c: cmd: Relocate subcommands when MANUAL_RELOC
2015-12-04 16:05 [U-Boot] [PATCH 1/2] i2c: cmd: Relocate subcommands when MANUAL_RELOC Michal Simek
2015-12-04 16:05 ` [U-Boot] [PATCH 2/2] dm: " Michal Simek
@ 2015-12-06 16:44 ` Simon Glass
2015-12-07 5:25 ` Heiko Schocher
2 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2015-12-06 16:44 UTC (permalink / raw)
To: u-boot
On 4 December 2015 at 09:05, Michal Simek <michal.simek@xilinx.com> wrote:
> Subcommands contain pointers to functions which are not updated when
> MANUAL_REALOC is enabled. This patch fix it.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> common/cmd_i2c.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 2/2] dm: cmd: Relocate subcommands when MANUAL_RELOC
2015-12-04 16:05 ` [U-Boot] [PATCH 2/2] dm: " Michal Simek
@ 2015-12-06 16:44 ` Simon Glass
0 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2015-12-06 16:44 UTC (permalink / raw)
To: u-boot
On 4 December 2015 at 09:05, Michal Simek <michal.simek@xilinx.com> wrote:
> Subcommands contain pointers to functions which are not updated when
> MANUAL_REALOC is enabled. This patch fix it.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> test/dm/cmd_dm.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 1/2] i2c: cmd: Relocate subcommands when MANUAL_RELOC
2015-12-04 16:05 [U-Boot] [PATCH 1/2] i2c: cmd: Relocate subcommands when MANUAL_RELOC Michal Simek
2015-12-04 16:05 ` [U-Boot] [PATCH 2/2] dm: " Michal Simek
2015-12-06 16:44 ` [U-Boot] [PATCH 1/2] i2c: " Simon Glass
@ 2015-12-07 5:25 ` Heiko Schocher
2 siblings, 0 replies; 5+ messages in thread
From: Heiko Schocher @ 2015-12-07 5:25 UTC (permalink / raw)
To: u-boot
Hello Michal,
Am 04.12.2015 um 17:05 schrieb Michal Simek:
> Subcommands contain pointers to functions which are not updated when
> MANUAL_REALOC is enabled. This patch fix it.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> common/cmd_i2c.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
Acked-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
>
> diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
> index 3d0de81c32f8..552c875f62dd 100644
> --- a/common/cmd_i2c.c
> +++ b/common/cmd_i2c.c
> @@ -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;
>
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-07 5:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-04 16:05 [U-Boot] [PATCH 1/2] i2c: cmd: Relocate subcommands when MANUAL_RELOC Michal Simek
2015-12-04 16:05 ` [U-Boot] [PATCH 2/2] dm: " Michal Simek
2015-12-06 16:44 ` Simon Glass
2015-12-06 16:44 ` [U-Boot] [PATCH 1/2] i2c: " Simon Glass
2015-12-07 5:25 ` Heiko Schocher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.