Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53700
b: refs/heads/master
c: d7b8bcb
h: refs/heads/master
v: v3
  • Loading branch information
Michael Tokarev authored and James Bottomley committed Apr 17, 2007
1 parent 3ef7859 commit 2243294
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 44ec95425c1d9dce6e4638c29e4362cfb44814e7
refs/heads/master: d7b8bcb0a0819315a51cae620ff7ae0c1704c069
1 change: 1 addition & 0 deletions trunk/drivers/scsi/osst.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ MODULE_AUTHOR("Willem Riede");
MODULE_DESCRIPTION("OnStream {DI-|FW-|SC-|USB}{30|50} Tape Driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS_CHARDEV_MAJOR(OSST_MAJOR);
MODULE_ALIAS_SCSI_DEVICE(TYPE_TAPE);

module_param(max_dev, int, 0444);
MODULE_PARM_DESC(max_dev, "Maximum number of OnStream Tape Drives to attach (4)");
Expand Down
23 changes: 23 additions & 0 deletions trunk/drivers/scsi/scsi_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,19 @@ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
}

static int scsi_bus_uevent(struct device *dev, char **envp, int num_envp,
char *buffer, int buffer_size)
{
struct scsi_device *sdev = to_scsi_device(dev);
int i = 0;
int length = 0;

add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
"MODALIAS=" SCSI_DEVICE_MODALIAS_FMT, sdev->type);
envp[i] = NULL;
return 0;
}

static int scsi_bus_suspend(struct device * dev, pm_message_t state)
{
struct device_driver *drv = dev->driver;
Expand Down Expand Up @@ -331,6 +344,7 @@ static int scsi_bus_resume(struct device * dev)
struct bus_type scsi_bus_type = {
.name = "scsi",
.match = scsi_bus_match,
.uevent = scsi_bus_uevent,
.suspend = scsi_bus_suspend,
.resume = scsi_bus_resume,
};
Expand Down Expand Up @@ -558,6 +572,14 @@ show_sdev_iostat(iorequest_cnt);
show_sdev_iostat(iodone_cnt);
show_sdev_iostat(ioerr_cnt);

static ssize_t
sdev_show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
{
struct scsi_device *sdev;
sdev = to_scsi_device(dev);
return snprintf (buf, 20, SCSI_DEVICE_MODALIAS_FMT "\n", sdev->type);
}
static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL);

/* Default template for device attributes. May NOT be modified */
static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
Expand All @@ -577,6 +599,7 @@ static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
&dev_attr_iorequest_cnt,
&dev_attr_iodone_cnt,
&dev_attr_ioerr_cnt,
&dev_attr_modalias,
NULL
};

Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK12_MAJOR);
MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK13_MAJOR);
MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK14_MAJOR);
MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK15_MAJOR);
MODULE_ALIAS_SCSI_DEVICE(TYPE_DISK);
MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD);
MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);

static DEFINE_IDR(sd_index_idr);
static DEFINE_SPINLOCK(sd_index_lock);
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/scsi/sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
MODULE_DESCRIPTION("SCSI cdrom (sr) driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR);
MODULE_ALIAS_SCSI_DEVICE(TYPE_ROM);
MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);

#define SR_DISKS 256

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/scsi/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ MODULE_AUTHOR("Kai Makisara");
MODULE_DESCRIPTION("SCSI tape (st) driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS_CHARDEV_MAJOR(SCSI_TAPE_MAJOR);
MODULE_ALIAS_SCSI_DEVICE(TYPE_TAPE);

/* Set 'perm' (4th argument) to 0 to disable module_param's definition
* of sysfs parameters (which module_param doesn't yet support).
Expand Down
1 change: 1 addition & 0 deletions trunk/include/scsi/scsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ static inline int scsi_status_is_good(int status)

/*
* DEVICE TYPES
* Please keep them in 0x%02x format for $MODALIAS to work
*/

#define TYPE_DISK 0x00
Expand Down
5 changes: 5 additions & 0 deletions trunk/include/scsi/scsi_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,9 @@ static inline int scsi_device_qas(struct scsi_device *sdev)
return 0;
return sdev->inquiry[56] & 0x02;
}

#define MODULE_ALIAS_SCSI_DEVICE(type) \
MODULE_ALIAS("scsi:t-" __stringify(type) "*")
#define SCSI_DEVICE_MODALIAS_FMT "scsi:t-0x%02x"

#endif /* _SCSI_SCSI_DEVICE_H */

0 comments on commit 2243294

Please sign in to comment.