From foo@baz Tue Apr 9 12:12:43 2002 To: Greg KH Date: 23 Mar 2005 09:55:22 -08:00 From: gregkh@suse.de Subject: class: convert drivers/scsi/* to use the new class api instead of class_simple Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/osst.c | 10 +++++----- drivers/scsi/sg.c | 14 +++++++------- drivers/scsi/st.c | 28 +++++++++++++++------------- 3 files changed, 27 insertions(+), 25 deletions(-) --- gregkh-2.6.orig/drivers/scsi/osst.c 2005-05-05 22:12:31.000000000 -0700 +++ gregkh-2.6/drivers/scsi/osst.c 2005-05-05 22:14:09.000000000 -0700 @@ -5608,13 +5608,13 @@ CLASS_DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL); -static struct class_simple * osst_sysfs_class; +static struct class *osst_sysfs_class; static int osst_sysfs_valid = 0; static void osst_sysfs_init(void) { - osst_sysfs_class = class_simple_create(THIS_MODULE, "onstream_tape"); + osst_sysfs_class = class_create(THIS_MODULE, "onstream_tape"); if ( IS_ERR(osst_sysfs_class) ) printk(KERN_WARNING "osst :W: Unable to register sysfs class\n"); else @@ -5627,7 +5627,7 @@ if (!osst_sysfs_valid) return; - osst_class_member = class_simple_device_add(osst_sysfs_class, dev, device, "%s", name); + osst_class_member = class_device_create(osst_sysfs_class, dev, device, "%s", name); if (IS_ERR(osst_class_member)) { printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); return; @@ -5645,13 +5645,13 @@ { if (!osst_sysfs_valid) return; - class_simple_device_remove(dev); + class_device_destroy(osst_sysfs_class, dev); } static void osst_sysfs_cleanup(void) { if (osst_sysfs_valid) { - class_simple_destroy(osst_sysfs_class); + class_destroy(osst_sysfs_class); osst_sysfs_valid = 0; } } --- gregkh-2.6.orig/drivers/scsi/sg.c 2005-05-05 22:12:31.000000000 -0700 +++ gregkh-2.6/drivers/scsi/sg.c 2005-05-05 22:14:09.000000000 -0700 @@ -1430,7 +1430,7 @@ .fasync = sg_fasync, }; -static struct class_simple * sg_sysfs_class; +static struct class *sg_sysfs_class; static int sg_sysfs_valid = 0; @@ -1551,13 +1551,13 @@ if (sg_sysfs_valid) { struct class_device * sg_class_member; - sg_class_member = class_simple_device_add(sg_sysfs_class, + sg_class_member = class_device_create(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, k), cl_dev->dev, "%s", disk->disk_name); if (IS_ERR(sg_class_member)) printk(KERN_WARNING "sg_add: " - "class_simple_device_add failed\n"); + "class_device_create failed\n"); class_set_devdata(sg_class_member, sdp); error = sysfs_create_link(&scsidp->sdev_gendev.kobj, &sg_class_member->kobj, "generic"); @@ -1636,7 +1636,7 @@ if (sdp) { sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); - class_simple_device_remove(MKDEV(SCSI_GENERIC_MAJOR, k)); + 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); @@ -1677,7 +1677,7 @@ SG_MAX_DEVS, "sg"); if (rc) return rc; - sg_sysfs_class = class_simple_create(THIS_MODULE, "scsi_generic"); + sg_sysfs_class = class_create(THIS_MODULE, "scsi_generic"); if ( IS_ERR(sg_sysfs_class) ) { rc = PTR_ERR(sg_sysfs_class); goto err_out; @@ -1690,7 +1690,7 @@ #endif /* CONFIG_SCSI_PROC_FS */ return 0; } - class_simple_destroy(sg_sysfs_class); + class_destroy(sg_sysfs_class); err_out: unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), SG_MAX_DEVS); return rc; @@ -1703,7 +1703,7 @@ sg_proc_cleanup(); #endif /* CONFIG_SCSI_PROC_FS */ scsi_unregister_interface(&sg_interface); - class_simple_destroy(sg_sysfs_class); + class_destroy(sg_sysfs_class); sg_sysfs_valid = 0; unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), SG_MAX_DEVS); --- gregkh-2.6.orig/drivers/scsi/st.c 2005-05-05 22:12:31.000000000 -0700 +++ gregkh-2.6/drivers/scsi/st.c 2005-05-05 22:14:09.000000000 -0700 @@ -82,7 +82,7 @@ static int st_dev_max; static int st_nr_dev; -static struct class_simple *st_sysfs_class; +static struct class *st_sysfs_class; MODULE_AUTHOR("Kai Makisara"); MODULE_DESCRIPTION("SCSI Tape Driver"); @@ -4017,8 +4017,9 @@ if (STm->cdevs[j]) { if (cdev == STm->cdevs[j]) cdev = NULL; - class_simple_device_remove(MKDEV(SCSI_TAPE_MAJOR, - TAPE_MINOR(i, mode, j))); + class_device_destroy(st_sysfs_class, + MKDEV(SCSI_TAPE_MAJOR, + TAPE_MINOR(i, mode, j))); cdev_del(STm->cdevs[j]); } } @@ -4061,8 +4062,9 @@ devfs_remove("%s/mt%s", SDp->devfs_name, st_formats[j]); devfs_remove("%s/mt%sn", SDp->devfs_name, st_formats[j]); for (j=0; j < 2; j++) { - class_simple_device_remove(MKDEV(SCSI_TAPE_MAJOR, - TAPE_MINOR(i, mode, j))); + class_device_destroy(st_sysfs_class, + MKDEV(SCSI_TAPE_MAJOR, + TAPE_MINOR(i, mode, j))); cdev_del(tpnt->modes[mode].cdevs[j]); tpnt->modes[mode].cdevs[j] = NULL; } @@ -4127,7 +4129,7 @@ "st: Version %s, fixed bufsize %d, s/g segs %d\n", verstr, st_fixed_buffer_size, st_max_sg_segs); - st_sysfs_class = class_simple_create(THIS_MODULE, "scsi_tape"); + st_sysfs_class = class_create(THIS_MODULE, "scsi_tape"); if (IS_ERR(st_sysfs_class)) { st_sysfs_class = NULL; printk(KERN_ERR "Unable create sysfs class for SCSI tapes\n"); @@ -4141,7 +4143,7 @@ return 0; } if (st_sysfs_class) - class_simple_destroy(st_sysfs_class); + class_destroy(st_sysfs_class); unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0), ST_MAX_TAPE_ENTRIES); @@ -4154,7 +4156,7 @@ static void __exit exit_st(void) { if (st_sysfs_class) - class_simple_destroy(st_sysfs_class); + class_destroy(st_sysfs_class); st_sysfs_class = NULL; do_remove_driverfs_files(); scsi_unregister_driver(&st_template.gendrv); @@ -4277,12 +4279,12 @@ snprintf(name, 10, "%s%s%s", rew ? "n" : "", STp->disk->disk_name, st_formats[i]); st_class_member = - class_simple_device_add(st_sysfs_class, - MKDEV(SCSI_TAPE_MAJOR, - TAPE_MINOR(dev_num, mode, rew)), - &STp->device->sdev_gendev, "%s", name); + class_device_create(st_sysfs_class, + MKDEV(SCSI_TAPE_MAJOR, + TAPE_MINOR(dev_num, mode, rew)), + &STp->device->sdev_gendev, "%s", name); if (IS_ERR(st_class_member)) { - printk(KERN_WARNING "st%d: class_simple_device_add failed\n", + printk(KERN_WARNING "st%d: class_device_create failed\n", dev_num); goto out; }