Commit 83b7bce3 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

zorro: Let the driver core handle device enumeration

Filling in dev_name of the Zorro bus type and dev.id of each device allows
the driver core to enumerate devices, so we don't have to do that
ourselves.

This changes the names of devices in sysfs from "%02x" to "zorro%u".

Note that filling in dev.id is also needed to support MFD Zorro devices.
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent 52182c75
...@@ -161,11 +161,12 @@ static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -161,11 +161,12 @@ static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
} }
struct bus_type zorro_bus_type = { struct bus_type zorro_bus_type = {
.name = "zorro", .name = "zorro",
.match = zorro_bus_match, .dev_name = "zorro",
.uevent = zorro_uevent, .match = zorro_bus_match,
.probe = zorro_device_probe, .uevent = zorro_uevent,
.remove = zorro_device_remove, .probe = zorro_device_probe,
.remove = zorro_device_remove,
}; };
EXPORT_SYMBOL(zorro_bus_type); EXPORT_SYMBOL(zorro_bus_type);
......
...@@ -142,7 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev) ...@@ -142,7 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
zorro_autocon = bus->devices; zorro_autocon = bus->devices;
bus->dev.parent = &pdev->dev; bus->dev.parent = &pdev->dev;
dev_set_name(&bus->dev, "zorro"); dev_set_name(&bus->dev, zorro_bus_type.name);
error = device_register(&bus->dev); error = device_register(&bus->dev);
if (error) { if (error) {
pr_err("Zorro: Error registering zorro_bus\n"); pr_err("Zorro: Error registering zorro_bus\n");
...@@ -180,9 +180,9 @@ static int __init amiga_zorro_probe(struct platform_device *pdev) ...@@ -180,9 +180,9 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
dev_err(&bus->dev, dev_err(&bus->dev,
"Address space collision on device %s %pR\n", "Address space collision on device %s %pR\n",
z->name, &z->resource); z->name, &z->resource);
dev_set_name(&z->dev, "%02x", i);
z->dev.parent = &bus->dev; z->dev.parent = &bus->dev;
z->dev.bus = &zorro_bus_type; z->dev.bus = &zorro_bus_type;
z->dev.id = i;
} }
/* ... then register them */ /* ... then register them */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment