aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-cd.c1
-rw-r--r--drivers/ide/ide-disk.c1
-rw-r--r--drivers/ide/ide-floppy.c1
-rw-r--r--drivers/ide/ide-tape.c1
-rw-r--r--drivers/ide/ide.c60
5 files changed, 64 insertions, 0 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index b4d7a3efb90f..70aeb3a60120 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -3509,6 +3509,7 @@ static int __init ide_cdrom_init(void)
3509 return driver_register(&ide_cdrom_driver.gen_driver); 3509 return driver_register(&ide_cdrom_driver.gen_driver);
3510} 3510}
3511 3511
3512MODULE_ALIAS("ide:*m-cdrom*");
3512module_init(ide_cdrom_init); 3513module_init(ide_cdrom_init);
3513module_exit(ide_cdrom_exit); 3514module_exit(ide_cdrom_exit);
3514MODULE_LICENSE("GPL"); 3515MODULE_LICENSE("GPL");
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 449522f0540c..4e5767968d7f 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -1271,6 +1271,7 @@ static int __init idedisk_init(void)
1271 return driver_register(&idedisk_driver.gen_driver); 1271 return driver_register(&idedisk_driver.gen_driver);
1272} 1272}
1273 1273
1274MODULE_ALIAS("ide:*m-disk*");
1274module_init(idedisk_init); 1275module_init(idedisk_init);
1275module_exit(idedisk_exit); 1276module_exit(idedisk_exit);
1276MODULE_LICENSE("GPL"); 1277MODULE_LICENSE("GPL");
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)
2197 return driver_register(&idefloppy_driver.gen_driver); 2197 return driver_register(&idefloppy_driver.gen_driver);
2198} 2198}
2199 2199
2200MODULE_ALIAS("ide:*m-floppy*");
2200module_init(idefloppy_init); 2201module_init(idefloppy_init);
2201module_exit(idefloppy_exit); 2202module_exit(idefloppy_exit);
2202MODULE_LICENSE("GPL"); 2203MODULE_LICENSE("GPL");
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 7d7944ed4158..fab9b2b02504 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -4947,6 +4947,7 @@ out:
4947 return error; 4947 return error;
4948} 4948}
4949 4949
4950MODULE_ALIAS("ide:*m-tape*");
4950module_init(idetape_init); 4951module_init(idetape_init);
4951module_exit(idetape_exit); 4952module_exit(idetape_exit);
4952MODULE_ALIAS_CHARDEV_MAJOR(IDETAPE_MAJOR); 4953MODULE_ALIAS_CHARDEV_MAJOR(IDETAPE_MAJOR);
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 8af179b531c3..4b524f6b3ecd 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1904,9 +1904,69 @@ static int ide_bus_match(struct device *dev, struct device_driver *drv)
1904 return 1; 1904 return 1;
1905} 1905}
1906 1906
1907static char *media_string(ide_drive_t *drive)
1908{
1909 switch (drive->media) {
1910 case ide_disk:
1911 return "disk";
1912 case ide_cdrom:
1913 return "cdrom";
1914 case ide_tape:
1915 return "tape";
1916 case ide_floppy:
1917 return "floppy";
1918 default:
1919 return "UNKNOWN";
1920 }
1921}
1922
1923static ssize_t media_show(struct device *dev, struct device_attribute *attr, char *buf)
1924{
1925 ide_drive_t *drive = to_ide_device(dev);
1926 return sprintf(buf, "%s\n", media_string(drive));
1927}
1928
1929static ssize_t drivename_show(struct device *dev, struct device_attribute *attr, char *buf)
1930{
1931 ide_drive_t *drive = to_ide_device(dev);
1932 return sprintf(buf, "%s\n", drive->name);
1933}
1934
1935static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
1936{
1937 ide_drive_t *drive = to_ide_device(dev);
1938 return sprintf(buf, "ide:m-%s\n", media_string(drive));
1939}
1940
1941static struct device_attribute ide_dev_attrs[] = {
1942 __ATTR_RO(media),
1943 __ATTR_RO(drivename),
1944 __ATTR_RO(modalias),
1945 __ATTR_NULL
1946};
1947
1948static int ide_uevent(struct device *dev, char **envp, int num_envp,
1949 char *buffer, int buffer_size)
1950{
1951 ide_drive_t *drive = to_ide_device(dev);
1952 int i = 0;
1953 int length = 0;
1954
1955 add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
1956 "MEDIA=%s", media_string(drive));
1957 add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
1958 "DRIVENAME=%s", drive->name);
1959 add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
1960 "MODALIAS=ide:m-%s", media_string(drive));
1961 envp[i] = NULL;
1962 return 0;
1963}
1964
1907struct bus_type ide_bus_type = { 1965struct bus_type ide_bus_type = {
1908 .name = "ide", 1966 .name = "ide",
1909 .match = ide_bus_match, 1967 .match = ide_bus_match,
1968 .uevent = ide_uevent,
1969 .dev_attrs = ide_dev_attrs,
1910 .suspend = generic_ide_suspend, 1970 .suspend = generic_ide_suspend,
1911 .resume = generic_ide_resume, 1971 .resume = generic_ide_resume,
1912}; 1972};