[U-Boot] PATCH 2/8 Multi-adapter multi-bus I2C

Wolfgang Denk wd at denx.de
Tue Feb 10 00:59:54 CET 2009


Dear ksi at koi8.net,

In message <Pine.LNX.4.64ksi.0902091353360.32084 at home-gw.koi8.net> you wrote:
>
> > Why do you here substitute a "dev->" with "&i2c_dev[adap_no]"?
> > Why not dev =  &i2c_dev[adap_no] and you can let the dev-> unchanged.
> 
> This eliminates one variable, dev. Another reason is uniformity through the
> entire driver source.

But it makes the code harder to read.

Maybe we should rather change the other places in the driver to do the
same?

Note that it is NOT a goal for optimizations to save variables -
variables are extremely cheap, as they are just ameans to make the
code readable. The compiler will know much better than we how to
allocate memory or registers to hold such data.

> Anyway, keeping that dev won't make any difference other than making the
> patch a tad shorter...

... and the code better readable.

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
Writing a book is like washing an elephant: there's no good place  to
begin  or  end,  and  it's  hard to keep track of what you've already
covered.


More information about the U-Boot mailing list