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

net: phy: fixed: remove usage of a faux device

A struct mii_bus doesn't need a parent, so we can simplify the code and
remove using a faux device. Only difference is the following in sysfs
under /sys/class/mdio_bus:

old: fixed-0 -> '../../devices/faux/Fixed MDIO bus/mdio_bus/fixed-0'
new: fixed-0 -> ../../devices/virtual/mdio_bus/fixed-0

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/e9426bb9-f228-4b99-bc09-a80a958b5a93@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
d0f11077 7de0eebb

+2 -14
+2 -14
drivers/net/phy/fixed_phy.c
··· 10 10 11 11 #include <linux/kernel.h> 12 12 #include <linux/module.h> 13 - #include <linux/device/faux.h> 14 13 #include <linux/list.h> 15 14 #include <linux/mii.h> 16 15 #include <linux/phy.h> ··· 39 40 struct gpio_desc *link_gpiod; 40 41 }; 41 42 42 - static struct faux_device *fdev; 43 43 static struct fixed_mdio_bus platform_fmb = { 44 44 .phys = LIST_HEAD_INIT(platform_fmb.phys), 45 45 }; ··· 315 317 struct fixed_mdio_bus *fmb = &platform_fmb; 316 318 int ret; 317 319 318 - fdev = faux_device_create("Fixed MDIO bus", NULL, NULL); 319 - if (!fdev) 320 - return -ENODEV; 321 - 322 320 fmb->mii_bus = mdiobus_alloc(); 323 - if (fmb->mii_bus == NULL) { 324 - ret = -ENOMEM; 325 - goto err_mdiobus_reg; 326 - } 321 + if (!fmb->mii_bus) 322 + return -ENOMEM; 327 323 328 324 snprintf(fmb->mii_bus->id, MII_BUS_ID_SIZE, "fixed-0"); 329 325 fmb->mii_bus->name = "Fixed MDIO Bus"; 330 326 fmb->mii_bus->priv = fmb; 331 - fmb->mii_bus->parent = &fdev->dev; 332 327 fmb->mii_bus->read = &fixed_mdio_read; 333 328 fmb->mii_bus->write = &fixed_mdio_write; 334 329 fmb->mii_bus->phy_mask = ~0; ··· 334 343 335 344 err_mdiobus_alloc: 336 345 mdiobus_free(fmb->mii_bus); 337 - err_mdiobus_reg: 338 - faux_device_destroy(fdev); 339 346 return ret; 340 347 } 341 348 module_init(fixed_mdio_bus_init); ··· 345 356 346 357 mdiobus_unregister(fmb->mii_bus); 347 358 mdiobus_free(fmb->mii_bus); 348 - faux_device_destroy(fdev); 349 359 350 360 list_for_each_entry_safe(fp, tmp, &fmb->phys, node) { 351 361 list_del(&fp->node);