[U-Boot] [Fwd: Re: PATCH 2/8 Multi-adapter multi-bus I2C]
PATCH 2/8 [U-Boot] [Fwd: Re: PATCH 2/8 Multi-adapter multi-bus I2C]
Hello,
sorry, forgot to hold the mailinglist on CC:
-------- Original-Nachricht --------
Betreff: Re: [U-Boot] PATCH 2/8 Multi-adapter multi-bus I2C
Datum: Tue, 10 Feb 2009 08:54:10 +0100
Von: Heiko Schocher <[email protected]>
Antwort an: hs at denx.de
Organisation: DENX GmbH
An: ksi at koi8.net
Referenzen: <[email protected]> <[email protected]> <[email protected]>
Hello ksi,
Quoted 8 lines · ksi at koi8.net wrote:
Quoted 7 lines · Heiko Schocher
Hello ksi,
ksi at koi8.net wrote:
[...]Quoted 3 lines
drivers/i2c/fsl_i2c.c +0
-1--- a/drivers/i2c/fsl_i2c.c
[...]
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
drivers/i2c/fsl_i2c.c +2
-3-void -i2c_init (int speed,int slaveadd) + +static void __i2c_init (int adap_no,int speed,int slaveadd) { -struct fsl_i2c *dev;unsigned int temp;Quoted 7 lines
drivers/i2c/fsl_i2c.c
Quoted 5 lines
drivers/i2c/fsl_i2c.c +1
-3- dev = (struct fsl_i2c *) (CONFIG_SYS_IMMR +CONFIG_SYS_I2C_OFFSET ); - -writeb (0 , &dev->cr);/* stop I2C controller */ +writeb (0 , &i2c_dev[adap_no]->cr);/* stop I2C controller */ 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.
Quoted 2 lines
This eliminates one variable, dev. Another reason is uniformity through the entire driver source.
But it is less readable (at least to me). And it distracts from the reason of the patch, making the driver multibus able. Again, please don't mix Codingstyle, Code optimization and functional changes.
Quoted 2 lines
Anyway, keeping that dev won't make any difference other than making the patch a tad shorter...
thanks.
bye
Heiko
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany