* [PATCH] net/mdio: fix mdio_bus_match for c45 PHY
@ 2015-07-17 10:07 shh.xie
2015-07-21 7:17 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: shh.xie @ 2015-07-17 10:07 UTC (permalink / raw)
To: netdev, davem; +Cc: Shaohui Xie
From: Shaohui Xie <Shaohui.Xie@freescale.com>
We store c45 PHY's id information in c45_ids, so it should be used to
check the matching between PHY driver and PHY device for c45 PHY.
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
drivers/net/phy/mdio_bus.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 095ef3f..46a14cb 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -421,6 +421,8 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
{
struct phy_device *phydev = to_phy_device(dev);
struct phy_driver *phydrv = to_phy_driver(drv);
+ const int num_ids = ARRAY_SIZE(phydev->c45_ids.device_ids);
+ int i;
if (of_driver_match_device(dev, drv))
return 1;
@@ -428,8 +430,21 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
if (phydrv->match_phy_device)
return phydrv->match_phy_device(phydev);
- return (phydrv->phy_id & phydrv->phy_id_mask) ==
- (phydev->phy_id & phydrv->phy_id_mask);
+ if (phydev->is_c45) {
+ for (i = 1; i < num_ids; i++) {
+ if (!(phydev->c45_ids.devices_in_package & (1 << i)))
+ continue;
+
+ if ((phydrv->phy_id & phydrv->phy_id_mask) ==
+ (phydev->c45_ids.device_ids[i] &
+ phydrv->phy_id_mask))
+ return 1;
+ }
+ return 0;
+ } else {
+ return (phydrv->phy_id & phydrv->phy_id_mask) ==
+ (phydev->phy_id & phydrv->phy_id_mask);
+ }
}
#ifdef CONFIG_PM
--
2.1.0.27.g96db324
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net/mdio: fix mdio_bus_match for c45 PHY
2015-07-17 10:07 [PATCH] net/mdio: fix mdio_bus_match for c45 PHY shh.xie
@ 2015-07-21 7:17 ` David Miller
2015-07-23 2:41 ` Shaohui Xie
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2015-07-21 7:17 UTC (permalink / raw)
To: shh.xie; +Cc: netdev, Shaohui.Xie
From: <shh.xie@gmail.com>
Date: Fri, 17 Jul 2015 18:07:19 +0800
> From: Shaohui Xie <Shaohui.Xie@freescale.com>
>
> We store c45 PHY's id information in c45_ids, so it should be used to
> check the matching between PHY driver and PHY device for c45 PHY.
>
> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] net/mdio: fix mdio_bus_match for c45 PHY
2015-07-21 7:17 ` David Miller
@ 2015-07-23 2:41 ` Shaohui Xie
0 siblings, 0 replies; 3+ messages in thread
From: Shaohui Xie @ 2015-07-23 2:41 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Tuesday, July 21, 2015 3:17 PM
> To: shh.xie@gmail.com
> Cc: netdev@vger.kernel.org; Xie Shaohui-B21989
> Subject: Re: [PATCH] net/mdio: fix mdio_bus_match for c45 PHY
>
> From: <shh.xie@gmail.com>
> Date: Fri, 17 Jul 2015 18:07:19 +0800
>
> > From: Shaohui Xie <Shaohui.Xie@freescale.com>
> >
> > We store c45 PHY's id information in c45_ids, so it should be used to
> > check the matching between PHY driver and PHY device for c45 PHY.
> >
> > Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
>
> Applied, thanks.
As mentioned, the patch was applied, but it does not merged, seems it was missed.
Thanks.
Shaohui
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-23 2:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-17 10:07 [PATCH] net/mdio: fix mdio_bus_match for c45 PHY shh.xie
2015-07-21 7:17 ` David Miller
2015-07-23 2:41 ` Shaohui Xie
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).