Skip to contentSkip to conversation

$MODALIAS and platform_bus ...

DISCUSSION David Brownell 2 participants 3 messages Jun 16, 2005

lore
Share & tools
lore
#0 lore raw

Has anyone done anything to make sure platform_bus devices can use this new $MODALIAS infrastructure? I was looking at the implications for "coldplug" processing, and there's a hole where platform device support would go.

As a reminder, those devices don't do driver binding quite the normal way. They more or less use the rule that the driver name and device name must match (modulo optional numeric suffix on the device). System-on-Chip processors use platform_bus for most of the on-chip peripherals ... potentially dozens of them, but any given board probably won't wire them all up.

So given a /sys/devices/platform/$NAME/. there are a few things standing in the way of automatically initializing those devices:

- No /sys/devices/platform/$NAME/modalias
- No MODULE_ALIAS(...) in the driver module

Now the former would seem easy to provide, or even eliminate the requirement for it ... the "modalias" will either be $NAME or $NAME less a prefix such as ".1" or ".2". Or, it should be trivial to have linux/drivers/bus/platform.c create it.

The latter would seem just a bit trickier, since it couldn't be driven using linux/scripts/mod/file2alias.c because that relies on a non-existent module device table. Drivers could explicitly write MODULE_ALIAS if their module name didn't already match that convention, but that could be quite a lot of drivers to change.

Comments?

- Dave

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 4 lines · David Brownell

Has anyone done anything to make sure platform_bus devices can use this new $MODALIAS infrastructure? I was looking at the implications for "coldplug" processing, and there's a hole where platform device support would go.

I didn't think platform devices had any hotplug or "coldplug" type support today anyway.

Quoted 11 lines

So given a /sys/devices/platform/$NAME/. there are a few things standing in the way of automatically initializing those devices:

- No /sys/devices/platform/$NAME/modalias
- No MODULE_ALIAS(...) in the driver module

Now the former would seem easy to provide, or even eliminate the requirement for it ... the "modalias" will either be $NAME or $NAME less a prefix such as ".1" or ".2". Or, it should be trivial to have linux/drivers/bus/platform.c create it.

Quoted 6 lines

The latter would seem just a bit trickier, since it couldn't be driven using linux/scripts/mod/file2alias.c because that relies on a non-existent module device table. Drivers could explicitly write MODULE_ALIAS if their module name didn't already match that convention, but that could be quite a lot of drivers to change.

I think just makeing sure the module name matched the $NAME in sysfs, would allow the modalias stuff to work without changing any drivers.

But odds are, modules support more than one platform device right? If so, they are going to have to be changed to use MODULE_ALIAS().

thanks,

greg k-h

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to David Brownell
Quoted 8 lines · Greg KH
Quoted 4 lines · David Brownell

Has anyone done anything to make sure platform_bus devices can use this new $MODALIAS infrastructure? I was looking at the implications for "coldplug" processing, and there's a hole where platform device support would go.

I didn't think platform devices had any hotplug or "coldplug" type support today anyway.

Exactly. I'm still looking at having buildroot populate things completely ... though this issue is not specific to buildroot.

As a rule, "hotplug" support for platform devices is pointless; they should get created as part of board-specific setup, shortly before drivers start to initialize, rather than being dynamically created later on. So "coldplug" is the most relevant setup mode for modular platform device drivers, except maybe in initramfs.

(There are also some strange driver modules, basically bad/early conversions from 2.4 code, which don't just provide the driver but also create its device node. I call those bugs; and in any case they can't be hotplugged OR coldplugged.)

Quoted 10 lines
Quoted 7 lines

So given a /sys/devices/platform/$NAME/. there are a few things standing in the way of automatically initializing those devices:

- No /sys/devices/platform/$NAME/modalias
- No MODULE_ALIAS(...) in the driver module

...

I think just makeing sure the module name matched the $NAME in sysfs, would allow the modalias stuff to work without changing any drivers.

Easier said than done ... they don't always do it, and there's also the issue of "foo.1", "foo.2", "foo.3" and so on.

I'd been thinking about aliasing them in /etc/modprobe.conf ... it'd be fine for embedded systems, but less good in general. Then the startup script in /etc/init.d/S00coldplug (that's where buildroot puts them, no LSB here!) could cd /sys/devices/platform and modprobe each $NAME.

Quoted 2 lines

But odds are, modules support more than one platform device right? If so, they are going to have to be changed to use MODULE_ALIAS().

In the SOC example, it varies. There's usually only one USB controller per type per chip, so for example MODULE_ALIAS("ohci") would let the OMAP chips "modprobe $NAME" to load "ohci-hcd"; "omap_udc" is OK now. Likewise MODULE_ALIAS("at91rm9200-ohci") and "at91_udc".

But other controllers work differently, like MMC/SD. $NAME can be one or both of "mmci-omap.1" and "mmci-omap.2". Does the aliasing stuff work generically enough that MODULE_ALIAS("mmci-omap.*") could solve that problem?

- Dave

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel