mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: 张忠山 <zzs213@126.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] fix GENERIC_PHY match nothing
Date: Sat, 8 Dec 2012 12:15:03 +0100	[thread overview]
Message-ID: <20121208111503.GF10369@pengutronix.de> (raw)
In-Reply-To: <1354931932-28300-1-git-send-email-zzs213@126.com>

On Sat, Dec 08, 2012 at 09:58:52AM +0800, 张忠山 wrote:
> According the match logic in function mdio_bus_match
> generic phy driver matchs nothing.

This is done on purpose. The generic phy driver is probed manually
when no other phy matches, see:

> static int phy_register_device(struct phy_device* dev)
> {
>        int ret;
> 
>        ret = register_device(&dev->dev);
>        if (ret)
>                return ret;

register device...

> 
>        if (dev->dev.driver)
>                return 0;

... we have a driver specific to this phy, -> return

> 
>        dev->dev.driver = &genphy_driver.drv;
>        return device_probe(&dev->dev);

No driver, use generic phy driver.

>}

The problem this solves (and that you reintroduce with this patch) is
that if the phy driver matches every device, a more specific phy driver
will not be used if the generic driver is registered first.

Sascha

> 
> If we want it match anything, We must let it's phy_id_mask
> be all zeros
> 
> Signed-off-by: 张忠山 <zzs213@126.com>
> ---
>  drivers/net/phy/generic.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/phy/generic.c b/drivers/net/phy/generic.c
> index 3f5f127..c3743b9 100644
> --- a/drivers/net/phy/generic.c
> +++ b/drivers/net/phy/generic.c
> @@ -25,7 +25,7 @@
>  static struct phy_driver generic_phy = {
>  	.drv.name = "Generic PHY",
>  	.phy_id = PHY_ANY_UID,
> -	.phy_id_mask = PHY_ANY_UID,
> +	.phy_id_mask = 0,
>  	.features = 0,
>  };
>  
> -- 
> 1.7.4.4
> 
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-12-08 11:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-08  1:58 张忠山
2012-12-08 11:15 ` Sascha Hauer [this message]
2012-12-08 12:38   ` Sascha Hauer
2012-12-10  1:52     ` 张忠山

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=20121208111503.GF10369@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=zzs213@126.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