summary refs log tree commit diff
path: root/drivers/ide/ide-floppy.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2005-12-12 18:03:44 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-04 16:18:09 -0800
commit263756ec228f1cdd49fc50b1f87001a4cebdfe12 (patch)
tree502925a94655348a768f25180e49126688100a8d /drivers/ide/ide-floppy.c
parentf743ca5e10f4145e0b3e6d11b9b46171e16af7ce (diff)
downloadlinux-263756ec228f1cdd49fc50b1f87001a4cebdfe12.tar.gz
[PATCH] ide: MODALIAS support for autoloading of ide-cd, ide-disk, ...
IDE: MODALIAS support for autoloading of ide-cd, ide-disk, ...

Add MODULE_ALIAS to IDE midlayer modules: ide-disk, ide-cd, ide-floppy and
ide-tape, to autoload these modules depending on the probed media type of
the IDE device.

It is used by udev and replaces the former agent shell script of the hotplug
package, which was required to lookup the media type in the proc filesystem.
Using proc was racy, cause the media file is created after the hotplug event
is sent out.

The module autoloading does not take any effect, until something like the
following udev rule is configured:
  SUBSYSTEM=="ide",  ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"

The module ide-scsi will not be autoloaded, cause it requires manual
configuration. It can't be, and never was supported for automatic setup in
the hotplug package. Adding a MODULE_ALIAS to ide-scsi for all supported
media types, would just lead to a default blacklist entry anyway.

  $ modinfo ide-disk
  filename:       /lib/modules/2.6.15-rc4-g1b0997f5/kernel/drivers/ide/ide-disk.ko
  description:    ATA DISK Driver
  alias:          ide:*m-disk*
  license:        GPL
  ...

  $ modprobe -vn ide:m-disk
  insmod /lib/modules/2.6.15-rc4-g1b0997f5/kernel/drivers/ide/ide-disk.ko

  $ cat /sys/bus/ide/devices/0.0/modalias
  ide:m-disk

It also adds attributes to the IDE device:
  $ tree /sys/bus/ide/devices/0.0/
  /sys/bus/ide/devices/0.0/
  |-- bus -> ../../../../../../../bus/ide
  |-- drivename
  |-- media
  |-- modalias
  |-- power
  |   |-- state
  |   `-- wakeup
  `-- uevent

  $ cat /sys/bus/ide/devices/0.0/{modalias,drivename,media}
  ide:m-disk
  hda
  disk

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r--drivers/ide/ide-floppy.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 9e293c8063dc..fba3fffc2d66 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -2197,6 +2197,7 @@ static int __init idefloppy_init(void)
 	return driver_register(&idefloppy_driver.gen_driver);
 }
 
+MODULE_ALIAS("ide:*m-floppy*");
 module_init(idefloppy_init);
 module_exit(idefloppy_exit);
 MODULE_LICENSE("GPL");