All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2] net: phy: Also request modules for C45 IDs
@ 2018-12-02 15:33 Jose Abreu
  2018-12-02 16:09 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jose Abreu @ 2018-12-02 15:33 UTC (permalink / raw)
  To: netdev
  Cc: Jose Abreu, Andrew Lunn, Florian Fainelli, David S. Miller, Joao Pinto

Logic of phy_device_create() requests PHY modules according to PHY ID
but for C45 PHYs we use different field for the IDs.

Let's also request the modules for these IDs.

Changes from v1:
- Only request C22 modules if C45 are not present (Andrew)

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Joao Pinto <joao.pinto@synopsys.com>
---
 drivers/net/phy/phy_device.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 0904002b19a2..1569db7480af 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -605,7 +605,21 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 	 * driver will get bored and give up as soon as it finds that
 	 * there's no driver _already_ loaded.
 	 */
-	request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT, MDIO_ID_ARGS(phy_id));
+	if (is_c45 && c45_ids) {
+		const int num_ids = ARRAY_SIZE(c45_ids->device_ids);
+		int i;
+
+		for (i = 1; i < num_ids; i++) {
+			if (!(c45_ids->devices_in_package & (1 << i)))
+				continue;
+
+			request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
+				       MDIO_ID_ARGS(c45_ids->device_ids[i]));
+		}
+	} else {
+		request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
+			       MDIO_ID_ARGS(phy_id));
+	}
 
 	device_initialize(&mdiodev->dev);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2] net: phy: Also request modules for C45 IDs
  2018-12-02 15:33 [PATCH net-next v2] net: phy: Also request modules for C45 IDs Jose Abreu
@ 2018-12-02 16:09 ` Andrew Lunn
  2018-12-02 17:30 ` Florian Fainelli
  2018-12-04  0:33 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2018-12-02 16:09 UTC (permalink / raw)
  To: Jose Abreu; +Cc: netdev, Florian Fainelli, David S. Miller, Joao Pinto

On Sun, Dec 02, 2018 at 04:33:14PM +0100, Jose Abreu wrote:
> Logic of phy_device_create() requests PHY modules according to PHY ID
> but for C45 PHYs we use different field for the IDs.
> 
> Let's also request the modules for these IDs.
> 
> Changes from v1:
> - Only request C22 modules if C45 are not present (Andrew)
> 
> Signed-off-by: Jose Abreu <joabreu@synopsys.com>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Joao Pinto <joao.pinto@synopsys.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2] net: phy: Also request modules for C45 IDs
  2018-12-02 15:33 [PATCH net-next v2] net: phy: Also request modules for C45 IDs Jose Abreu
  2018-12-02 16:09 ` Andrew Lunn
@ 2018-12-02 17:30 ` Florian Fainelli
  2018-12-04  0:33 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2018-12-02 17:30 UTC (permalink / raw)
  To: Jose Abreu, netdev; +Cc: Andrew Lunn, David S. Miller, Joao Pinto



On December 2, 2018 7:33:14 AM PST, Jose Abreu <jose.abreu@synopsys.com> wrote:
>Logic of phy_device_create() requests PHY modules according to PHY ID
>but for C45 PHYs we use different field for the IDs.
>
>Let's also request the modules for these IDs.
>
>Changes from v1:
>- Only request C22 modules if C45 are not present (Andrew)

Usually you can put the patch changelog under the '---' such that it gets stripped out when applying, not a big deal at all.

I don't have an easy way of testing this at the moment but this looks good:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Thanks!
-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2] net: phy: Also request modules for C45 IDs
  2018-12-02 15:33 [PATCH net-next v2] net: phy: Also request modules for C45 IDs Jose Abreu
  2018-12-02 16:09 ` Andrew Lunn
  2018-12-02 17:30 ` Florian Fainelli
@ 2018-12-04  0:33 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-12-04  0:33 UTC (permalink / raw)
  To: jose.abreu; +Cc: netdev, andrew, f.fainelli, joao.pinto

From: Jose Abreu <jose.abreu@synopsys.com>
Date: Sun,  2 Dec 2018 16:33:14 +0100

> Logic of phy_device_create() requests PHY modules according to PHY ID
> but for C45 PHYs we use different field for the IDs.
> 
> Let's also request the modules for these IDs.
> 
> Changes from v1:
> - Only request C22 modules if C45 are not present (Andrew)
> 
> Signed-off-by: Jose Abreu <joabreu@synopsys.com>

Applied, thanks Jose.

Florian, just for the record, I actually like the changelogs to be in
the commit messages.  It can help people understand that something
was deliberately implemented a certain way and alternative approaches
were considered.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-04  0:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-02 15:33 [PATCH net-next v2] net: phy: Also request modules for C45 IDs Jose Abreu
2018-12-02 16:09 ` Andrew Lunn
2018-12-02 17:30 ` Florian Fainelli
2018-12-04  0:33 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.