diff options
| author | Christoph Hellwig <hch@lst.de> | 2003-04-20 00:43:04 -0700 |
|---|---|---|
| committer | Christoph Hellwig <hch@lst.de> | 2003-04-20 00:43:04 -0700 |
| commit | 9d46f485c3aa2f681fd95ace8f85e4b3efd3b395 (patch) | |
| tree | 30124838020a2e80c1c27ef7fe6d95a20ee07c5c /drivers/block | |
| parent | 36631a0c2189b8a8339f9b37e6b035a7b023deb9 (diff) | |
[PATCH] devfs: floppy
The following patches switch the few drivers that have to register
devfs entries independand of gendisks to devfs_mk_bdev.
Diffstat (limited to 'drivers/block')
| -rw-r--r-- | drivers/block/floppy.c | 24 | ||||
| -rw-r--r-- | drivers/block/floppy98.c | 24 |
2 files changed, 22 insertions, 26 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 0e227376497d..da6cf6e94603 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3965,21 +3965,19 @@ static int *table_sup[] = static void __init register_devfs_entries (int drive) { - int base_minor, i; + int base_minor = (drive < 4) ? drive : (124 + drive); - base_minor = (drive < 4) ? drive : (124 + drive); - if (UDP->cmos < NUMBER(default_drive_params)) { - i = 0; - do { - char name[16]; + if (UDP->cmos < NUMBER(default_drive_params)) { + int i = 0; + do { + int minor = base_minor + (table_sup[UDP->cmos][i] << 2); - sprintf(name, "floppy/%d%s", drive, table[table_sup[UDP->cmos][i]]); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, FLOPPY_MAJOR, - base_minor + (table_sup[UDP->cmos][i] << 2), - S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |S_IWGRP, - &floppy_fops, NULL); - } while (table_sup[UDP->cmos][i++]); - } + devfs_mk_bdev(MKDEV(FLOPPY_MAJOR, minor), + S_IFBLK|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, + "floppy/%d%s", + drive, table[table_sup[UDP->cmos][i]]); + } while (table_sup[UDP->cmos][i++]); + } } /* diff --git a/drivers/block/floppy98.c b/drivers/block/floppy98.c index 65630bb7de3c..77dfe8a1841b 100644 --- a/drivers/block/floppy98.c +++ b/drivers/block/floppy98.c @@ -4084,21 +4084,19 @@ static int *table_sup[] = static void __init register_devfs_entries (int drive) { - int base_minor, i; + int base_minor = (drive < 4) ? drive : (124 + drive); - base_minor = (drive < 4) ? drive : (124 + drive); - if (UDP->cmos < NUMBER(default_drive_params)) { - i = 0; - do { - char name[16]; + if (UDP->cmos < NUMBER(default_drive_params)) { + int i = 0; + do { + int minor = base_minor + (table_sup[UDP->cmos][i] << 2); - sprintf(name, "floppy/%d%s", drive, table[table_sup[UDP->cmos][i]]); - devfs_register(NULL, name, DEVFS_FL_DEFAULT, FLOPPY_MAJOR, - base_minor + (table_sup[UDP->cmos][i] << 2), - S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |S_IWGRP, - &floppy_fops, NULL); - } while (table_sup[UDP->cmos][i++]); - } + devfs_mk_bdev(MKDEV(FLOPPY_MAJOR, minor), + S_IFBLK|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, + "floppy/%d%s", + drive, table[table_sup[UDP->cmos][i]]); + } while (table_sup[UDP->cmos][i++]); + } } /* |
