aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 7936aafc3d05..51292f269ce5 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1430,7 +1430,7 @@ static struct file_operations sg_fops = {
1430 .fasync = sg_fasync, 1430 .fasync = sg_fasync,
1431}; 1431};
1432 1432
1433static struct class_simple * sg_sysfs_class; 1433static struct class *sg_sysfs_class;
1434 1434
1435static int sg_sysfs_valid = 0; 1435static int sg_sysfs_valid = 0;
1436 1436
@@ -1551,13 +1551,13 @@ sg_add(struct class_device *cl_dev)
1551 if (sg_sysfs_valid) { 1551 if (sg_sysfs_valid) {
1552 struct class_device * sg_class_member; 1552 struct class_device * sg_class_member;
1553 1553
1554 sg_class_member = class_simple_device_add(sg_sysfs_class, 1554 sg_class_member = class_device_create(sg_sysfs_class,
1555 MKDEV(SCSI_GENERIC_MAJOR, k), 1555 MKDEV(SCSI_GENERIC_MAJOR, k),
1556 cl_dev->dev, "%s", 1556 cl_dev->dev, "%s",
1557 disk->disk_name); 1557 disk->disk_name);
1558 if (IS_ERR(sg_class_member)) 1558 if (IS_ERR(sg_class_member))
1559 printk(KERN_WARNING "sg_add: " 1559 printk(KERN_WARNING "sg_add: "
1560 "class_simple_device_add failed\n"); 1560 "class_device_create failed\n");
1561 class_set_devdata(sg_class_member, sdp); 1561 class_set_devdata(sg_class_member, sdp);
1562 error = sysfs_create_link(&scsidp->sdev_gendev.kobj, 1562 error = sysfs_create_link(&scsidp->sdev_gendev.kobj,
1563 &sg_class_member->kobj, "generic"); 1563 &sg_class_member->kobj, "generic");
@@ -1636,7 +1636,7 @@ sg_remove(struct class_device *cl_dev)
1636 1636
1637 if (sdp) { 1637 if (sdp) {
1638 sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); 1638 sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic");
1639 class_simple_device_remove(MKDEV(SCSI_GENERIC_MAJOR, k)); 1639 class_device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, k));
1640 cdev_del(sdp->cdev); 1640 cdev_del(sdp->cdev);
1641 sdp->cdev = NULL; 1641 sdp->cdev = NULL;
1642 devfs_remove("%s/generic", scsidp->devfs_name); 1642 devfs_remove("%s/generic", scsidp->devfs_name);
@@ -1677,7 +1677,7 @@ init_sg(void)
1677 SG_MAX_DEVS, "sg"); 1677 SG_MAX_DEVS, "sg");
1678 if (rc) 1678 if (rc)
1679 return rc; 1679 return rc;
1680 sg_sysfs_class = class_simple_create(THIS_MODULE, "scsi_generic"); 1680 sg_sysfs_class = class_create(THIS_MODULE, "scsi_generic");
1681 if ( IS_ERR(sg_sysfs_class) ) { 1681 if ( IS_ERR(sg_sysfs_class) ) {
1682 rc = PTR_ERR(sg_sysfs_class); 1682 rc = PTR_ERR(sg_sysfs_class);
1683 goto err_out; 1683 goto err_out;
@@ -1690,7 +1690,7 @@ init_sg(void)
1690#endif /* CONFIG_SCSI_PROC_FS */ 1690#endif /* CONFIG_SCSI_PROC_FS */
1691 return 0; 1691 return 0;
1692 } 1692 }
1693 class_simple_destroy(sg_sysfs_class); 1693 class_destroy(sg_sysfs_class);
1694err_out: 1694err_out:
1695 unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), SG_MAX_DEVS); 1695 unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), SG_MAX_DEVS);
1696 return rc; 1696 return rc;
@@ -1703,7 +1703,7 @@ exit_sg(void)
1703 sg_proc_cleanup(); 1703 sg_proc_cleanup();
1704#endif /* CONFIG_SCSI_PROC_FS */ 1704#endif /* CONFIG_SCSI_PROC_FS */
1705 scsi_unregister_interface(&sg_interface); 1705 scsi_unregister_interface(&sg_interface);
1706 class_simple_destroy(sg_sysfs_class); 1706 class_destroy(sg_sysfs_class);
1707 sg_sysfs_valid = 0; 1707 sg_sysfs_valid = 0;
1708 unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), 1708 unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0),
1709 SG_MAX_DEVS); 1709 SG_MAX_DEVS);
@@ -2472,6 +2472,8 @@ sg_remove_request(Sg_fd * sfp, Sg_request * srp)
2472 if ((!sfp) || (!srp) || (!sfp->headrp)) 2472 if ((!sfp) || (!srp) || (!sfp->headrp))
2473 return res; 2473 return res;
2474 write_lock_irqsave(&sfp->rq_list_lock, iflags); 2474 write_lock_irqsave(&sfp->rq_list_lock, iflags);
2475 if (srp->my_cmdp)
2476 srp->my_cmdp->upper_private_data = NULL;
2475 prev_rp = sfp->headrp; 2477 prev_rp = sfp->headrp;
2476 if (srp == prev_rp) { 2478 if (srp == prev_rp) {
2477 sfp->headrp = prev_rp->nextrp; 2479 sfp->headrp = prev_rp->nextrp;