Skip to content

Commit 143dcec

Browse files
olafheringLinus Torvalds
authored and
Linus Torvalds
committed
[PATCH] ppc64: add MODALIAS= for vio bus
A non-broken udev would autoload also the drivers for devices on the pseries vio bus, like ibmveth, ibmvscsic and hvsc. This is similar to pci, usb and ieee1394: /lib/modules/`uname -r`/modules.alias alias vio:TvscsiSIBM,v-scsi* ibmvscsic alias vio:TnetworkSIBM,l-lan* ibmveth alias vio:Tserial-serverShvterm2* hvcs /events/debug.00004.pci.add.1394:MODALIAS='pci:v00001014d00000188sv00000000sd00000000bc06sc04i0f' /events/debug.00005.pci.add.1509:MODALIAS='pci:v00008086d00001229sv00001014sd000001FFbc02sc00i00' /events/debug.00026.vio.add.1519:MODALIAS='vio:TserialShvterm1' /events/debug.00027.vio.add.1446:MODALIAS='vio:TvscsiSIBM,v-scsi' /events/debug.00028.vio.add.1451:MODALIAS='vio:TnetworkSIBM,l-lan' modprobe -v vio:TnetworkSIBM,l-lan insmod /lib/modules/2.6.14-20051030_vio-ppc64/kernel/drivers/net/ibmveth.ko Signed-off-by: Olaf Hering <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8827cc7 commit 143dcec

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

arch/powerpc/kernel/vio.c

+27
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <asm/iommu.h>
2222
#include <asm/dma.h>
2323
#include <asm/vio.h>
24+
#include <asm/prom.h>
2425

2526
static const struct vio_device_id *vio_match_device(
2627
const struct vio_device_id *, const struct vio_dev *);
@@ -265,7 +266,33 @@ static int vio_bus_match(struct device *dev, struct device_driver *drv)
265266
return (ids != NULL) && (vio_match_device(ids, vio_dev) != NULL);
266267
}
267268

269+
static int vio_hotplug(struct device *dev, char **envp, int num_envp,
270+
char *buffer, int buffer_size)
271+
{
272+
const struct vio_dev *vio_dev = to_vio_dev(dev);
273+
char *cp;
274+
int length;
275+
276+
if (!num_envp)
277+
return -ENOMEM;
278+
279+
if (!vio_dev->dev.platform_data)
280+
return -ENODEV;
281+
cp = (char *)get_property(vio_dev->dev.platform_data, "compatible", &length);
282+
if (!cp)
283+
return -ENODEV;
284+
285+
envp[0] = buffer;
286+
length = scnprintf(buffer, buffer_size, "MODALIAS=vio:T%sS%s",
287+
vio_dev->type, cp);
288+
if (buffer_size - length <= 0)
289+
return -ENOMEM;
290+
envp[1] = NULL;
291+
return 0;
292+
}
293+
268294
struct bus_type vio_bus_type = {
269295
.name = "vio",
296+
.hotplug = vio_hotplug,
270297
.match = vio_bus_match,
271298
};

0 commit comments

Comments
 (0)