aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/osst.c1
-rw-r--r--drivers/scsi/scsi_sysfs.c23
-rw-r--r--drivers/scsi/sd.c3
-rw-r--r--drivers/scsi/sr.c2
-rw-r--r--drivers/scsi/st.c1
-rw-r--r--include/scsi/scsi.h1
-rw-r--r--include/scsi/scsi_device.h5
7 files changed, 36 insertions, 0 deletions
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index a967fadb7439..08060fb478b6 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -87,6 +87,7 @@ MODULE_AUTHOR("Willem Riede");
87MODULE_DESCRIPTION("OnStream {DI-|FW-|SC-|USB}{30|50} Tape Driver"); 87MODULE_DESCRIPTION("OnStream {DI-|FW-|SC-|USB}{30|50} Tape Driver");
88MODULE_LICENSE("GPL"); 88MODULE_LICENSE("GPL");
89MODULE_ALIAS_CHARDEV_MAJOR(OSST_MAJOR); 89MODULE_ALIAS_CHARDEV_MAJOR(OSST_MAJOR);
90MODULE_ALIAS_SCSI_DEVICE(TYPE_TAPE);
90 91
91module_param(max_dev, int, 0444); 92module_param(max_dev, int, 0444);
92MODULE_PARM_DESC(max_dev, "Maximum number of OnStream Tape Drives to attach (4)"); 93MODULE_PARM_DESC(max_dev, "Maximum number of OnStream Tape Drives to attach (4)");
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 96db51c40ef3..5326f5cbeae9 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -276,6 +276,19 @@ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
276 return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0; 276 return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
277} 277}
278 278
279static int scsi_bus_uevent(struct device *dev, char **envp, int num_envp,
280 char *buffer, int buffer_size)
281{
282 struct scsi_device *sdev = to_scsi_device(dev);
283 int i = 0;
284 int length = 0;
285
286 add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
287 "MODALIAS=" SCSI_DEVICE_MODALIAS_FMT, sdev->type);
288 envp[i] = NULL;
289 return 0;
290}
291
279static int scsi_bus_suspend(struct device * dev, pm_message_t state) 292static int scsi_bus_suspend(struct device * dev, pm_message_t state)
280{ 293{
281 struct device_driver *drv = dev->driver; 294 struct device_driver *drv = dev->driver;
@@ -331,6 +344,7 @@ static int scsi_bus_resume(struct device * dev)
331struct bus_type scsi_bus_type = { 344struct bus_type scsi_bus_type = {
332 .name = "scsi", 345 .name = "scsi",
333 .match = scsi_bus_match, 346 .match = scsi_bus_match,
347 .uevent = scsi_bus_uevent,
334 .suspend = scsi_bus_suspend, 348 .suspend = scsi_bus_suspend,
335 .resume = scsi_bus_resume, 349 .resume = scsi_bus_resume,
336}; 350};
@@ -558,6 +572,14 @@ show_sdev_iostat(iorequest_cnt);
558show_sdev_iostat(iodone_cnt); 572show_sdev_iostat(iodone_cnt);
559show_sdev_iostat(ioerr_cnt); 573show_sdev_iostat(ioerr_cnt);
560 574
575static ssize_t
576sdev_show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
577{
578 struct scsi_device *sdev;
579 sdev = to_scsi_device(dev);
580 return snprintf (buf, 20, SCSI_DEVICE_MODALIAS_FMT "\n", sdev->type);
581}
582static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL);
561 583
562/* Default template for device attributes. May NOT be modified */ 584/* Default template for device attributes. May NOT be modified */
563static struct device_attribute *scsi_sysfs_sdev_attrs[] = { 585static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
@@ -577,6 +599,7 @@ static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
577 &dev_attr_iorequest_cnt, 599 &dev_attr_iorequest_cnt,
578 &dev_attr_iodone_cnt, 600 &dev_attr_iodone_cnt,
579 &dev_attr_ioerr_cnt, 601 &dev_attr_ioerr_cnt,
602 &dev_attr_modalias,
580 NULL 603 NULL
581}; 604};
582 605
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index b044dcf73427..00e46662296f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -82,6 +82,9 @@ MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK12_MAJOR);
82MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK13_MAJOR); 82MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK13_MAJOR);
83MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK14_MAJOR); 83MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK14_MAJOR);
84MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK15_MAJOR); 84MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK15_MAJOR);
85MODULE_ALIAS_SCSI_DEVICE(TYPE_DISK);
86MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD);
87MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);
85 88
86static DEFINE_IDR(sd_index_idr); 89static DEFINE_IDR(sd_index_idr);
87static DEFINE_SPINLOCK(sd_index_lock); 90static DEFINE_SPINLOCK(sd_index_lock);
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 1857d68e7195..f9a52af7f5b4 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -62,6 +62,8 @@
62MODULE_DESCRIPTION("SCSI cdrom (sr) driver"); 62MODULE_DESCRIPTION("SCSI cdrom (sr) driver");
63MODULE_LICENSE("GPL"); 63MODULE_LICENSE("GPL");
64MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR); 64MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR);
65MODULE_ALIAS_SCSI_DEVICE(TYPE_ROM);
66MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);
65 67
66#define SR_DISKS 256 68#define SR_DISKS 256
67 69
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 98d8411bbccc..55bfeccf68a2 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -89,6 +89,7 @@ MODULE_AUTHOR("Kai Makisara");
89MODULE_DESCRIPTION("SCSI tape (st) driver"); 89MODULE_DESCRIPTION("SCSI tape (st) driver");
90MODULE_LICENSE("GPL"); 90MODULE_LICENSE("GPL");
91MODULE_ALIAS_CHARDEV_MAJOR(SCSI_TAPE_MAJOR); 91MODULE_ALIAS_CHARDEV_MAJOR(SCSI_TAPE_MAJOR);
92MODULE_ALIAS_SCSI_DEVICE(TYPE_TAPE);
92 93
93/* Set 'perm' (4th argument) to 0 to disable module_param's definition 94/* Set 'perm' (4th argument) to 0 to disable module_param's definition
94 * of sysfs parameters (which module_param doesn't yet support). 95 * of sysfs parameters (which module_param doesn't yet support).
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 5c0e9791441c..9f8f80ab0c8b 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -203,6 +203,7 @@ static inline int scsi_status_is_good(int status)
203 203
204/* 204/*
205 * DEVICE TYPES 205 * DEVICE TYPES
206 * Please keep them in 0x%02x format for $MODALIAS to work
206 */ 207 */
207 208
208#define TYPE_DISK 0x00 209#define TYPE_DISK 0x00
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index b05cd3b09e6e..2f3c5b8b1d6a 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -358,4 +358,9 @@ static inline int scsi_device_qas(struct scsi_device *sdev)
358 return 0; 358 return 0;
359 return sdev->inquiry[56] & 0x02; 359 return sdev->inquiry[56] & 0x02;
360} 360}
361
362#define MODULE_ALIAS_SCSI_DEVICE(type) \
363 MODULE_ALIAS("scsi:t-" __stringify(type) "*")
364#define SCSI_DEVICE_MODALIAS_FMT "scsi:t-0x%02x"
365
361#endif /* _SCSI_SCSI_DEVICE_H */ 366#endif /* _SCSI_SCSI_DEVICE_H */