[PATCH 09/12] net: phy: nxp-tja11xx: make use of phy_device_atomic_register()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the new atomic API to setup and register the phy accordingly.

Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
---
 drivers/net/phy/nxp-tja11xx.c | 31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)

diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c
index 2a4c0f6d74eb..af9cb5e1a7ee 100644
--- a/drivers/net/phy/nxp-tja11xx.c
+++ b/drivers/net/phy/nxp-tja11xx.c
@@ -561,6 +561,8 @@ static void tja1102_p1_register(struct work_struct *work)
 			/* Real PHY ID of Port 1 is 0 */
 			.phy_id = PHY_ID_TJA1102,
 			.phy_id_broken = true,
+			.parent_mdiodev = dev,
+			.fwnode = of_fwnode_handle(child),
 		};
 		struct phy_device *phy;
 
@@ -583,30 +585,11 @@ static void tja1102_p1_register(struct work_struct *work)
 			continue;
 		}
 
-		phy = phy_device_create(&config);
-		if (IS_ERR(phy)) {
-			dev_err(dev, "Can't create PHY device for Port 1: %i\n",
-				config.phy_addr);
-			continue;
-		}
-
-		/* Overwrite parent device. phy_device_create() set parent to
-		 * the mii_bus->dev, which is not correct in case.
-		 */
-		phy->mdio.dev.parent = dev;
-
-		ret = of_mdiobus_phy_device_register(bus, phy, child,
-						     config.phy_addr);
-		if (ret) {
-			/* All resources needed for Port 1 should be already
-			 * available for Port 0. Both ports use the same
-			 * interrupt line, so -EPROBE_DEFER would make no sense
-			 * here.
-			 */
-			dev_err(dev, "Can't register Port 1. Unexpected error: %i\n",
-				ret);
-			phy_device_free(phy);
-		}
+		phy = phy_device_atomic_register(&config);
+		if (IS_ERR(phy))
+			dev_err_probe(dev, PTR_ERR(phy),
+				      "Can't create PHY device for Port 1: %i\n",
+				      config.phy_addr);
 	}
 }
 

-- 
2.39.2




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux