Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: phy: fixed_phy: transition to the faux device interface

The net fixed phy driver does not require the creation of a platform
device. Originally, this approach was chosen for simplicity when the
driver was first implemented.

With the introduction of the lightweight faux device interface, we now
have a more appropriate alternative. Migrate the device to utilize the
faux bus, given that the platform device it previously created was not
a real one anyway. This will get rid of the fake platform device.

Cc: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://patch.msgid.link/20250319135209.2734594-1-sudeep.holla@arm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Sudeep Holla and committed by
Jakub Kicinski
c4ebde35 8112d5f6

+8 -8
+8 -8
drivers/net/phy/fixed_phy.c
··· 10 10 11 11 #include <linux/kernel.h> 12 12 #include <linux/module.h> 13 - #include <linux/platform_device.h> 13 + #include <linux/device/faux.h> 14 14 #include <linux/list.h> 15 15 #include <linux/mii.h> 16 16 #include <linux/phy.h> ··· 40 40 struct gpio_desc *link_gpiod; 41 41 }; 42 42 43 - static struct platform_device *pdev; 43 + static struct faux_device *fdev; 44 44 static struct fixed_mdio_bus platform_fmb = { 45 45 .phys = LIST_HEAD_INIT(platform_fmb.phys), 46 46 }; ··· 337 337 struct fixed_mdio_bus *fmb = &platform_fmb; 338 338 int ret; 339 339 340 - pdev = platform_device_register_simple("Fixed MDIO bus", 0, NULL, 0); 341 - if (IS_ERR(pdev)) 342 - return PTR_ERR(pdev); 340 + fdev = faux_device_create("Fixed MDIO bus", NULL, NULL); 341 + if (!fdev) 342 + return -ENODEV; 343 343 344 344 fmb->mii_bus = mdiobus_alloc(); 345 345 if (fmb->mii_bus == NULL) { ··· 350 350 snprintf(fmb->mii_bus->id, MII_BUS_ID_SIZE, "fixed-0"); 351 351 fmb->mii_bus->name = "Fixed MDIO Bus"; 352 352 fmb->mii_bus->priv = fmb; 353 - fmb->mii_bus->parent = &pdev->dev; 353 + fmb->mii_bus->parent = &fdev->dev; 354 354 fmb->mii_bus->read = &fixed_mdio_read; 355 355 fmb->mii_bus->write = &fixed_mdio_write; 356 356 fmb->mii_bus->phy_mask = ~0; ··· 364 364 err_mdiobus_alloc: 365 365 mdiobus_free(fmb->mii_bus); 366 366 err_mdiobus_reg: 367 - platform_device_unregister(pdev); 367 + faux_device_destroy(fdev); 368 368 return ret; 369 369 } 370 370 module_init(fixed_mdio_bus_init); ··· 376 376 377 377 mdiobus_unregister(fmb->mii_bus); 378 378 mdiobus_free(fmb->mii_bus); 379 - platform_device_unregister(pdev); 379 + faux_device_destroy(fdev); 380 380 381 381 list_for_each_entry_safe(fp, tmp, &fmb->phys, node) { 382 382 list_del(&fp->node);