Commit f68a4824 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] acorn floppy switched to alloc_disk()

parent 4d1fc631
......@@ -203,7 +203,7 @@ static struct archy_disk_type {
*/
#define MAX_DISK_SIZE 720
static struct gendisk disks[FD_MAX_UNIT];
static struct gendisk *disks[FD_MAX_UNIT];
/* current info on each unit */
static struct archy_floppy_struct {
......@@ -961,7 +961,7 @@ static void fd_rwsec_done(int status)
if (unit[SelectedDrive].disktype > disk_type) {
/* try another disk type */
unit[SelectedDrive].disktype--;
set_capacity(&disks[SelectedDrive],
set_capacity(disks[SelectedDrive],
unit[SelectedDrive].disktype->blocks);
} else
Probing = 0;
......@@ -969,7 +969,7 @@ static void fd_rwsec_done(int status)
/* record not found, but not probing. Maybe stretch wrong ? Restart probing */
if (unit[SelectedDrive].autoprobe) {
unit[SelectedDrive].disktype = disk_type + NUM_DISK_TYPES - 1;
set_capacity(&disks[SelectedDrive],
set_capacity(disks[SelectedDrive],
unit[SelectedDrive].disktype->blocks);
Probing = 1;
}
......@@ -1242,7 +1242,7 @@ static void redo_fd_request(void)
if (!floppy->disktype) {
Probing = 1;
floppy->disktype = disk_type + NUM_DISK_TYPES - 1;
set_capacity(&disks[drive], floppy->disktype->blocks);
set_capacity(disks[drive], floppy->disktype->blocks);
floppy->autoprobe = 1;
}
} else {
......@@ -1254,7 +1254,7 @@ static void redo_fd_request(void)
goto repeat;
}
floppy->disktype = &disk_type[type];
set_capacity(&disks[drive], floppy->disktype->blocks);
set_capacity(disks[drive], floppy->disktype->blocks);
floppy->autoprobe = 0;
}
......@@ -1540,7 +1540,7 @@ static struct gendisk *floppy_find(int minor)
int drive = minor & 3;
if ((minor>> 2) > NUM_DISK_TYPES || drive >= FD_MAX_UNITS)
return NULL;
return &disks[drive];
return disks[drive];
}
int fd1772_init(void)
......@@ -1550,20 +1550,28 @@ int fd1772_init(void)
if (!machine_is_archimedes())
return 0;
for (i = 0; i < FD_MAX_UNITS; i++) {
disks[i] = alloc_disk();
if (!disks[i])
goto out;
}
if (register_blkdev(MAJOR_NR, "fd", &floppy_fops)) {
printk("Unable to get major %d for floppy\n", MAJOR_NR);
return 1;
goto out;
}
if (request_dma(FLOPPY_DMA, "fd1772")) {
printk("Unable to grab DMA%d for the floppy (1772) driver\n", FLOPPY_DMA);
return 1;
unregister_blkdev(MAJOR_NR, "fd");
goto out;
};
if (request_dma(FIQ_FD1772, "fd1772 end")) {
printk("Unable to grab DMA%d for the floppy (1772) driver\n", FIQ_FD1772);
unregister_blkdev(MAJOR_NR, "fd");
free_dma(FLOPPY_DMA);
return 1;
goto out;
};
enable_dma(FIQ_FD1772); /* This inserts a call to our command end routine */
......@@ -1582,18 +1590,22 @@ int fd1772_init(void)
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_fd_request);
for (i = 0; i < FD_MAX_UNITS; i++) {
unit[i].track = -1;
disks[i].major = MAJOR_NR;
disks[i].first_minor = 0;
disks[i].fops = &floppy_fops;
sprintf(disks[i].disk_name, "fd%d", i);
set_capacity(&disks[i], MAX_DISK_SIZE * 2);
disks[i]->major = MAJOR_NR;
disks[i]->first_minor = 0;
disks[i]->fops = &floppy_fops;
sprintf(disks[i]->disk_name, "fd%d", i);
set_capacity(disks[i], MAX_DISK_SIZE * 2);
}
blk_set_probe(MAJOR_NR, floppy_find);
for (i = 0; i < FD_MAX_UNITS; i++)
add_disk(disks + i);
add_disk(disks[i]);
config_types();
return 0;
out:
while (i--)
put_disk(disks[i]);
return 1;
}
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