From: Bryan Wu <bryan.wu@canonical.com>
To: afleming@gmail.com, davem@davemloft.net
Cc: Sascha Hauer <s.hauer@pengutronix.de>,
Greg Ungerer <gerg@uclinux.org>,
Amit Kucheria <amit.kucheria@canonical.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] netdev/fec: fix ifconfig eth0 down hang issue
Date: Fri, 28 May 2010 13:26:42 +0800 [thread overview]
Message-ID: <4BFF5412.1030303@canonical.com> (raw)
In-Reply-To: <1273199239-11057-3-git-send-email-bryan.wu@canonical.com>
Since this patch is for another bug and doesn't depend on my first one patch.
Could you please review this?
Thanks,
-Bryan
On 05/07/2010 10:27 AM, Bryan Wu wrote:
> BugLink: http://bugs.launchpad.net/bugs/559065
>
> In fec open/close function, we need to use phy_connect and phy_disconnect
> operation before we start/stop phy. Otherwise it will cause system hang.
>
> Only call fec_enet_mii_probe() in open function, because the first open
> action will cause NULL pointer error.
>
> Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
> ---
> drivers/net/fec.c | 28 ++++++++++++++++------------
> 1 files changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index 9c58f6b..af4243f 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -678,6 +678,8 @@ static int fec_enet_mii_probe(struct net_device *dev)
> struct phy_device *phy_dev = NULL;
> int phy_addr;
>
> + fep->phy_dev = NULL;
> +
> /* find the first phy */
> for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
> if (fep->mii_bus->phy_map[phy_addr]) {
> @@ -708,6 +710,11 @@ static int fec_enet_mii_probe(struct net_device *dev)
> fep->link = 0;
> fep->full_duplex = 0;
>
> + printk(KERN_INFO "%s: Freescale FEC PHY driver [%s] "
> + "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name,
> + fep->phy_dev->drv->name, dev_name(&fep->phy_dev->dev),
> + fep->phy_dev->irq);
> +
> return 0;
> }
>
> @@ -753,13 +760,8 @@ static int fec_enet_mii_init(struct platform_device *pdev)
> if (mdiobus_register(fep->mii_bus))
> goto err_out_free_mdio_irq;
>
> - if (fec_enet_mii_probe(dev) != 0)
> - goto err_out_unregister_bus;
> -
> return 0;
>
> -err_out_unregister_bus:
> - mdiobus_unregister(fep->mii_bus);
> err_out_free_mdio_irq:
> kfree(fep->mii_bus->irq);
> err_out_free_mdiobus:
> @@ -912,7 +914,12 @@ fec_enet_open(struct net_device *dev)
> if (ret)
> return ret;
>
> - /* schedule a link state check */
> + /* Probe and connect to PHY when open the interface */
> + ret = fec_enet_mii_probe(dev);
> + if (ret) {
> + fec_enet_free_buffers(dev);
> + return ret;
> + }
> phy_start(fep->phy_dev);
> netif_start_queue(dev);
> fep->opened = 1;
> @@ -926,10 +933,12 @@ fec_enet_close(struct net_device *dev)
>
> /* Don't know what to do yet. */
> fep->opened = 0;
> - phy_stop(fep->phy_dev);
> netif_stop_queue(dev);
> fec_stop(dev);
>
> + if (fep->phy_dev)
> + phy_disconnect(fep->phy_dev);
> +
> fec_enet_free_buffers(dev);
>
> return 0;
> @@ -1293,11 +1302,6 @@ fec_probe(struct platform_device *pdev)
> if (ret)
> goto failed_register;
>
> - printk(KERN_INFO "%s: Freescale FEC PHY driver [%s] "
> - "(mii_bus:phy_addr=%s, irq=%d)\n", ndev->name,
> - fep->phy_dev->drv->name, dev_name(&fep->phy_dev->dev),
> - fep->phy_dev->irq);
> -
> return 0;
>
> failed_register:
next prev parent reply other threads:[~2010-05-28 5:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 2:27 [PATCH 0/2] net-next/fec: bug fixing after introduced phylib supporting Bryan Wu
2010-05-07 2:27 ` [PATCH 1/2] netdev/fec: fix performance impact from mdio poll operation Bryan Wu
2010-05-07 16:06 ` Andy Fleming
2010-05-08 10:07 ` Bryan Wu
2010-05-08 15:25 ` Andy Fleming
2010-05-16 7:28 ` David Miller
2010-05-28 5:23 ` Bryan Wu
2010-05-07 2:27 ` [PATCH 2/2] netdev/fec: fix ifconfig eth0 down hang issue Bryan Wu
2010-05-28 5:26 ` Bryan Wu [this message]
2010-05-28 7:48 ` David Miller
2010-05-28 8:03 ` Bryan Wu
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=4BFF5412.1030303@canonical.com \
--to=bryan.wu@canonical.com \
--cc=afleming@gmail.com \
--cc=amit.kucheria@canonical.com \
--cc=davem@davemloft.net \
--cc=gerg@uclinux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=s.hauer@pengutronix.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;
as well as URLs for NNTP newsgroup(s).