patch-2.1.47 linux/drivers/misc/parport_init.c
Next file: linux/drivers/misc/parport_pc.c
Previous file: linux/drivers/misc/parport_ieee1284.c
Back to the patch index
Back to the overall index
- Lines: 115
- Date:
Wed Jul 23 11:07:59 1997
- Orig file:
v2.1.46/linux/drivers/misc/parport_init.c
- Orig date:
Wed Dec 31 16:00:00 1969
diff -u --recursive --new-file v2.1.46/linux/drivers/misc/parport_init.c linux/drivers/misc/parport_init.c
@@ -0,0 +1,114 @@
+/* $Id: parport_init.c,v 1.1.2.2 1997/04/18 15:00:52 phil Exp $
+ * Parallel-port initialisation code.
+ *
+ * Authors: David Campbell <campbell@tirian.che.curtin.edu.au>
+ * Tim Waugh <tmw20@cam.ac.uk>
+ * Jose Renau <renau@acm.org>
+ *
+ * based on work by Grant Guenther <grant@torque.net>
+ * and Philip Blundell <Philip.Blundell@pobox.com>
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/tasks.h>
+
+#include <linux/parport.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/malloc.h>
+#include <linux/init.h>
+
+#ifndef MODULE
+static int io[PARPORT_MAX+1] __initdata = { 0, };
+static int irq[PARPORT_MAX] __initdata = { PARPORT_IRQ_NONE, };
+static int dma[PARPORT_MAX] __initdata = { PARPORT_DMA_NONE, };
+
+extern int parport_pc_init(int *io, int *irq, int *dma);
+
+static int parport_setup_ptr __initdata = 0;
+
+__initfunc(void parport_setup(char *str, int *ints))
+{
+ if (ints[0] == 0 || ints[1] == 0) {
+ /* Disable parport if "parport=" or "parport=0" in cmdline */
+ io[0] = PARPORT_DISABLE;
+ return;
+ }
+ if (parport_setup_ptr < PARPORT_MAX) {
+ io[parport_setup_ptr] = ints[1];
+ if (ints[0]>1) {
+ irq[parport_setup_ptr] = ints[2];
+ if (ints[0]>2) dma[parport_setup_ptr] = ints[3];
+ }
+ parport_setup_ptr++;
+ } else {
+ printk(KERN_ERR "parport=0x%x", ints[1]);
+ if (ints[0]>1) {
+ printk(",%d", ints[2]);
+ if (ints[0]>2) printk(",%d", ints[3]);
+ }
+ printk(" ignored, too many ports.\n");
+ }
+}
+#endif
+
+#ifdef MODULE
+int init_module(void)
+{
+ return 0;
+}
+
+void cleanup_module(void)
+{
+ struct parport *port, *next;
+
+ for (port = parport_enumerate(); port; port = next) {
+ next = port->next;
+ if (!(port->flags & PARPORT_FLAG_COMA))
+ parport_quiesce(port);
+ parport_proc_unregister(port);
+ kfree(port->name);
+ kfree(port);
+ }
+
+ parport_proc_cleanup();
+}
+#else
+__initfunc(int parport_init(void))
+{
+ struct parport *pb;
+
+ if (io[0] == PARPORT_DISABLE) return 1;
+#ifdef CONFIG_PARPORT_PC
+ parport_pc_init(io, irq, dma);
+#endif
+ return 0;
+}
+#endif
+
+/* Exported symbols for modules. */
+
+EXPORT_SYMBOL(parport_claim);
+EXPORT_SYMBOL(parport_release);
+EXPORT_SYMBOL(parport_register_port);
+EXPORT_SYMBOL(parport_quiesce);
+EXPORT_SYMBOL(parport_register_device);
+EXPORT_SYMBOL(parport_unregister_device);
+EXPORT_SYMBOL(parport_enumerate);
+EXPORT_SYMBOL(parport_ieee1284_nibble_mode_ok);
+EXPORT_SYMBOL(parport_wait_peripheral);
+
+void inc_parport_count(void)
+{
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+}
+
+void dec_parport_count(void)
+{
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov