patch-2.3.25 linux/drivers/char/radio-cadet.c

Next file: linux/drivers/char/radio-rtrack2.c
Previous file: linux/drivers/char/ppdev.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.24/linux/drivers/char/radio-cadet.c linux/drivers/char/radio-cadet.c
@@ -39,7 +39,6 @@
 static __u8 rdsin=0,rdsout=0,rdsstat=0;
 static unsigned char rdsbuf[RDS_BUFFER];
 static int cadet_lock=0;
-static int cadet_probe(void);
 
 /*
  * Signal Strength Threshold Values
@@ -543,22 +542,6 @@
 	NULL
 };
 
-int __init cadet_init(struct video_init *v)
-{
-#ifndef MODULE        
-        if(cadet_probe()<0) {
-	        return EINVAL;
-	}
-#endif
-	if(video_register_device(&cadet_radio,VFL_TYPE_RADIO)==-1)
-		return -EINVAL;
-		
-	request_region(io,2,"cadet");
-	printk(KERN_INFO "ADS Cadet Radio Card at 0x%x\n",io);
-	return 0;
-}
-
-
 #ifndef MODULE
 static int cadet_probe(void)
 {
@@ -578,9 +561,27 @@
 }
 #endif
 
+int __init cadet_init(void)
+{
+#ifndef MODULE        
+	io = cadet_probe ();
+#endif
+
+        if(io < 0) {
+#ifdef MODULE        
+		printk(KERN_ERR "You must set an I/O address with io=0x???\n");
+#endif
+	        return EINVAL;
+	}
+	if(video_register_device(&cadet_radio,VFL_TYPE_RADIO)==-1)
+		return -EINVAL;
+		
+	request_region(io,2,"cadet");
+	printk(KERN_INFO "ADS Cadet Radio Card at 0x%x\n",io);
+	return 0;
+}
 
 
-#ifdef MODULE
 
 MODULE_AUTHOR("Fred Gleason, Russell Kroll, Quay Lu, Donald Song, Jason Lewis, Scott McGrath, William McGrath");
 MODULE_DESCRIPTION("A driver for the ADS Cadet AM/FM/RDS radio card.");
@@ -589,21 +590,12 @@
 
 EXPORT_NO_SYMBOLS;
 
-int init_module(void)
-{
-	if(io==-1)
-	{
-		printk(KERN_ERR "You must set an I/O address with io=0x???\n");
-		return -EINVAL;
-	}
-	return cadet_init(NULL);
-}
-
-void cleanup_module(void)
+static void __exit cadet_cleanup_module(void)
 {
 	video_unregister_device(&cadet_radio);
 	release_region(io,2);
 }
 
-#endif
+module_init(cadet_init);
+module_exit(cadet_cleanup_module);
 

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