Commit 4d1fc631 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] amiga floppy switched to alloc_disk()

parent 0309add5
...@@ -1643,7 +1643,7 @@ static int floppy_open(struct inode *inode, struct file *filp) ...@@ -1643,7 +1643,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
unit[drive].dtype=&data_types[system]; unit[drive].dtype=&data_types[system];
unit[drive].blocks=unit[drive].type->heads*unit[drive].type->tracks* unit[drive].blocks=unit[drive].type->heads*unit[drive].type->tracks*
data_types[system].sects*unit[drive].type->sect_mult; data_types[system].sects*unit[drive].type->sect_mult;
set_capacity(&unit[drive].disk, unit[drive].blocks); set_capacity(unit[drive].gendisk, unit[drive].blocks);
printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive, printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive,
unit[drive].type->name, data_types[system].name); unit[drive].type->name, data_types[system].name);
...@@ -1731,9 +1731,16 @@ static int __init fd_probe_drives(void) ...@@ -1731,9 +1731,16 @@ static int __init fd_probe_drives(void)
drives=0; drives=0;
nomem=0; nomem=0;
for(drive=0;drive<FD_MAX_UNITS;drive++) { for(drive=0;drive<FD_MAX_UNITS;drive++) {
struct gendisk *disk;
fd_probe(drive); fd_probe(drive);
if (unit[drive].type->code != FD_NODRIVE) { if (unit[drive].type->code == FD_NODRIVE)
struct gendisk *disk = &unit[drive].disk; continue;
disk = alloc_disk();
if (!disk) {
unit[drive].type->code = FD_NODRIVE;
continue;
}
unit[drive].gendisk = disk;
drives++; drives++;
if ((unit[drive].trackbuf = kmalloc(FLOPPY_MAX_SECTORS * 512, GFP_KERNEL)) == NULL) { if ((unit[drive].trackbuf = kmalloc(FLOPPY_MAX_SECTORS * 512, GFP_KERNEL)) == NULL) {
printk("no mem for "); printk("no mem for ");
...@@ -1750,7 +1757,6 @@ static int __init fd_probe_drives(void) ...@@ -1750,7 +1757,6 @@ static int __init fd_probe_drives(void)
set_capacity(disk, 880*2); set_capacity(disk, 880*2);
add_disk(disk); add_disk(disk);
} }
}
if ((drives > 0) || (nomem == 0)) { if ((drives > 0) || (nomem == 0)) {
if (drives == 0) if (drives == 0)
printk("no drives"); printk("no drives");
...@@ -1766,7 +1772,7 @@ static struct gendisk *floppy_find(int minor) ...@@ -1766,7 +1772,7 @@ static struct gendisk *floppy_find(int minor)
int drive = minor & 3; int drive = minor & 3;
if (unit[drive].type->code == FD_NODRIVE) if (unit[drive].type->code == FD_NODRIVE)
return NULL; return NULL;
return &unit[drive].disk; return unit[drive].gendisk;
} }
int __init amiga_floppy_init(void) int __init amiga_floppy_init(void)
...@@ -1875,7 +1881,8 @@ void cleanup_module(void) ...@@ -1875,7 +1881,8 @@ void cleanup_module(void)
for( i = 0; i < FD_MAX_UNITS; i++) { for( i = 0; i < FD_MAX_UNITS; i++) {
if (unit[i].type->code != FD_NODRIVE) { if (unit[i].type->code != FD_NODRIVE) {
del_gendisk(&unit[i].disk); del_gendisk(unit[i].gendisk);
put_disk(unit[i].gendisk);
kfree(unit[i].trackbuf); kfree(unit[i].trackbuf);
} }
} }
......
...@@ -55,7 +55,7 @@ struct amiga_floppy_struct { ...@@ -55,7 +55,7 @@ struct amiga_floppy_struct {
int busy; /* true when drive is active */ int busy; /* true when drive is active */
int dirty; /* true when trackbuf is not on disk */ int dirty; /* true when trackbuf is not on disk */
int status; /* current error code for unit */ int status; /* current error code for unit */
struct gendisk disk; struct gendisk *gendisk;
}; };
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment