Commit 0e6d01f3 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] gendisk for gscd

gscd switched to use of gendisk; missing initcall restored
parent 4da35fb8
...@@ -86,14 +86,12 @@ MODULE_PARM(gscd, "h"); ...@@ -86,14 +86,12 @@ MODULE_PARM(gscd, "h");
* static DECLARE_WAIT_QUEUE_HEAD(gscd_waitq); * static DECLARE_WAIT_QUEUE_HEAD(gscd_waitq);
*/ */
static void gscd_transfer(void);
static void gscd_read_cmd(void); static void gscd_read_cmd(void);
static void gscd_hsg2msf(long hsg, struct msf *msf); static void gscd_hsg2msf(long hsg, struct msf *msf);
static void gscd_bin2bcd(unsigned char *p); static void gscd_bin2bcd(unsigned char *p);
/* Schnittstellen zum Kern/FS */ /* Schnittstellen zum Kern/FS */
static void do_gscd_request(request_queue_t *);
static void __do_gscd_request(unsigned long dummy); static void __do_gscd_request(unsigned long dummy);
static int gscd_ioctl(struct inode *, struct file *, unsigned int, static int gscd_ioctl(struct inode *, struct file *, unsigned int,
unsigned long); unsigned long);
...@@ -103,13 +101,8 @@ static int check_gscd_med_chg(kdev_t); ...@@ -103,13 +101,8 @@ static int check_gscd_med_chg(kdev_t);
/* GoldStar Funktionen */ /* GoldStar Funktionen */
static void cc_Reset(void);
static int wait_drv_ready(void);
static int find_drives(void);
static void cmd_out(int, char *, char *, int); static void cmd_out(int, char *, char *, int);
static void cmd_status(void); static void cmd_status(void);
static void cc_Ident(char *);
static void cc_SetSpeed(void);
static void init_cd_drive(int); static void init_cd_drive(int);
static int get_status(void); static int get_status(void);
...@@ -123,10 +116,6 @@ static long gscd_msf2hsg(struct msf *mp); ...@@ -123,10 +116,6 @@ static long gscd_msf2hsg(struct msf *mp);
static int gscd_bcd2bin(unsigned char bcd); static int gscd_bcd2bin(unsigned char bcd);
#endif #endif
/* common GoldStar Initialization */
static int my_gscd_init(void);
/* lo-level cmd-Funktionen */ /* lo-level cmd-Funktionen */
...@@ -164,11 +153,11 @@ static struct timer_list gscd_timer; ...@@ -164,11 +153,11 @@ static struct timer_list gscd_timer;
static spinlock_t gscd_lock = SPIN_LOCK_UNLOCKED; static spinlock_t gscd_lock = SPIN_LOCK_UNLOCKED;
static struct block_device_operations gscd_fops = { static struct block_device_operations gscd_fops = {
owner:THIS_MODULE, .owner = THIS_MODULE,
open:gscd_open, .open = gscd_open,
release:gscd_release, .release = gscd_release,
ioctl:gscd_ioctl, .ioctl = gscd_ioctl,
check_media_change:check_gscd_med_chg, .check_media_change = check_gscd_med_chg,
}; };
/* /*
...@@ -414,7 +403,7 @@ static int gscd_release(struct inode *inode, struct file *file) ...@@ -414,7 +403,7 @@ static int gscd_release(struct inode *inode, struct file *file)
} }
int get_status(void) static int get_status(void)
{ {
int status; int status;
...@@ -430,7 +419,7 @@ int get_status(void) ...@@ -430,7 +419,7 @@ int get_status(void)
} }
void cc_invalidate(void) static void cc_invalidate(void)
{ {
drv_num_read = 0xFF; drv_num_read = 0xFF;
f_dsk_valid = 0xFF; f_dsk_valid = 0xFF;
...@@ -441,7 +430,7 @@ void cc_invalidate(void) ...@@ -441,7 +430,7 @@ void cc_invalidate(void)
} }
void clear_Audio(void) static void clear_Audio(void)
{ {
f_AudioPlay = 0; f_AudioPlay = 0;
...@@ -457,7 +446,7 @@ void clear_Audio(void) ...@@ -457,7 +446,7 @@ void clear_Audio(void)
* waiting ? * waiting ?
*/ */
int wait_drv_ready(void) static int wait_drv_ready(void)
{ {
int found, read; int found, read;
...@@ -475,7 +464,7 @@ int wait_drv_ready(void) ...@@ -475,7 +464,7 @@ int wait_drv_ready(void)
return read; return read;
} }
void cc_Ident(char *respons) static void cc_Ident(char *respons)
{ {
char to_do[] = { CMD_IDENT, 0, 0 }; char to_do[] = { CMD_IDENT, 0, 0 };
...@@ -483,7 +472,7 @@ void cc_Ident(char *respons) ...@@ -483,7 +472,7 @@ void cc_Ident(char *respons)
} }
void cc_SetSpeed(void) static void cc_SetSpeed(void)
{ {
char to_do[] = { CMD_SETSPEED, 0, 0 }; char to_do[] = { CMD_SETSPEED, 0, 0 };
char dummy; char dummy;
...@@ -494,8 +483,7 @@ void cc_SetSpeed(void) ...@@ -494,8 +483,7 @@ void cc_SetSpeed(void)
} }
} }
static void cc_Reset(void)
void cc_Reset(void)
{ {
char to_do[] = { CMD_RESET, 0 }; char to_do[] = { CMD_RESET, 0 };
char dummy; char dummy;
...@@ -503,9 +491,7 @@ void cc_Reset(void) ...@@ -503,9 +491,7 @@ void cc_Reset(void)
cmd_out(TYPE_INFO, (char *) &to_do, (char *) &dummy, 0); cmd_out(TYPE_INFO, (char *) &to_do, (char *) &dummy, 0);
} }
static void cmd_status(void)
void cmd_status(void)
{ {
char to_do[] = { CMD_STATUS, 0 }; char to_do[] = { CMD_STATUS, 0 };
char dummy; char dummy;
...@@ -518,7 +504,7 @@ void cmd_status(void) ...@@ -518,7 +504,7 @@ void cmd_status(void)
} }
void cmd_out(int cmd_type, char *cmd, char *respo_buf, int respo_count) static void cmd_out(int cmd_type, char *cmd, char *respo_buf, int respo_count)
{ {
int result; int result;
...@@ -817,7 +803,7 @@ static void cmd_read_w(char *pb, int count, int size) ...@@ -817,7 +803,7 @@ static void cmd_read_w(char *pb, int count, int size)
return; return;
} }
int __init find_drives(void) static int __init find_drives(void)
{ {
int *pdrv; int *pdrv;
int drvnum; int drvnum;
...@@ -861,7 +847,7 @@ int __init find_drives(void) ...@@ -861,7 +847,7 @@ int __init find_drives(void)
return drvnum; return drvnum;
} }
void __init init_cd_drive(int num) static void __init init_cd_drive(int num)
{ {
char resp[50]; char resp[50];
int i; int i;
...@@ -912,28 +898,20 @@ static void update_state(void) ...@@ -912,28 +898,20 @@ static void update_state(void)
} }
#endif #endif
/* Init for the Module-Version */ static struct gendisk gscd_disk = {
int init_gscd(void) .major = MAJOR_NR,
{ .first_minor = 0,
long err; ,minor_shift = 0,
.fops = &gscd_fops,
.major_name = "gscd"
/* call the GoldStar-init */ };
err = my_gscd_init();
if (err < 0) {
return err;
} else {
printk(KERN_INFO "Happy GoldStar !\n");
return 0;
}
}
void __exit exit_gscd(void) static void __exit gscd_exit(void)
{ {
CLEAR_TIMER; CLEAR_TIMER;
devfs_find_and_unregister(NULL, "gscd", 0, 0, DEVFS_SPECIAL_BLK, 0); devfs_find_and_unregister(NULL, "gscd", 0, 0, DEVFS_SPECIAL_BLK, 0);
del_gendisk(&gscd_disk);
if ((unregister_blkdev(MAJOR_NR, "gscd") == -EINVAL)) { if ((unregister_blkdev(MAJOR_NR, "gscd") == -EINVAL)) {
printk("What's that: can't unregister GoldStar-module\n"); printk("What's that: can't unregister GoldStar-module\n");
return; return;
...@@ -943,22 +921,9 @@ void __exit exit_gscd(void) ...@@ -943,22 +921,9 @@ void __exit exit_gscd(void)
printk(KERN_INFO "GoldStar-module released.\n"); printk(KERN_INFO "GoldStar-module released.\n");
} }
#ifdef MODULE
module_init(init_gscd);
#endif
module_exit(exit_gscd);
/* Test for presence of drive and initialize it. Called only at boot time. */
int __init gscd_init(void)
{
return my_gscd_init();
}
/* This is the common initialisation for the GoldStar drive. */ /* This is the common initialisation for the GoldStar drive. */
/* It is called at boot time AND for module init. */ /* It is called at boot time AND for module init. */
int __init my_gscd_init(void) static int __init gscd_init(void)
{ {
int i; int i;
int result; int result;
...@@ -1026,7 +991,7 @@ int __init my_gscd_init(void) ...@@ -1026,7 +991,7 @@ int __init my_gscd_init(void)
disk_state = 0; disk_state = 0;
gscdPresent = 1; gscdPresent = 1;
register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &gscd_fops, 0); add_disk(&gscd_disk);
printk(KERN_INFO "GSCD: GoldStar CD-ROM Drive found.\n"); printk(KERN_INFO "GSCD: GoldStar CD-ROM Drive found.\n");
return 0; return 0;
...@@ -1075,3 +1040,5 @@ static int gscd_bcd2bin(unsigned char bcd) ...@@ -1075,3 +1040,5 @@ static int gscd_bcd2bin(unsigned char bcd)
MODULE_AUTHOR("Oliver Raupach <raupach@nwfs1.rz.fh-hannover.de>"); MODULE_AUTHOR("Oliver Raupach <raupach@nwfs1.rz.fh-hannover.de>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(gscd_init);
module_exit(gscd_exit);
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