patch-2.4.6 linux/drivers/sbus/audio/dmy.c

Next file: linux/drivers/sbus/char/aurora.h
Previous file: linux/drivers/sbus/audio/dbri.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/drivers/sbus/audio/dmy.c linux/drivers/sbus/audio/dmy.c
@@ -1,4 +1,4 @@
-/* $Id: dmy.c,v 1.7 2001/02/13 01:16:59 davem Exp $
+/* $Id: dmy.c,v 1.9 2001/05/22 23:16:10 davem Exp $
  * drivers/sbus/audio/dummy.c
  *
  * Copyright 1998 Derrick J Brashear (shadow@andrew.cmu.edu)
@@ -36,7 +36,7 @@
 static int dummy_record_gain(struct sparcaudio_driver *drv, int value, 
                             unsigned char balance);
 static int dummy_output_muted(struct sparcaudio_driver *drv, int value);
-static int dummy_attach(struct sparcaudio_driver *drv);
+static int dummy_attach(struct sparcaudio_driver *drv) __init;
 
 static int
 dummy_set_output_encoding(struct sparcaudio_driver *drv, int value)
@@ -710,25 +710,8 @@
         dummy_get_formats,
 };
 
-/* Probe for the dummy chip and then attach the driver. */
-#ifdef MODULE
-int init_module(void)
-#else
-int __init dummy_init(void)
-#endif
-{
-        num_drivers = 0;
-      
-        /* Add support here for specifying multiple dummies to attach at once. */
-        if (dummy_attach(&drivers[num_drivers]) == 0)
-                num_drivers++;
-  
-        /* Only return success if we found some dummy chips. */
-        return (num_drivers > 0) ? 0 : -EIO;
-}
-
 /* Attach to an dummy chip given its PROM node. */
-static int dummy_attach(struct sparcaudio_driver *drv)
+static int __init dummy_attach(struct sparcaudio_driver *drv)
 {
         struct dummy_chip *dummy_chip;
         int err;
@@ -768,15 +751,27 @@
         return 0;
 }
 
-#ifdef MODULE
 /* Detach from an dummy chip given the device structure. */
-static void dummy_detach(struct sparcaudio_driver *drv)
+static void __exit dummy_detach(struct sparcaudio_driver *drv)
 {
         unregister_sparcaudio_driver(drv, 2);
         kfree(drv->private);
 }
 
-void cleanup_module(void)
+/* Probe for the dummy chip and then attach the driver. */
+static int __init dummy_init(void)
+{
+	num_drivers = 0;
+      
+	/* Add support here for specifying multiple dummies to attach at once. */
+	if (dummy_attach(&drivers[num_drivers]) == 0)
+		num_drivers++;
+  
+	/* Only return success if we found some dummy chips. */
+	return (num_drivers > 0) ? 0 : -EIO;
+}
+
+static void __exit dummy_exit(void)
 {
         int i;
 
@@ -785,8 +780,9 @@
                 num_drivers--;
         }
 }
-#endif
 
+module_init(dummy_init);
+module_exit(dummy_exit);
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
  * Emacs will notice this stuff at the end of the file and automatically

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