aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2013-10-16 05:28:54 -0400
committerGeert Uytterhoeven <geert@linux-m68k.org>2013-11-26 05:09:06 -0500
commit83b7bce3d390f15047e05a186bb4051536ee9dbc (patch)
tree651419d2486f0add87182dbdf50060a1f497dc59 /drivers
parent52182c758f7c9bc34dbee0dfdce13d356de50f03 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/zorro/zorro-driver.c11
-rw-r--r--drivers/zorro/zorro.c4
2 files changed, 8 insertions, 7 deletions
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c
index ac1db7f1bcab..eacae1434b73 100644
--- a/drivers/zorro/zorro-driver.c
+++ b/drivers/zorro/zorro-driver.c
@@ -161,11 +161,12 @@ static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
161} 161}
162 162
163struct bus_type zorro_bus_type = { 163struct bus_type zorro_bus_type = {
164 .name = "zorro", 164 .name = "zorro",
165 .match = zorro_bus_match, 165 .dev_name = "zorro",
166 .uevent = zorro_uevent, 166 .match = zorro_bus_match,
167 .probe = zorro_device_probe, 167 .uevent = zorro_uevent,
168 .remove = zorro_device_remove, 168 .probe = zorro_device_probe,
169 .remove = zorro_device_remove,
169}; 170};
170EXPORT_SYMBOL(zorro_bus_type); 171EXPORT_SYMBOL(zorro_bus_type);
171 172
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index 10c7f77aec08..450abf100f06 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -142,7 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
142 142
143 zorro_autocon = bus->devices; 143 zorro_autocon = bus->devices;
144 bus->dev.parent = &pdev->dev; 144 bus->dev.parent = &pdev->dev;
145 dev_set_name(&bus->dev, "zorro"); 145 dev_set_name(&bus->dev, zorro_bus_type.name);
146 error = device_register(&bus->dev); 146 error = device_register(&bus->dev);
147 if (error) { 147 if (error) {
148 pr_err("Zorro: Error registering zorro_bus\n"); 148 pr_err("Zorro: Error registering zorro_bus\n");
@@ -180,9 +180,9 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
180 dev_err(&bus->dev, 180 dev_err(&bus->dev,
181 "Address space collision on device %s %pR\n", 181 "Address space collision on device %s %pR\n",
182 z->name, &z->resource); 182 z->name, &z->resource);
183 dev_set_name(&z->dev, "%02x", i);
184 z->dev.parent = &bus->dev; 183 z->dev.parent = &bus->dev;
185 z->dev.bus = &zorro_bus_type; 184 z->dev.bus = &zorro_bus_type;
185 z->dev.id = i;
186 } 186 }
187 187
188 /* ... then register them */ 188 /* ... then register them */