Commit 9804df6c authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] ps2esdi.c per-disk gendisks

ps2esdi.c switched to per-disk gendisks
parent ea309121
......@@ -146,13 +146,24 @@ static struct block_device_operations ps2esdi_fops =
ioctl: ps2esdi_ioctl,
};
static struct gendisk ps2esdi_gendisk =
static struct gendisk ps2esdi_gendisk[2] = {
{
major: MAJOR_NR,
major_name: "ed",
major_name: "eda",
first_minor: 0,
minor_shift: 6,
part: ps2esdi,
fops: &ps2esdi_fops,
nr_real: 1
},{
major: MAJOR_NR,
first_minor: 64
major_name: "edb",
minor_shift: 6,
part: ps2esdi+64,
fops: &ps2esdi_fops,
nr_real: 1
}
};
/* initialization routine called by ll_rw_blk.c */
......@@ -172,14 +183,12 @@ int __init ps2esdi_init(void)
&ps2esdi_lock);
/* some minor housekeeping - setup the global gendisk structure */
add_gendisk(&ps2esdi_gendisk);
error = ps2esdi_geninit();
if (error) {
printk(KERN_WARNING "PS2ESDI: error initialising"
" device, releasing resources\n");
unregister_blkdev(MAJOR_NR, "ed");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
del_gendisk(&ps2esdi_gendisk);
blk_clear(MAJOR_NR);
return error;
}
......@@ -230,7 +239,8 @@ cleanup_module(void) {
free_irq(PS2ESDI_IRQ, &ps2esdi_gendisk);
unregister_blkdev(MAJOR_NR, "ed");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
del_gendisk(&ps2esdi_gendisk);
for (i = 0; i < ps2esdi_drives; i++)
del_gendisk(ps2esdi_gendisk + i);
blk_clear(MAJOR_NR);
}
#endif /* MODULE */
......@@ -420,8 +430,6 @@ static int __init ps2esdi_geninit(void)
current_int_handler = ps2esdi_normal_interrupt_handler;
ps2esdi_gendisk.nr_real = ps2esdi_drives;
if (request_dma(dma_arb_level, "ed") !=0) {
printk(KERN_WARNING "PS2ESDI: Can't request dma-channel %d\n"
,(int) dma_arb_level);
......@@ -430,11 +438,14 @@ static int __init ps2esdi_geninit(void)
}
blk_queue_max_sectors(BLK_DEFAULT_QUEUE(MAJOR_NR), 128);
for (i = 0; i < ps2esdi_drives; i++)
register_disk(&ps2esdi_gendisk,mk_kdev(MAJOR_NR,i<<6),1<<6,
&ps2esdi_fops,
for (i = 0; i < ps2esdi_drives; i++) {
struct gendisk *disk = ps2esdi_gendisk + i;
add_gendisk(disk);
register_disk(disk, mk_kdev(disk->major,disk->first_minor),
1<<disk->minor_shift, disk->fops,
ps2esdi_info[i].head * ps2esdi_info[i].sect *
ps2esdi_info[i].cyl);
}
return 0;
err_out3:
......
......@@ -152,7 +152,6 @@ char *disk_name (struct gendisk *hd, int minor, char *buf)
maj = s;
break;
case ACSI_MAJOR:
case PS2ESDI_MAJOR:
case XT_DISK_MAJOR:
case I2O_MAJOR:
case DASD_MAJOR:
......
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