aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-02 11:08:45 -0500
committerJiri Kosina <jkosina@suse.cz>2015-02-03 07:00:36 -0500
commitb7f120b211510b80cb72c1d790d9a4531271edfa (patch)
tree24e7e82ff8cf9cde097f25fe6ebd1024bcacc0b0 /drivers/block
parentac3dd5bd128b1d1ce2a037775766f39d06a4848a (diff)
floppy: Avoid manual call of device_create_file()
Use the static attribute groups assigned to the device instead of calling device_create_file() after the device registration. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/floppy.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 56d46ffb08e1..a08cda955285 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4112,6 +4112,13 @@ static ssize_t floppy_cmos_show(struct device *dev,
4112 4112
4113static DEVICE_ATTR(cmos, S_IRUGO, floppy_cmos_show, NULL); 4113static DEVICE_ATTR(cmos, S_IRUGO, floppy_cmos_show, NULL);
4114 4114
4115static struct attribute *floppy_dev_attrs[] = {
4116 &dev_attr_cmos.attr,
4117 NULL
4118};
4119
4120ATTRIBUTE_GROUPS(floppy_dev);
4121
4115static void floppy_device_release(struct device *dev) 4122static void floppy_device_release(struct device *dev)
4116{ 4123{
4117} 4124}
@@ -4324,16 +4331,12 @@ static int __init do_floppy_init(void)
4324 floppy_device[drive].name = floppy_device_name; 4331 floppy_device[drive].name = floppy_device_name;
4325 floppy_device[drive].id = drive; 4332 floppy_device[drive].id = drive;
4326 floppy_device[drive].dev.release = floppy_device_release; 4333 floppy_device[drive].dev.release = floppy_device_release;
4334 floppy_device[drive].dev.groups = floppy_dev_groups;
4327 4335
4328 err = platform_device_register(&floppy_device[drive]); 4336 err = platform_device_register(&floppy_device[drive]);
4329 if (err) 4337 if (err)
4330 goto out_remove_drives; 4338 goto out_remove_drives;
4331 4339
4332 err = device_create_file(&floppy_device[drive].dev,
4333 &dev_attr_cmos);
4334 if (err)
4335 goto out_unreg_platform_dev;
4336
4337 /* to be cleaned up... */ 4340 /* to be cleaned up... */
4338 disks[drive]->private_data = (void *)(long)drive; 4341 disks[drive]->private_data = (void *)(long)drive;
4339 disks[drive]->flags |= GENHD_FL_REMOVABLE; 4342 disks[drive]->flags |= GENHD_FL_REMOVABLE;
@@ -4343,13 +4346,10 @@ static int __init do_floppy_init(void)
4343 4346
4344 return 0; 4347 return 0;
4345 4348
4346out_unreg_platform_dev:
4347 platform_device_unregister(&floppy_device[drive]);
4348out_remove_drives: 4349out_remove_drives:
4349 while (drive--) { 4350 while (drive--) {
4350 if (floppy_available(drive)) { 4351 if (floppy_available(drive)) {
4351 del_gendisk(disks[drive]); 4352 del_gendisk(disks[drive]);
4352 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
4353 platform_device_unregister(&floppy_device[drive]); 4353 platform_device_unregister(&floppy_device[drive]);
4354 } 4354 }
4355 } 4355 }
@@ -4594,7 +4594,6 @@ static void __exit floppy_module_exit(void)
4594 4594
4595 if (floppy_available(drive)) { 4595 if (floppy_available(drive)) {
4596 del_gendisk(disks[drive]); 4596 del_gendisk(disks[drive]);
4597 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
4598 platform_device_unregister(&floppy_device[drive]); 4597 platform_device_unregister(&floppy_device[drive]);
4599 } 4598 }
4600 blk_cleanup_queue(disks[drive]->queue); 4599 blk_cleanup_queue(disks[drive]->queue);