[U-Boot] [PATCH] 1/12 Multiadapter/multibus I2C, common part 1
Wolfgang Denk
wd at denx.de
Mon Feb 16 22:34:52 CET 2009
Dear ksi at koi8.net,
In message <Pine.LNX.4.64ksi.0902121409460.21067 at home-gw.koi8.net> you wrote:
> Signed-off-by: Sergey Kubushyn <ksi at koi8.net>
> ---
> diff -purN u-boot-i2c.orig/common/cmd_date.c u-boot-i2c/common/cmd_date.c
> --- u-boot-i2c.orig/common/cmd_date.c 2009-02-12 10:43:41.000000000 -0800
> +++ u-boot-i2c/common/cmd_date.c 2009-02-12 10:46:00.000000000 -0800
> @@ -46,8 +46,13 @@ int do_date (cmd_tbl_t *cmdtp, int flag,
> int old_bus;
>
> /* switch to correct I2C bus */
> +#ifdef CONFIG_NEW_I2C
> + old_bus = i2c_get_bus_num();
> + i2c_set_bus_num(CONFIG_SYS_RTC_BUS_NUM);
> +#else
> old_bus = I2C_GET_BUS();
> I2C_SET_BUS(CONFIG_SYS_RTC_BUS_NUM);
> +#endif
>
> switch (argc) {
> case 2: /* set date & time */
> @@ -94,7 +99,11 @@ int do_date (cmd_tbl_t *cmdtp, int flag,
> }
>
> /* switch back to original I2C bus */
> +#ifdef CONFIG_NEW_I2C
> + i2c_set_bus_num(old_bus);
> +#else
> I2C_SET_BUS(old_bus);
> +#endif
Just a global note:
This makes no sense to me. If we assume that the new code works, then
it will replace the old code. These #ifdef's make no sense.
We will probably hold this code in some testing branch (for a longer
period of time to allow for extensive testing), but I don;t see the
need to support both the old and the new code at the same time. This
makes the code and your patches only more difficult to read.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The manager will be continually amazed that policies he took for com-
mon knowledge are totally unknown by some member of his team. Since
his fundamental job is to keep everybody going in the same direction,
his chief daily task will be communication, not decision-making.
- Fred Brooks, "The Mythical Man Month"
More information about the U-Boot
mailing list