diff options
| author | Kay Sievers <kay.sievers@vrfy.org> | 2005-03-08 17:53:08 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-03-08 17:53:08 -0800 |
| commit | 199c50aa72e7e04aa63b797996b8ea8e320a6de2 (patch) | |
| tree | 2dba9e2995ce8b78aa6c96b5b29ce69ef82bf9ea | |
| parent | 4564909bcd6d50b9fd245655518bad2b7c1e7dd0 (diff) | |
[PATCH] floppy.c: pass physical device to device registration
With this patch the floppy driver creates the usual symlink in sysfs to
the physical device backing the block device:
$tree /sys/block/
/sys/block/
|-- fd0
| |-- dev
| |-- device -> ../../devices/platform/floppy0
...
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | drivers/block/floppy.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index bce3fc0e6e4f..bf52e9bf2393 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4370,6 +4370,10 @@ int __init floppy_init(void) goto out_flush_work; } + err = platform_device_register(&floppy_device); + if (err) + goto out_flush_work; + for (drive = 0; drive < N_DRIVE; drive++) { if (!(allowed_drive_mask & (1 << drive))) continue; @@ -4379,23 +4383,12 @@ int __init floppy_init(void) disks[drive]->private_data = (void *)(long)drive; disks[drive]->queue = floppy_queue; disks[drive]->flags |= GENHD_FL_REMOVABLE; + disks[drive]->driverfs_dev = &floppy_device.dev; add_disk(disks[drive]); } - err = platform_device_register(&floppy_device); - if (err) - goto out_del_disk; - return 0; -out_del_disk: - for (drive = 0; drive < N_DRIVE; drive++) { - if (!(allowed_drive_mask & (1 << drive))) - continue; - if (fdc_state[FDC(drive)].version == FDC_NONE) - continue; - del_gendisk(disks[drive]); - } out_flush_work: flush_scheduled_work(); if (usage_count) @@ -4600,7 +4593,6 @@ void cleanup_module(void) int drive; init_completion(&device_release); - platform_device_unregister(&floppy_device); blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); unregister_blkdev(FLOPPY_MAJOR, "fd"); @@ -4614,6 +4606,7 @@ void cleanup_module(void) } put_disk(disks[drive]); } + platform_device_unregister(&floppy_device); devfs_remove("floppy"); del_timer_sync(&fd_timeout); |
