From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [Fwd: Re: PATCH 2/8 Multi-adapter multi-bus I2C]
Date: Tue, 10 Feb 2009 09:22:22 +0100 [thread overview]
Message-ID: <4991393E.3070509@denx.de> (raw)
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 <hs@denx.de>
Antwort an: hs at denx.de
Organisation: DENX GmbH
An: ksi at koi8.net
Referenzen: <Pine.LNX.4.64ksi.0902061703330.14843@home-gw.koi8.net> <4990175A.4020703@denx.de> <Pine.LNX.4.64ksi.0902091353360.32084@home-gw.koi8.net>
Hello ksi,
ksi at koi8.net wrote:
> On Mon, 9 Feb 2009, Heiko Schocher wrote:
>> Hello ksi,
>>
>> ksi at koi8.net wrote:
>> [...]
>>> diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
>>> index ce646fd..f7998e3 100644
>>> --- a/drivers/i2c/fsl_i2c.c
[...]
>>> -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;
>>>
>>> - 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.
>
> 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.
> Anyway, keeping that dev won't make any difference other than making the
> patch a tad shorter...
thanks.
bye
Heiko
--
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
reply other threads:[~2009-02-10 8:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4991393E.3070509@denx.de \
--to=hs@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox