On Thu, 19 Feb 2009 17:24:09 +0100 Heiko Schocher <h...@denx.de> wrote:
> @@ -369,6 +370,23 @@ i2c_probe(uchar chip) > > int i2c_set_bus_num(unsigned int bus) > { > +#if defined(CONFIG_I2C_MUX) > + if (bus < CONFIG_SYS_MAX_I2C_BUS) { > + i2c_bus_num = bus; > + } else { [1] > + int ret; > + > + ret = i2x_mux_select_mux(bus); > + if (ret == 0) { > + /* with CONFIG_I2C_MUX only I2C Controller 1 > + * is usable > + */ > + i2c_bus_num = 0; > + i2c_bus_num_mux = bus; > + } else > + return ret; > + } how about ret = i2x_... if (ret) return ret; /* with... > +#else > #ifdef CONFIG_SYS_I2C2_OFFSET > if (bus > 1) { > #else > @@ -378,7 +396,7 @@ int i2c_set_bus_num(unsigned int bus) > } > > i2c_bus_num = bus; > - > +#endif reuse code and moved the ifdef up, then [1] would just be: if (bus >= CONFIG_SYS_MAX_I2C_BUS) { > return 0; > } > > @@ -396,7 +414,11 @@ int i2c_set_bus_speed(unsigned int speed) > > unsigned int i2c_get_bus_num(void) > { > +#if defined(CONFIG_I2C_MUX) > + return i2c_bus_num_mux; > +#else > return i2c_bus_num; > +#endif > } I don't get this mux variant - why aren't we reusing i2c_bus_num in the mux case? Kim _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot