Skip to contentSkip to conversation

net: phy: Don't create phy device when there is no phy

PATCH Superseded Bin Meng 2 participants 11 messages Sep 4, 2015 – Sep 23, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/3 net: phy: Don't create phy device when there is no phy

In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.

---

 drivers/net/phy/phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +2 -1
index 65c731a..0d66e75 100644
@@ -672,7 +672,8 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,
 			return phydev;
 	}
 	printf("Phy %d not found\n", ffs(phy_mask) - 1);
-	return phy_device_create(bus, ffs(phy_mask) - 1, 0xffffffff, interface);
+
+	return NULL;
 }
 
 /**
Signature · 1 line
1.8.2.1
author
#1 lore raw

PATCH 1/3 net: phy: Don't create phy device when there is no phy

Hi Joe,

Quoted 14 lines · Bin Meng

In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.

---

 drivers/net/phy/phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +0 -0
index 65c731a..0d66e75 100644

drivers/net/phy/phy.c static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,

Quoted 10 lines
drivers/net/phy/phy.c +2 -2
@@ -672,7 +672,8 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,
                        return phydev;
        }
        printf("Phy %d not found\n", ffs(phy_mask) - 1);
-       return phy_device_create(bus, ffs(phy_mask) - 1, 0xffffffff, interface);
+
+       return NULL;
 }
 
 /**
--

Ping?

Regards,
Bin

author
#2 lore raw

PATCH 2/3 net: phy: Change to print all phys that are not found

In reply to Bin Meng

In get_phy_device_by_mask(), when no phy is found, currently we only print a message to show the first phy address that is not found. But this is not always the case as multiple phys can be specified by phy_mask. Change to print all phys that are not found, and to reduce the console boot log, change to use 'debug' instead of 'printf'.

---

 drivers/net/phy/phy.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +8 -1
index 0d66e75..651e456 100644
@@ -671,7 +671,14 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,
 		if (phydev)
 			return phydev;
 	}
-	printf("Phy %d not found\n", ffs(phy_mask) - 1);
+
+	debug("\n%s PHY: ", bus->name);
+	while (phy_mask) {
+		int addr = ffs(phy_mask) - 1;
+		debug("%d ", addr);
+		phy_mask &= ~(1 << addr);
+	}
+	debug("not found\n");
 
 	return NULL;
 }
Signature · 1 line
1.8.2.1
#3 lore raw

PATCH 2/3 net: phy: Change to print all phys that are not found

Hi Bin,

Quoted 7 lines · Bin Meng

In get_phy_device_by_mask(), when no phy is found, currently we only print a message to show the first phy address that is not found. But this is not always the case as multiple phys can be specified by phy_mask. Change to print all phys that are not found, and to reduce the console boot log, change to use 'debug' instead of 'printf'.

author
#4 lore raw

PATCH 3/3 net: phy: Test previous phydev->dev against new mac dev

In reply to Bin Meng

In phy_connect_dev(), if the phy device has an accociated mac device before, a warning message will be printed. But we should test the old device against the new one, if they are actually the same one, don't print the warning message.

---

 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
index 651e456..35dfcc1 100644
@@ -789,7 +789,7 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev)
 {
 	/* Soft Reset the PHY */
 	phy_reset(phydev);
-	if (phydev->dev) {
+	if (phydev->dev && phydev->dev != dev) {
 		printf("%s:%d is connected to %s.  Reconnecting to %s\n",
 				phydev->bus->name, phydev->addr,
 				phydev->dev->name, dev->name);
Signature · 1 line
1.8.2.1
#5 lore raw

PATCH 3/3 net: phy: Test previous phydev->dev against new mac dev

Hi Bin,

Quoted 6 lines · Bin Meng

In phy_connect_dev(), if the phy device has an accociated mac device before, a warning message will be printed. But we should test the old device against the new one, if they are actually the same one, don't print the warning message.

author
#7 lore raw

PATCH 1/3 net: phy: Don't create phy device when there is no phy

Hi Joe,

Quoted 9 lines · Joe Hershberger

Hi Bin,

Quoted 4 lines · Bin Meng

In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.

What about the other 2 patches in this series?

Regards,
Bin

author
#8 lore raw

PATCH 1/3 net: phy: Don't create phy device when there is no phy

Hi Joe,

Quoted 7 lines · Bin Meng

Hi Joe,

Quoted 3 lines · Joe Hershberger

Hi Bin,

On Fri, Sep 4, 2015 at 6:56 AM, Bin Meng <[email protected]> wrote:

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.

What about the other 2 patches in this series?

A gentle ping?

Regards,
Bin

#9 lore raw

PATCH 1/3 net: phy: Don't create phy device when there is no phy

Hi Bin,

Quoted 13 lines · Bin Meng

Hi Joe,

Quoted 10 lines · Bin Meng

Hi Joe,

Quoted 6 lines · Joe Hershberger

Hi Bin,

Quoted 3 lines · Bin Meng

In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

What about the other 2 patches in this series?

A gentle ping?

Sorry but my email threading is not helping me find the other two. What are the exact subjects?

Thanks,
-Joe

author
#10 lore raw

PATCH 1/3 net: phy: Don't create phy device when there is no phy

Hi Joe,

Quoted 20 lines · Joe Hershberger

Hi Bin,

Quoted 17 lines · Bin Meng

Hi Joe,

Quoted 14 lines · Bin Meng

Hi Joe,

Quoted 9 lines · Joe Hershberger

Hi Bin,

Quoted 4 lines · Bin Meng

In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

What about the other 2 patches in this series?

A gentle ping?

Sorry but my email threading is not helping me find the other two. What are the exact subjects?

They are here:
http://patchwork.ozlabs.org/patch/514398/
http://patchwork.ozlabs.org/patch/514399/

Regards,
Bin