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

[PATCH] gendisk for mcdx

mcdx switched to use of gendisk
parent 6606a03e
...@@ -206,6 +206,7 @@ struct s_drive_stuff { ...@@ -206,6 +206,7 @@ struct s_drive_stuff {
int status; /* last operation's error / status */ int status; /* last operation's error / status */
int readerrs; /* # of blocks read w/o error */ int readerrs; /* # of blocks read w/o error */
struct cdrom_device_info info; struct cdrom_device_info info;
struct gendisk disk;
}; };
...@@ -1020,6 +1021,7 @@ void __exit mcdx_exit(void) ...@@ -1020,6 +1021,7 @@ void __exit mcdx_exit(void)
struct s_drive_stuff *stuffp = mcdx_stuffp[i]; struct s_drive_stuff *stuffp = mcdx_stuffp[i];
if (!stuffp) if (!stuffp)
continue; continue;
del_gendisk(&stuffp->disk);
if (unregister_cdrom(&stuffp->info)) { if (unregister_cdrom(&stuffp->info)) {
printk(KERN_WARNING "Can't unregister cdrom mcdx\n"); printk(KERN_WARNING "Can't unregister cdrom mcdx\n");
return; return;
...@@ -1059,6 +1061,7 @@ module_exit(mcdx_exit); ...@@ -1059,6 +1061,7 @@ module_exit(mcdx_exit);
int __init mcdx_init_drive(int drive) int __init mcdx_init_drive(int drive)
{ {
struct s_version version; struct s_version version;
struct gendisk *disk;
struct s_drive_stuff *stuffp; struct s_drive_stuff *stuffp;
int size = sizeof(*stuffp); int size = sizeof(*stuffp);
char msg[80]; char msg[80];
...@@ -1203,6 +1206,12 @@ int __init mcdx_init_drive(int drive) ...@@ -1203,6 +1206,12 @@ int __init mcdx_init_drive(int drive)
stuffp->info.handle = stuffp; stuffp->info.handle = stuffp;
sprintf(stuffp->info.name, "mcdx%d", drive); sprintf(stuffp->info.name, "mcdx%d", drive);
stuffp->info.dev = mk_kdev(MAJOR_NR, drive); stuffp->info.dev = mk_kdev(MAJOR_NR, drive);
disk = &stuffp->disk;
disk->major = MAJOR_NR;
disk->first_minor = drive;
disk->minor_shift = 0;
disk->major_name = stuffp->info.name;
disk->fops = &mcdx_bdops;
sprintf(msg, " mcdx: Mitsumi CD-ROM installed at 0x%3p, irq %d." sprintf(msg, " mcdx: Mitsumi CD-ROM installed at 0x%3p, irq %d."
" (Firmware version %c %x)\n", " (Firmware version %c %x)\n",
...@@ -1220,7 +1229,13 @@ int __init mcdx_init_drive(int drive) ...@@ -1220,7 +1229,13 @@ int __init mcdx_init_drive(int drive)
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR)); blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
return 2; return 2;
} }
devfs_plain_cdrom(&stuffp->info, &mcdx_bdops); devfs_plain_cdrom(&stuffp->info, disk->fops);
add_gendisk(disk);
register_disk(disk,
mk_kdev(disk->major,disk->first_minor),
1<<disk->minor_shift,
disk->fops,
0);
printk(msg); printk(msg);
return 0; return 0;
} }
......
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