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.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index e5156aa6dd20..2029422bc04d 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -101,16 +101,16 @@ static int scatter_elem_sz_prev = SG_SCATTER_SZ;
101#define SG_SECTOR_SZ 512 101#define SG_SECTOR_SZ 512
102#define SG_SECTOR_MSK (SG_SECTOR_SZ - 1) 102#define SG_SECTOR_MSK (SG_SECTOR_SZ - 1)
103 103
104static int sg_add(struct class_device *, struct class_interface *); 104static int sg_add(struct device *, struct class_interface *);
105static void sg_remove(struct class_device *, struct class_interface *); 105static void sg_remove(struct device *, struct class_interface *);
106 106
107static DEFINE_IDR(sg_index_idr); 107static DEFINE_IDR(sg_index_idr);
108static DEFINE_RWLOCK(sg_index_lock); /* Also used to lock 108static DEFINE_RWLOCK(sg_index_lock); /* Also used to lock
109 file descriptor list for device */ 109 file descriptor list for device */
110 110
111static struct class_interface sg_interface = { 111static struct class_interface sg_interface = {
112 .add = sg_add, 112 .add_dev = sg_add,
113 .remove = sg_remove, 113 .remove_dev = sg_remove,
114}; 114};
115 115
116typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */ 116typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */
@@ -1401,9 +1401,9 @@ static Sg_device *sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
1401} 1401}
1402 1402
1403static int 1403static int
1404sg_add(struct class_device *cl_dev, struct class_interface *cl_intf) 1404sg_add(struct device *cl_dev, struct class_interface *cl_intf)
1405{ 1405{
1406 struct scsi_device *scsidp = to_scsi_device(cl_dev->dev); 1406 struct scsi_device *scsidp = to_scsi_device(cl_dev->parent);
1407 struct gendisk *disk; 1407 struct gendisk *disk;
1408 Sg_device *sdp = NULL; 1408 Sg_device *sdp = NULL;
1409 struct cdev * cdev = NULL; 1409 struct cdev * cdev = NULL;
@@ -1439,19 +1439,19 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
1439 1439
1440 sdp->cdev = cdev; 1440 sdp->cdev = cdev;
1441 if (sg_sysfs_valid) { 1441 if (sg_sysfs_valid) {
1442 struct class_device * sg_class_member; 1442 struct device *sg_class_member;
1443 1443
1444 sg_class_member = class_device_create(sg_sysfs_class, NULL, 1444 sg_class_member = device_create(sg_sysfs_class, cl_dev->parent,
1445 MKDEV(SCSI_GENERIC_MAJOR, sdp->index), 1445 MKDEV(SCSI_GENERIC_MAJOR,
1446 cl_dev->dev, "%s", 1446 sdp->index),
1447 disk->disk_name); 1447 "%s", disk->disk_name);
1448 if (IS_ERR(sg_class_member)) { 1448 if (IS_ERR(sg_class_member)) {
1449 printk(KERN_ERR "sg_add: " 1449 printk(KERN_ERR "sg_add: "
1450 "class_device_create failed\n"); 1450 "device_create failed\n");
1451 error = PTR_ERR(sg_class_member); 1451 error = PTR_ERR(sg_class_member);
1452 goto cdev_add_err; 1452 goto cdev_add_err;
1453 } 1453 }
1454 class_set_devdata(sg_class_member, sdp); 1454 dev_set_drvdata(sg_class_member, sdp);
1455 error = sysfs_create_link(&scsidp->sdev_gendev.kobj, 1455 error = sysfs_create_link(&scsidp->sdev_gendev.kobj,
1456 &sg_class_member->kobj, "generic"); 1456 &sg_class_member->kobj, "generic");
1457 if (error) 1457 if (error)
@@ -1464,7 +1464,7 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
1464 "Attached scsi generic sg%d type %d\n", sdp->index, 1464 "Attached scsi generic sg%d type %d\n", sdp->index,
1465 scsidp->type); 1465 scsidp->type);
1466 1466
1467 class_set_devdata(cl_dev, sdp); 1467 dev_set_drvdata(cl_dev, sdp);
1468 1468
1469 return 0; 1469 return 0;
1470 1470
@@ -1482,10 +1482,10 @@ out:
1482} 1482}
1483 1483
1484static void 1484static void
1485sg_remove(struct class_device *cl_dev, struct class_interface *cl_intf) 1485sg_remove(struct device *cl_dev, struct class_interface *cl_intf)
1486{ 1486{
1487 struct scsi_device *scsidp = to_scsi_device(cl_dev->dev); 1487 struct scsi_device *scsidp = to_scsi_device(cl_dev->parent);
1488 Sg_device *sdp = class_get_devdata(cl_dev); 1488 Sg_device *sdp = dev_get_drvdata(cl_dev);
1489 unsigned long iflags; 1489 unsigned long iflags;
1490 Sg_fd *sfp; 1490 Sg_fd *sfp;
1491 Sg_fd *tsfp; 1491 Sg_fd *tsfp;
@@ -1528,7 +1528,7 @@ sg_remove(struct class_device *cl_dev, struct class_interface *cl_intf)
1528 write_unlock_irqrestore(&sg_index_lock, iflags); 1528 write_unlock_irqrestore(&sg_index_lock, iflags);
1529 1529
1530 sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); 1530 sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic");
1531 class_device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index)); 1531 device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index));
1532 cdev_del(sdp->cdev); 1532 cdev_del(sdp->cdev);
1533 sdp->cdev = NULL; 1533 sdp->cdev = NULL;
1534 put_disk(sdp->disk); 1534 put_disk(sdp->disk);