diff options
author | Len Brown <len.brown@intel.com> | 2006-01-07 03:50:18 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-01-07 03:50:18 -0500 |
commit | ed03f430cdc8c802652467e9097606fedc2c7abc (patch) | |
tree | 30941ec1e6f93e99358fefe18175e5dd800a4379 /drivers/ide/ide.c | |
parent | ed349a8a0a780ed27e2a765f16cee54d9b63bfee (diff) | |
parent | 6f957eaf79356a32e838f5f262ee9a60544b1d5b (diff) |
Pull pnpacpi into acpica branch
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r-- | drivers/ide/ide.c | 60 |
1 files changed, 60 insertions, 0 deletions
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 | ||
1907 | static 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 | |||
1923 | static 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 | |||
1929 | static 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 | |||
1935 | static 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 | |||
1941 | static struct device_attribute ide_dev_attrs[] = { | ||
1942 | __ATTR_RO(media), | ||
1943 | __ATTR_RO(drivename), | ||
1944 | __ATTR_RO(modalias), | ||
1945 | __ATTR_NULL | ||
1946 | }; | ||
1947 | |||
1948 | static 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 | |||
1907 | struct bus_type ide_bus_type = { | 1965 | struct 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 | }; |