From: Jiri Pirko <jpirko@redhat.com>
To: davem@davemloft.net, steve.glendinning@smsc.com, netdev@vger.kernel.org
Subject: Re: [PACH] smsc911x: replace manual phy lookup.
Date: Wed, 17 Feb 2010 09:15:13 +0100 [thread overview]
Message-ID: <20100217081449.GA3360@psychotron.redhat.com> (raw)
In-Reply-To: <20100217075458.GA4388@coldcone>
Wed, Feb 17, 2010 at 08:54:58AM CET, kirjanov@gmail.com wrote:
>Use phy_find_first() function instead of manual lookup.
>
>Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
>
>---
>
> drivers/net/smsc911x.c | 24 ++++++++++--------------
> 1 files changed, 10 insertions(+), 14 deletions(-)
>
>diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
>index 3c1f9aa..13c0b76 100644
>--- a/drivers/net/smsc911x.c
>+++ b/drivers/net/smsc911x.c
>@@ -770,29 +770,25 @@ static int smsc911x_mii_probe(struct net_device *dev)
> {
> struct smsc911x_data *pdata = netdev_priv(dev);
> struct phy_device *phydev = NULL;
>- int phy_addr;
>+ int ret;
>
> /* find the first phy */
>- for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
>- if (pdata->mii_bus->phy_map[phy_addr]) {
>- phydev = pdata->mii_bus->phy_map[phy_addr];
>- SMSC_TRACE(PROBE, "PHY %d: addr %d, phy_id 0x%08X",
>- phy_addr, phydev->addr, phydev->phy_id);
>- break;
>- }
>- }
>-
>+ phydev = phy_find_first(pdata->mii_bus);
> if (!phydev) {
> pr_err("%s: no PHY found\n", dev->name);
> return -ENODEV;
> }
>
>- phydev = phy_connect(dev, dev_name(&phydev->dev),
>- &smsc911x_phy_adjust_link, 0, pdata->config.phy_interface);
>+ SMSC_TRACE(PROBE, "PHY %d: addr %d, phy_id 0x%08X",
>+ phy_addr, phydev->addr, phydev->phy_id);
>+
>+ ret = phy_connect_direct(dev, phydev,
>+ &smsc911x_phy_adjust_link, 0,
>+ pdata->config.phy_interface);
>
>- if (IS_ERR(phydev)) {
>+ if (ret) {
> pr_err("%s: Could not attach to PHY\n", dev->name);
>- return PTR_ERR(phydev);
>+ return ret;
> }
>
> pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
Looks good to me.
Reviewed-by: Jiri Pirko <jpirko@redhat.com>
next prev parent reply other threads:[~2010-02-17 8:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-17 7:54 [PACH] smsc911x: replace manual phy lookup Denis Kirjanov <kirjanov@gmail.com
2010-02-17 8:15 ` Jiri Pirko [this message]
2010-02-18 0:03 ` David Miller
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=20100217081449.GA3360@psychotron.redhat.com \
--to=jpirko@redhat.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=steve.glendinning@smsc.com \
/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;
as well as URLs for NNTP newsgroup(s).