* [PATCH 1/1] net: phylib: add error checking if no phy found
@ 2012-03-13 10:58 Dong Aisheng
2012-03-13 14:33 ` Florian Fainelli
0 siblings, 1 reply; 3+ messages in thread
From: Dong Aisheng @ 2012-03-13 10:58 UTC (permalink / raw)
To: netdev, linux-kernel, linux-arm-kernel; +Cc: davem, timur, rdunlap, kernel
From: Dong Aisheng <dong.aisheng@linaro.org>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
drivers/net/phy/mdio_bus.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 88cc5db..d8e044d 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -101,6 +101,7 @@ static struct class mdio_bus_class = {
int mdiobus_register(struct mii_bus *bus)
{
int i, err;
+ u32 phynum = 0;
if (NULL == bus || NULL == bus->name ||
NULL == bus->read ||
@@ -134,12 +135,20 @@ int mdiobus_register(struct mii_bus *bus)
if (IS_ERR(phydev)) {
err = PTR_ERR(phydev);
goto error;
+ } else if (phydev != NULL) {
+ phynum++;
}
}
}
+ if (!phynum) {
+ err = -ENODEV;
+ printk(KERN_ERR "%s: no phys found\n", bus->name);
+ goto error;
+ }
+
bus->state = MDIOBUS_REGISTERED;
- pr_info("%s: probed\n", bus->name);
+ pr_info("%s: %d phys probed\n", bus->name, phynum);
return 0;
error:
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] net: phylib: add error checking if no phy found
2012-03-13 10:58 [PATCH 1/1] net: phylib: add error checking if no phy found Dong Aisheng
@ 2012-03-13 14:33 ` Florian Fainelli
2012-03-21 11:45 ` Dong Aisheng
0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2012-03-13 14:33 UTC (permalink / raw)
To: Dong Aisheng
Cc: netdev, linux-kernel, linux-arm-kernel, davem, timur, rdunlap, kernel
Hi,
Le 03/13/12 11:58, Dong Aisheng a écrit :
> From: Dong Aisheng<dong.aisheng@linaro.org>
>
> Signed-off-by: Dong Aisheng<dong.aisheng@linaro.org>
> ---
> drivers/net/phy/mdio_bus.c | 11 ++++++++++-
> 1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 88cc5db..d8e044d 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -101,6 +101,7 @@ static struct class mdio_bus_class = {
> int mdiobus_register(struct mii_bus *bus)
> {
> int i, err;
> + u32 phynum = 0;
>
> if (NULL == bus || NULL == bus->name ||
> NULL == bus->read ||
> @@ -134,12 +135,20 @@ int mdiobus_register(struct mii_bus *bus)
> if (IS_ERR(phydev)) {
> err = PTR_ERR(phydev);
> goto error;
> + } else if (phydev != NULL) {
> + phynum++;
> }
> }
> }
>
> + if (!phynum) {
> + err = -ENODEV;
> + printk(KERN_ERR "%s: no phys found\n", bus->name);
> + goto error;
> + }
I am not sure if this is a good idea to change it, especially if:
- the MII bus probing is also done later (quite some drivers do this)
- if we want to attach a fixed PHY because we could not probe one at
registration time
> +
> bus->state = MDIOBUS_REGISTERED;
> - pr_info("%s: probed\n", bus->name);
> + pr_info("%s: %d phys probed\n", bus->name, phynum);
> return 0;
>
> error:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] net: phylib: add error checking if no phy found
2012-03-13 14:33 ` Florian Fainelli
@ 2012-03-21 11:45 ` Dong Aisheng
0 siblings, 0 replies; 3+ messages in thread
From: Dong Aisheng @ 2012-03-21 11:45 UTC (permalink / raw)
To: Florian Fainelli
Cc: Dong Aisheng-B29396, netdev, linux-kernel, linux-arm-kernel,
davem, Tabi Timur-B04825, rdunlap, kernel
On Tue, Mar 13, 2012 at 10:33:35PM +0800, Florian Fainelli wrote:
> Hi,
>
> Le 03/13/12 11:58, Dong Aisheng a écrit :
> > From: Dong Aisheng<dong.aisheng@linaro.org>
> >
> > Signed-off-by: Dong Aisheng<dong.aisheng@linaro.org>
> > ---
> > drivers/net/phy/mdio_bus.c | 11 ++++++++++-
> > 1 files changed, 10 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> > index 88cc5db..d8e044d 100644
> > --- a/drivers/net/phy/mdio_bus.c
> > +++ b/drivers/net/phy/mdio_bus.c
> > @@ -101,6 +101,7 @@ static struct class mdio_bus_class = {
> > int mdiobus_register(struct mii_bus *bus)
> > {
> > int i, err;
> > + u32 phynum = 0;
> >
> > if (NULL == bus || NULL == bus->name ||
> > NULL == bus->read ||
> > @@ -134,12 +135,20 @@ int mdiobus_register(struct mii_bus *bus)
> > if (IS_ERR(phydev)) {
> > err = PTR_ERR(phydev);
> > goto error;
> > + } else if (phydev != NULL) {
> > + phynum++;
> > }
> > }
> > }
> >
> > + if (!phynum) {
> > + err = -ENODEV;
> > + printk(KERN_ERR "%s: no phys found\n", bus->name);
> > + goto error;
> > + }
>
> I am not sure if this is a good idea to change it, especially if:
> - the MII bus probing is also done later (quite some drivers do this)
> - if we want to attach a fixed PHY because we could not probe one at
> registration time
>
You're correct.
It seems keep it as before is the right solution right now.
Thanks for the info.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-21 11:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-13 10:58 [PATCH 1/1] net: phylib: add error checking if no phy found Dong Aisheng
2012-03-13 14:33 ` Florian Fainelli
2012-03-21 11:45 ` Dong Aisheng
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).