From: Matthias Fuchs <matthias.fuchs@esd.eu>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] 4xx: add support for new PMC440 revision
Date: Wed, 19 Mar 2014 13:21:26 +0100 [thread overview]
Message-ID: <53298BC6.9010402@esd.eu> (raw)
In-Reply-To: <53298303.1050402@denx.de>
On 19.03.2014 12:44, Stefan Roese wrote:
>> - if (miiphy_write("ppc_4xx_eth0", CONFIG_PHY_ADDR, 0x1f, 0x0001) == 0) {
>> - miiphy_write("ppc_4xx_eth0", CONFIG_PHY_ADDR, 0x11, 0x0010);
>> - miiphy_write("ppc_4xx_eth0", CONFIG_PHY_ADDR, 0x11, val_behavior);
>> - miiphy_write("ppc_4xx_eth0", CONFIG_PHY_ADDR, 0x10, val_method);
>> - miiphy_write("ppc_4xx_eth0", CONFIG_PHY_ADDR, 0x1f, 0x0000);
>> - }
>> + if (miiphy_write("ppc_4xx_eth0",
>> + CONFIG_PHY_ADDR, 0x1f, 0x0001) == 0) {
>> + miiphy_write("ppc_4xx_eth0",
>> + CONFIG_PHY_ADDR, 0x11, 0x0010);
>> + miiphy_write("ppc_4xx_eth0",
>> + CONFIG_PHY_ADDR, 0x11, val_behavior);
>> + miiphy_write("ppc_4xx_eth0",
>> + CONFIG_PHY_ADDR, 0x10, val_method);
>> + miiphy_write("ppc_4xx_eth0",
>> + CONFIG_PHY_ADDR, 0x1f, 0x0000);
>> + }
>>
>> - if (miiphy_write("ppc_4xx_eth1", CONFIG_PHY1_ADDR, 0x1f, 0x0001) == 0) {
>> - miiphy_write("ppc_4xx_eth1", CONFIG_PHY1_ADDR, 0x11, 0x0010);
>> - miiphy_write("ppc_4xx_eth1", CONFIG_PHY1_ADDR, 0x11, val_behavior);
>> - miiphy_write("ppc_4xx_eth1", CONFIG_PHY1_ADDR, 0x10, val_method);
>> - miiphy_write("ppc_4xx_eth1", CONFIG_PHY1_ADDR, 0x1f, 0x0000);
>> + if (miiphy_write("ppc_4xx_eth1",
>> + CONFIG_PHY1_ADDR, 0x1f, 0x0001) == 0) {
>> + miiphy_write("ppc_4xx_eth1",
>> + CONFIG_PHY1_ADDR, 0x11, 0x0010);
>> + miiphy_write("ppc_4xx_eth1",
>> + CONFIG_PHY1_ADDR, 0x11, val_behavior);
>> + miiphy_write("ppc_4xx_eth1",
>> + CONFIG_PHY1_ADDR, 0x10, val_method);
>> + miiphy_write("ppc_4xx_eth1",
>> + CONFIG_PHY1_ADDR, 0x1f, 0x0000);
>> + }
>
> This if () section looks very similar to the one before in this patch.
> Only difference is the string "ppc_4xx_eth1". Can't you move this code
> into a function to reduce the code size?
>
> I know this code duplication was not introduced with this patch. But it
> makes sense to simplify this now for my taste.
You might be right. But I will put it into a separate "refacturing"
patch. Stay tuned.
Matthias
prev parent reply other threads:[~2014-03-19 12:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 9:25 [U-Boot] [PATCH] 4xx: add support for new PMC440 revision Matthias Fuchs
2014-03-19 11:44 ` Stefan Roese
2014-03-19 12:21 ` Matthias Fuchs [this message]
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=53298BC6.9010402@esd.eu \
--to=matthias.fuchs@esd.eu \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.