aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/st.c
diff options
context:
space:
mode:
authorTony Jones <tonyj@suse.de>2008-02-21 18:13:36 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:33 -0400
commitee959b00c335d7780136c5abda37809191fe52c3 (patch)
tree7775f3b274fd8caf5e7e5154fea89e96f2babd94 /drivers/scsi/st.c
parent56d110e852b0b1c85ad6c9bfe1cb4473ceb16402 (diff)
SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller... Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r--drivers/scsi/st.c82
1 files changed, 44 insertions, 38 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index df83bea2c620..a860c3a9ae99 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4108,9 +4108,9 @@ out_free_tape:
4108 if (STm->cdevs[j]) { 4108 if (STm->cdevs[j]) {
4109 if (cdev == STm->cdevs[j]) 4109 if (cdev == STm->cdevs[j])
4110 cdev = NULL; 4110 cdev = NULL;
4111 class_device_destroy(st_sysfs_class, 4111 device_destroy(st_sysfs_class,
4112 MKDEV(SCSI_TAPE_MAJOR, 4112 MKDEV(SCSI_TAPE_MAJOR,
4113 TAPE_MINOR(i, mode, j))); 4113 TAPE_MINOR(i, mode, j)));
4114 cdev_del(STm->cdevs[j]); 4114 cdev_del(STm->cdevs[j]);
4115 } 4115 }
4116 } 4116 }
@@ -4148,9 +4148,9 @@ static int st_remove(struct device *dev)
4148 "tape"); 4148 "tape");
4149 for (mode = 0; mode < ST_NBR_MODES; ++mode) { 4149 for (mode = 0; mode < ST_NBR_MODES; ++mode) {
4150 for (j=0; j < 2; j++) { 4150 for (j=0; j < 2; j++) {
4151 class_device_destroy(st_sysfs_class, 4151 device_destroy(st_sysfs_class,
4152 MKDEV(SCSI_TAPE_MAJOR, 4152 MKDEV(SCSI_TAPE_MAJOR,
4153 TAPE_MINOR(i, mode, j))); 4153 TAPE_MINOR(i, mode, j)));
4154 cdev_del(tpnt->modes[mode].cdevs[j]); 4154 cdev_del(tpnt->modes[mode].cdevs[j]);
4155 tpnt->modes[mode].cdevs[j] = NULL; 4155 tpnt->modes[mode].cdevs[j] = NULL;
4156 } 4156 }
@@ -4319,31 +4319,34 @@ static void do_remove_sysfs_files(void)
4319 4319
4320 4320
4321/* The sysfs simple class interface */ 4321/* The sysfs simple class interface */
4322static ssize_t st_defined_show(struct class_device *class_dev, char *buf) 4322static ssize_t
4323st_defined_show(struct device *dev, struct device_attribute *attr, char *buf)
4323{ 4324{
4324 struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); 4325 struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev);
4325 ssize_t l = 0; 4326 ssize_t l = 0;
4326 4327
4327 l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined); 4328 l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined);
4328 return l; 4329 return l;
4329} 4330}
4330 4331
4331CLASS_DEVICE_ATTR(defined, S_IRUGO, st_defined_show, NULL); 4332DEVICE_ATTR(defined, S_IRUGO, st_defined_show, NULL);
4332 4333
4333static ssize_t st_defblk_show(struct class_device *class_dev, char *buf) 4334static ssize_t
4335st_defblk_show(struct device *dev, struct device_attribute *attr, char *buf)
4334{ 4336{
4335 struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); 4337 struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev);
4336 ssize_t l = 0; 4338 ssize_t l = 0;
4337 4339
4338 l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize); 4340 l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize);
4339 return l; 4341 return l;
4340} 4342}
4341 4343
4342CLASS_DEVICE_ATTR(default_blksize, S_IRUGO, st_defblk_show, NULL); 4344DEVICE_ATTR(default_blksize, S_IRUGO, st_defblk_show, NULL);
4343 4345
4344static ssize_t st_defdensity_show(struct class_device *class_dev, char *buf) 4346static ssize_t
4347st_defdensity_show(struct device *dev, struct device_attribute *attr, char *buf)
4345{ 4348{
4346 struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); 4349 struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev);
4347 ssize_t l = 0; 4350 ssize_t l = 0;
4348 char *fmt; 4351 char *fmt;
4349 4352
@@ -4352,22 +4355,25 @@ static ssize_t st_defdensity_show(struct class_device *class_dev, char *buf)
4352 return l; 4355 return l;
4353} 4356}
4354 4357
4355CLASS_DEVICE_ATTR(default_density, S_IRUGO, st_defdensity_show, NULL); 4358DEVICE_ATTR(default_density, S_IRUGO, st_defdensity_show, NULL);
4356 4359
4357static ssize_t st_defcompression_show(struct class_device *class_dev, char *buf) 4360static ssize_t
4361st_defcompression_show(struct device *dev, struct device_attribute *attr,
4362 char *buf)
4358{ 4363{
4359 struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); 4364 struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev);
4360 ssize_t l = 0; 4365 ssize_t l = 0;
4361 4366
4362 l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1); 4367 l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1);
4363 return l; 4368 return l;
4364} 4369}
4365 4370
4366CLASS_DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL); 4371DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL);
4367 4372
4368static ssize_t st_options_show(struct class_device *class_dev, char *buf) 4373static ssize_t
4374st_options_show(struct device *dev, struct device_attribute *attr, char *buf)
4369{ 4375{
4370 struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); 4376 struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev);
4371 struct scsi_tape *STp; 4377 struct scsi_tape *STp;
4372 int i, j, options; 4378 int i, j, options;
4373 ssize_t l = 0; 4379 ssize_t l = 0;
@@ -4403,13 +4409,13 @@ static ssize_t st_options_show(struct class_device *class_dev, char *buf)
4403 return l; 4409 return l;
4404} 4410}
4405 4411
4406CLASS_DEVICE_ATTR(options, S_IRUGO, st_options_show, NULL); 4412DEVICE_ATTR(options, S_IRUGO, st_options_show, NULL);
4407 4413
4408static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) 4414static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode)
4409{ 4415{
4410 int i, rew, error; 4416 int i, rew, error;
4411 char name[10]; 4417 char name[10];
4412 struct class_device *st_class_member; 4418 struct device *st_class_member;
4413 4419
4414 for (rew=0; rew < 2; rew++) { 4420 for (rew=0; rew < 2; rew++) {
4415 /* Make sure that the minor numbers corresponding to the four 4421 /* Make sure that the minor numbers corresponding to the four
@@ -4418,32 +4424,32 @@ static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode)
4418 snprintf(name, 10, "%s%s%s", rew ? "n" : "", 4424 snprintf(name, 10, "%s%s%s", rew ? "n" : "",
4419 STp->disk->disk_name, st_formats[i]); 4425 STp->disk->disk_name, st_formats[i]);
4420 st_class_member = 4426 st_class_member =
4421 class_device_create(st_sysfs_class, NULL, 4427 device_create(st_sysfs_class, &STp->device->sdev_gendev,
4422 MKDEV(SCSI_TAPE_MAJOR, 4428 MKDEV(SCSI_TAPE_MAJOR,
4423 TAPE_MINOR(dev_num, mode, rew)), 4429 TAPE_MINOR(dev_num, mode, rew)),
4424 &STp->device->sdev_gendev, "%s", name); 4430 "%s", name);
4425 if (IS_ERR(st_class_member)) { 4431 if (IS_ERR(st_class_member)) {
4426 printk(KERN_WARNING "st%d: class_device_create failed\n", 4432 printk(KERN_WARNING "st%d: device_create failed\n",
4427 dev_num); 4433 dev_num);
4428 error = PTR_ERR(st_class_member); 4434 error = PTR_ERR(st_class_member);
4429 goto out; 4435 goto out;
4430 } 4436 }
4431 class_set_devdata(st_class_member, &STp->modes[mode]); 4437 dev_set_drvdata(st_class_member, &STp->modes[mode]);
4432 4438
4433 error = class_device_create_file(st_class_member, 4439 error = device_create_file(st_class_member,
4434 &class_device_attr_defined); 4440 &dev_attr_defined);
4435 if (error) goto out; 4441 if (error) goto out;
4436 error = class_device_create_file(st_class_member, 4442 error = device_create_file(st_class_member,
4437 &class_device_attr_default_blksize); 4443 &dev_attr_default_blksize);
4438 if (error) goto out; 4444 if (error) goto out;
4439 error = class_device_create_file(st_class_member, 4445 error = device_create_file(st_class_member,
4440 &class_device_attr_default_density); 4446 &dev_attr_default_density);
4441 if (error) goto out; 4447 if (error) goto out;
4442 error = class_device_create_file(st_class_member, 4448 error = device_create_file(st_class_member,
4443 &class_device_attr_default_compression); 4449 &dev_attr_default_compression);
4444 if (error) goto out; 4450 if (error) goto out;
4445 error = class_device_create_file(st_class_member, 4451 error = device_create_file(st_class_member,
4446 &class_device_attr_options); 4452 &dev_attr_options);
4447 if (error) goto out; 4453 if (error) goto out;
4448 4454
4449 if (mode == 0 && rew == 0) { 4455 if (mode == 0 && rew == 0) {