Skip to content

Commit d0f1107

Browse files
hkallweitkuba-moo
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7de0eeb commit d0f1107

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

drivers/net/phy/fixed_phy.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include <linux/kernel.h>
1212
#include <linux/module.h>
13-
#include <linux/device/faux.h>
1413
#include <linux/list.h>
1514
#include <linux/mii.h>
1615
#include <linux/phy.h>
@@ -40,7 +39,6 @@ struct fixed_phy {
4039
struct gpio_desc *link_gpiod;
4140
};
4241

43-
static struct faux_device *fdev;
4442
static struct fixed_mdio_bus platform_fmb = {
4543
.phys = LIST_HEAD_INIT(platform_fmb.phys),
4644
};
@@ -317,20 +315,13 @@ static int __init fixed_mdio_bus_init(void)
317315
struct fixed_mdio_bus *fmb = &platform_fmb;
318316
int ret;
319317

320-
fdev = faux_device_create("Fixed MDIO bus", NULL, NULL);
321-
if (!fdev)
322-
return -ENODEV;
323-
324318
fmb->mii_bus = mdiobus_alloc();
325-
if (fmb->mii_bus == NULL) {
326-
ret = -ENOMEM;
327-
goto err_mdiobus_reg;
328-
}
319+
if (!fmb->mii_bus)
320+
return -ENOMEM;
329321

330322
snprintf(fmb->mii_bus->id, MII_BUS_ID_SIZE, "fixed-0");
331323
fmb->mii_bus->name = "Fixed MDIO Bus";
332324
fmb->mii_bus->priv = fmb;
333-
fmb->mii_bus->parent = &fdev->dev;
334325
fmb->mii_bus->read = &fixed_mdio_read;
335326
fmb->mii_bus->write = &fixed_mdio_write;
336327
fmb->mii_bus->phy_mask = ~0;
@@ -343,8 +334,6 @@ static int __init fixed_mdio_bus_init(void)
343334

344335
err_mdiobus_alloc:
345336
mdiobus_free(fmb->mii_bus);
346-
err_mdiobus_reg:
347-
faux_device_destroy(fdev);
348337
return ret;
349338
}
350339
module_init(fixed_mdio_bus_init);
@@ -356,7 +345,6 @@ static void __exit fixed_mdio_bus_exit(void)
356345

357346
mdiobus_unregister(fmb->mii_bus);
358347
mdiobus_free(fmb->mii_bus);
359-
faux_device_destroy(fdev);
360348

361349
list_for_each_entry_safe(fp, tmp, &fmb->phys, node) {
362350
list_del(&fp->node);

0 commit comments

Comments
 (0)