From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Mon, 7 Dec 2015 06:25:34 +0100 Subject: [U-Boot] [PATCH 1/2] i2c: cmd: Relocate subcommands when MANUAL_RELOC In-Reply-To: References: Message-ID: <5665184E.2080903@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > --- > > common/cmd_i2c.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) Acked-by: Heiko Schocher 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