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