aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/floppy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r--drivers/block/floppy.c55
1 files changed, 1 insertions, 54 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index dff1e67b1dd4..0242cbb86a87 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -177,7 +177,6 @@ static int print_unex = 1;
177#include <linux/ioport.h> 177#include <linux/ioport.h>
178#include <linux/interrupt.h> 178#include <linux/interrupt.h>
179#include <linux/init.h> 179#include <linux/init.h>
180#include <linux/devfs_fs_kernel.h>
181#include <linux/platform_device.h> 180#include <linux/platform_device.h>
182#include <linux/buffer_head.h> /* for invalidate_buffers() */ 181#include <linux/buffer_head.h> /* for invalidate_buffers() */
183#include <linux/mutex.h> 182#include <linux/mutex.h>
@@ -224,7 +223,6 @@ static struct completion device_release;
224static unsigned short virtual_dma_port = 0x3f0; 223static unsigned short virtual_dma_port = 0x3f0;
225irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs); 224irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs);
226static int set_dor(int fdc, char mask, char data); 225static int set_dor(int fdc, char mask, char data);
227static void register_devfs_entries(int drive) __init;
228 226
229#define K_64 0x10000 /* 64KB */ 227#define K_64 0x10000 /* 64KB */
230 228
@@ -3676,7 +3674,6 @@ static void __init config_types(void)
3676 first = 0; 3674 first = 0;
3677 } 3675 }
3678 printk("%s fd%d is %s", prepend, drive, name); 3676 printk("%s fd%d is %s", prepend, drive, name);
3679 register_devfs_entries(drive);
3680 } 3677 }
3681 *UDP = *params; 3678 *UDP = *params;
3682 } 3679 }
@@ -3954,37 +3951,6 @@ static struct block_device_operations floppy_fops = {
3954 .media_changed = check_floppy_change, 3951 .media_changed = check_floppy_change,
3955 .revalidate_disk = floppy_revalidate, 3952 .revalidate_disk = floppy_revalidate,
3956}; 3953};
3957static char *table[] = {
3958 "", "d360", "h1200", "u360", "u720", "h360", "h720",
3959 "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410",
3960 "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743",
3961 "h880", "u1040", "u1120", "h1600", "u1760", "u1920",
3962 "u3200", "u3520", "u3840", "u1840", "u800", "u1600",
3963 NULL
3964};
3965static int t360[] = { 1, 0 },
3966 t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 },
3967 t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13,
3968 17, 21, 22, 30, 0 };
3969static int *table_sup[] =
3970 { NULL, t360, t1200, t3in + 5 + 8, t3in + 5, t3in, t3in };
3971
3972static void __init register_devfs_entries(int drive)
3973{
3974 int base_minor = (drive < 4) ? drive : (124 + drive);
3975
3976 if (UDP->cmos < ARRAY_SIZE(default_drive_params)) {
3977 int i = 0;
3978 do {
3979 int minor = base_minor + (table_sup[UDP->cmos][i] << 2);
3980
3981 devfs_mk_bdev(MKDEV(FLOPPY_MAJOR, minor),
3982 S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |
3983 S_IWGRP, "floppy/%d%s", drive,
3984 table[table_sup[UDP->cmos][i]]);
3985 } while (table_sup[UDP->cmos][i++]);
3986 }
3987}
3988 3954
3989/* 3955/*
3990 * Floppy Driver initialization 3956 * Floppy Driver initialization
@@ -4261,11 +4227,9 @@ static int __init floppy_init(void)
4261 motor_off_timer[dr].function = motor_off_callback; 4227 motor_off_timer[dr].function = motor_off_callback;
4262 } 4228 }
4263 4229
4264 devfs_mk_dir("floppy");
4265
4266 err = register_blkdev(FLOPPY_MAJOR, "fd"); 4230 err = register_blkdev(FLOPPY_MAJOR, "fd");
4267 if (err) 4231 if (err)
4268 goto out_devfs_remove; 4232 goto out_put_disk;
4269 4233
4270 floppy_queue = blk_init_queue(do_fd_request, &floppy_lock); 4234 floppy_queue = blk_init_queue(do_fd_request, &floppy_lock);
4271 if (!floppy_queue) { 4235 if (!floppy_queue) {
@@ -4424,8 +4388,6 @@ out_unreg_region:
4424 blk_cleanup_queue(floppy_queue); 4388 blk_cleanup_queue(floppy_queue);
4425out_unreg_blkdev: 4389out_unreg_blkdev:
4426 unregister_blkdev(FLOPPY_MAJOR, "fd"); 4390 unregister_blkdev(FLOPPY_MAJOR, "fd");
4427out_devfs_remove:
4428 devfs_remove("floppy");
4429out_put_disk: 4391out_put_disk:
4430 while (dr--) { 4392 while (dr--) {
4431 del_timer(&motor_off_timer[dr]); 4393 del_timer(&motor_off_timer[dr]);
@@ -4586,19 +4548,6 @@ static void floppy_release_irq_and_dma(void)
4586 4548
4587static char *floppy; 4549static char *floppy;
4588 4550
4589static void unregister_devfs_entries(int drive)
4590{
4591 int i;
4592
4593 if (UDP->cmos < ARRAY_SIZE(default_drive_params)) {
4594 i = 0;
4595 do {
4596 devfs_remove("floppy/%d%s", drive,
4597 table[table_sup[UDP->cmos][i]]);
4598 } while (table_sup[UDP->cmos][i++]);
4599 }
4600}
4601
4602static void __init parse_floppy_cfg_string(char *cfg) 4551static void __init parse_floppy_cfg_string(char *cfg)
4603{ 4552{
4604 char *ptr; 4553 char *ptr;
@@ -4635,13 +4584,11 @@ void cleanup_module(void)
4635 if ((allowed_drive_mask & (1 << drive)) && 4584 if ((allowed_drive_mask & (1 << drive)) &&
4636 fdc_state[FDC(drive)].version != FDC_NONE) { 4585 fdc_state[FDC(drive)].version != FDC_NONE) {
4637 del_gendisk(disks[drive]); 4586 del_gendisk(disks[drive]);
4638 unregister_devfs_entries(drive);
4639 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); 4587 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
4640 platform_device_unregister(&floppy_device[drive]); 4588 platform_device_unregister(&floppy_device[drive]);
4641 } 4589 }
4642 put_disk(disks[drive]); 4590 put_disk(disks[drive]);
4643 } 4591 }
4644 devfs_remove("floppy");
4645 4592
4646 del_timer_sync(&fd_timeout); 4593 del_timer_sync(&fd_timeout);
4647 del_timer_sync(&fd_timer); 4594 del_timer_sync(&fd_timer);