[U-Boot] [PATCH] Davinci I2C code cleanup

Wolfgang Denk wd at denx.de
Sun Feb 22 23:06:29 CET 2009


Dear ksi at koi8.net,

In message <Pine.LNX.4.64ksi.0902221346290.5031 at home-gw.koi8.net> you wrote:
>
> > I suggest that "tmp" gets passed as argument to the macro.
> 
> It is _NOT_ a macro working on some variable. It is simply repeating

Oh yes, of course it is. It references the variable "tmp", and this is
nasty as it is not clear to the reader of the code.

If I think it would be better to rename "tmp" into "foo" the code will
magically break.

> _LITERAL_ text that not only accesses a local variable tmp but even
> performs a function return with an error if condition is not met. That is,

You are right. That's even worse.

> why, BTW, it should not be made into an inline function because it would
> require additional checking of its return code where it is used (lot of
> places in Davinci I2C driver) that, in turn, would've added a lot of
> unnecessary overhead for local variable, register loads, second conditional
> checking etc.

I am sure you could come up with an efficient *and* clean solution - if
you really wanted to try.

> It is _NOT_ supposed to be any function-like macro. It is just a fragment of
> _LITERAL_ text.

The code as is is not acceptable and needs to be cleaned up.

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
Heavier than air flying machines are impossible.
                    -- Lord Kelvin, President, Royal Society, c. 1895


More information about the U-Boot mailing list