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

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: Geert Uytterhoeven <geert@linux-m68k.org>

+8 -7
+6 -5
drivers/zorro/zorro-driver.c
··· 161 161 } 162 162 163 163 struct bus_type zorro_bus_type = { 164 - .name = "zorro", 165 - .match = zorro_bus_match, 166 - .uevent = zorro_uevent, 167 - .probe = zorro_device_probe, 168 - .remove = zorro_device_remove, 164 + .name = "zorro", 165 + .dev_name = "zorro", 166 + .match = zorro_bus_match, 167 + .uevent = zorro_uevent, 168 + .probe = zorro_device_probe, 169 + .remove = zorro_device_remove, 169 170 }; 170 171 EXPORT_SYMBOL(zorro_bus_type); 171 172
+2 -2
drivers/zorro/zorro.c
··· 142 142 143 143 zorro_autocon = bus->devices; 144 144 bus->dev.parent = &pdev->dev; 145 - dev_set_name(&bus->dev, "zorro"); 145 + dev_set_name(&bus->dev, zorro_bus_type.name); 146 146 error = device_register(&bus->dev); 147 147 if (error) { 148 148 pr_err("Zorro: Error registering zorro_bus\n"); ··· 180 180 dev_err(&bus->dev, 181 181 "Address space collision on device %s %pR\n", 182 182 z->name, &z->resource); 183 - dev_set_name(&z->dev, "%02x", i); 184 183 z->dev.parent = &bus->dev; 185 184 z->dev.bus = &zorro_bus_type; 185 + z->dev.id = i; 186 186 } 187 187 188 188 /* ... then register them */