X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Fscsi_proc.c;h=bb6f051beda82b569a611d330df99c7042be22f0;hb=57399ec9077a4b962b81037aaa279fab52f5e989;hp=07be62bbaaeac049a37cfa82aefad75d877de14d;hpb=cf41f8ac386e8d62122e7e394b4c6b3e3ab30ede;p=linux-2.6 diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index 07be62bbaa..bb6f051bed 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c @@ -178,12 +178,9 @@ static int proc_print_scsidevice(struct device *dev, void *data) seq_printf(s, "\n"); - seq_printf(s, " Type: %s ", - sdev->type < MAX_SCSI_DEVICE_CODE ? - scsi_device_types[(int) sdev->type] : "Unknown "); - seq_printf(s, " ANSI" - " SCSI revision: %02x", (sdev->scsi_level - 1) ? - sdev->scsi_level - 1 : 1); + seq_printf(s, " Type: %s ", scsi_device_type(sdev->type)); + seq_printf(s, " ANSI SCSI revision: %02x", + sdev->scsi_level - (sdev->scsi_level > 1)); if (sdev->scsi_level == 2) seq_printf(s, " CCS\n"); else @@ -266,8 +263,6 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf, lun = simple_strtoul(p + 1, &p, 0); err = scsi_add_single_device(host, channel, id, lun); - if (err >= 0) - err = length; /* * Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi @@ -284,6 +279,13 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf, err = scsi_remove_single_device(host, channel, id, lun); } + /* + * convert success returns so that we return the + * number of bytes consumed. + */ + if (!err) + err = length; + out: free_page((unsigned long)buffer); return err; @@ -305,7 +307,7 @@ static int proc_scsi_open(struct inode *inode, struct file *file) return single_open(file, proc_scsi_show, NULL); } -static struct file_operations proc_scsi_operations = { +static const struct file_operations proc_scsi_operations = { .open = proc_scsi_open, .read = seq_read, .write = proc_scsi_write,