[U-Boot] [PATCH] i2c: merge all i2c_reg_read() and i2c_reg_write() into inline functions
Timur Tabi
timur at freescale.com
Sat Oct 4 01:25:09 CEST 2008
Wolfgang Denk wrote:
>> -void i2c_reg_write(uchar chip, uchar reg, uchar val)
>> -{
>> - PRINTD("i2c_reg_write: chip=0x%02x, reg=0x%02x, val=0x%02x\n", chip,
>> - reg, val);
>> - i2c_write(chip, reg, 0, &val, 1);
>> -}
>> -
>
> This does not exactly look identical to me.
The PRINTD is irrelevant. If these platforms really want to debug single I2C
operations, they can add the code back. It's just debug code, so I would think
that it's not worth sacrificing the improved code simplicity just for that.
> And when you claim "We can save space" - which sort of space are you
> talking about? Dos this reduce the memory footprint of the code?
I ran a couple tests, and u-boot.bin didn't change in size, but technically, it
should be smaller because the compiler will optimize the code into a normal call
to i2c_read or i2c_write.
Either way, at least the source code is smaller.
--
Timur Tabi
Linux kernel developer at Freescale
More information about the U-Boot
mailing list