patch-2.3.32 linux/drivers/cdrom/optcd.c

Next file: linux/drivers/cdrom/sbpcd.c
Previous file: linux/drivers/cdrom/mcdx.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.31/linux/drivers/cdrom/optcd.c linux/drivers/cdrom/optcd.c
@@ -57,6 +57,11 @@
 				thanks to Luke McFarlane. Also tidied up some
 				printk behaviour. ISP16 initialization
 				is now handled by a separate driver.
+				
+	09-11-99 	  	Make kernel-parameter implementation work with 2.3.x 
+	                 	Removed init_module & cleanup_module in favor of 
+			 	module_init & module_exit.
+			 	Torben Mathiasen <tmm@image.dk>
 */
 
 /* Includes */
@@ -1360,7 +1365,7 @@
 }
 
 
-static void do_optcd_request(void)
+static void do_optcd_request(request_queue_t * q)
 {
 	DEBUG((DEBUG_REQUEST, "do_optcd_request(%ld+%ld)",
 	       CURRENT -> sector, CURRENT -> nr_sectors));
@@ -2020,14 +2025,23 @@
 	NULL			/* revalidate */
 };
 
-
+#ifndef MODULE
 /* Get kernel parameter when used as a kernel driver */
-void __init optcd_setup(char *str, int *ints)
+static int optcd_setup(char *str)
 {
+	int ints[4];
+	(void)get_options(str, ARRAY_SIZE(ints), ints);
+	
 	if (ints[0] > 0)
 		optcd_port = ints[1];
+
+ 	return 1;
 }
 
+__setup("optcd=", optcd_setup);
+
+#endif MODULE
+
 /* Test for presence of drive and initialize it. Called at boot time
    or during module initialisation. */
 int __init optcd_init(void)
@@ -2067,7 +2081,7 @@
 
 	hardsect_size[MAJOR_NR] = &hsecsize;
 	blksize_size[MAJOR_NR] = &blksize;
-	blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
+	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);
 	read_ahead[MAJOR_NR] = 4;
 	request_region(optcd_port, 4, "optcd");
 
@@ -2076,14 +2090,7 @@
 }
 
 
-#ifdef MODULE
-int init_module(void)
-{
-	return optcd_init();
-}
-
-
-void cleanup_module(void)
+void __exit optcd_exit(void)
 {
 	if (unregister_blkdev(MAJOR_NR, "optcd") == -EINVAL) {
 		printk(KERN_ERR "optcd: what's that: can't unregister\n");
@@ -2092,4 +2099,10 @@
 	release_region(optcd_port, 4);
 	printk(KERN_INFO "optcd: module released.\n");
 }
-#endif MODULE
+
+#ifdef MODULE
+module_init(optcd_init);
+#endif
+module_exit(optcd_exit);
+
+

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)