summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-03-22 10:47:24 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-22 10:47:24 -0800
commit2152f8536668a957ea3214735b4761e7b22ef7d8 (patch)
tree56723fc51445b1bc930c6400d4c00fd6fc831f88 /drivers/scsi/sg.c
parent7cae7e26f245151b9ccad868bf2edf8c8048d307 (diff)
parent30afc84cf7325e88fb9746340eba3c161080ff49 (diff)
downloadlinux-2152f8536668a957ea3214735b4761e7b22ef7d8.tar.gz
linux-2152f8536668a957ea3214735b4761e7b22ef7d8.tar.bz2
linux-2152f8536668a957ea3214735b4761e7b22ef7d8.zip
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (138 commits) [SCSI] libata: implement minimal transport template for ->eh_timed_out [SCSI] eliminate rphy allocation in favour of expander/end device allocation [SCSI] convert mptsas over to end_device/expander allocations [SCSI] allow displaying and setting of cache type via sysfs [SCSI] add scsi_mode_select to scsi_lib.c [SCSI] 3ware 9000 add big endian support [SCSI] qla2xxx: update MAINTAINERS [SCSI] scsi: move target_destroy call [SCSI] fusion - bump version [SCSI] fusion - expander hotplug suport in mptsas module [SCSI] fusion - exposing raid components in mptsas [SCSI] fusion - memory leak, and initializing fields [SCSI] fusion - exclosure misspelled [SCSI] fusion - cleanup mptsas event handling functions [SCSI] fusion - removing target_id/bus_id from the VirtDevice structure [SCSI] fusion - static fix's [SCSI] fusion - move some debug firmware event debug msgs to verbose level [SCSI] fusion - loginfo header update [SCSI] add scsi_reprobe_device [SCSI] megaraid_sas: fix extended timeout handling ...
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 0e0ca8fc7318..7405d0df95db 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -44,7 +44,6 @@ static int sg_version_num = 30533; /* 2 digits for each component */
#include <linux/poll.h>
#include <linux/smp_lock.h>
#include <linux/moduleparam.h>
-#include <linux/devfs_fs_kernel.h>
#include <linux/cdev.h>
#include <linux/seq_file.h>
#include <linux/blkdev.h>
@@ -1332,7 +1331,7 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
void *old_sg_dev_arr = NULL;
int k, error;
- sdp = kmalloc(sizeof(Sg_device), GFP_KERNEL);
+ sdp = kzalloc(sizeof(Sg_device), GFP_KERNEL);
if (!sdp) {
printk(KERN_WARNING "kmalloc Sg_device failure\n");
return -ENOMEM;
@@ -1344,12 +1343,11 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
int tmp_dev_max = sg_nr_dev + SG_DEV_ARR_LUMP;
write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
- tmp_da = kmalloc(tmp_dev_max * sizeof(Sg_device *), GFP_KERNEL);
+ tmp_da = kzalloc(tmp_dev_max * sizeof(Sg_device *), GFP_KERNEL);
if (unlikely(!tmp_da))
goto expand_failed;
write_lock_irqsave(&sg_dev_arr_lock, iflags);
- memset(tmp_da, 0, tmp_dev_max * sizeof(Sg_device *));
memcpy(tmp_da, sg_dev_arr, sg_dev_max * sizeof(Sg_device *));
old_sg_dev_arr = sg_dev_arr;
sg_dev_arr = tmp_da;
@@ -1362,7 +1360,6 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
if (unlikely(k >= SG_MAX_DEVS))
goto overflow;
- memset(sdp, 0, sizeof(*sdp));
SCSI_LOG_TIMEOUT(3, printk("sg_alloc: dev=%d \n", k));
sprintf(disk->disk_name, "sg%d", k);
disk->first_minor = k;
@@ -1429,14 +1426,10 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
k = error;
sdp = sg_dev_arr[k];
- devfs_mk_cdev(MKDEV(SCSI_GENERIC_MAJOR, k),
- S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP,
- "%s/generic", scsidp->devfs_name);
error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, k), 1);
- if (error) {
- devfs_remove("%s/generic", scsidp->devfs_name);
+ if (error)
goto out;
- }
+
sdp->cdev = cdev;
if (sg_sysfs_valid) {
struct class_device * sg_class_member;
@@ -1526,7 +1519,6 @@ sg_remove(struct class_device *cl_dev, struct class_interface *cl_intf)
class_device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, k));
cdev_del(sdp->cdev);
sdp->cdev = NULL;
- devfs_remove("%s/generic", scsidp->devfs_name);
put_disk(sdp->disk);
sdp->disk = NULL;
if (NULL == sdp->headfp)
@@ -1548,6 +1540,7 @@ MODULE_AUTHOR("Douglas Gilbert");
MODULE_DESCRIPTION("SCSI generic (sg) driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(SG_VERSION_STR);
+MODULE_ALIAS_CHARDEV_MAJOR(SCSI_GENERIC_MAJOR);
MODULE_PARM_DESC(def_reserved_size, "size of buffer reserved for each fd");
MODULE_PARM_DESC(allow_dio, "allow direct I/O (default: 0 (disallow))");
@@ -2943,4 +2936,3 @@ static int sg_proc_seq_show_debug(struct seq_file *s, void *v)
module_init(init_sg);
module_exit(exit_sg);
-MODULE_ALIAS_CHARDEV_MAJOR(SCSI_GENERIC_MAJOR);