Browse Source

staging: comedi: split out PCI support into new module

Setting the `CONFIG_COMEDI_PCI_DRIVERS` kernel configuration option
makes the main "comedi" module depend on the PCI support in the kernel.
That's not that big a deal since PCI support in the kernel is either
built into the kernel or is absent, and is not in a separate module.
Still, not all low-level Comedi drivers need PCI support, so we could
save a bit of space by not including it.  The Comedi PCI support
functions are all in "comedi_pci.c".  Turn it into a separate module so
the support code doesn't have to be loaded unnecessarily.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott 10 years ago
parent
commit
bc3fe15655

+ 4 - 1
drivers/staging/comedi/Kconfig

@@ -564,11 +564,14 @@ config COMEDI_S526
 endif # COMEDI_ISA_DRIVERS
 endif # COMEDI_ISA_DRIVERS
 
 
 menuconfig COMEDI_PCI_DRIVERS
 menuconfig COMEDI_PCI_DRIVERS
-	bool "Comedi PCI drivers"
+	tristate "Comedi PCI drivers"
 	depends on PCI
 	depends on PCI
 	---help---
 	---help---
 	  Enable support for comedi PCI drivers.
 	  Enable support for comedi PCI drivers.
 
 
+	  To compile this support as a module, choose M here: the module will
+	  be called comedi_pci.
+
 if COMEDI_PCI_DRIVERS
 if COMEDI_PCI_DRIVERS
 
 
 config COMEDI_8255_PCI
 config COMEDI_8255_PCI

+ 1 - 1
drivers/staging/comedi/Makefile

@@ -2,10 +2,10 @@ ccflags-$(CONFIG_COMEDI_DEBUG)		:= -DDEBUG
 
 
 comedi-y				:= comedi_fops.o range.o drivers.o \
 comedi-y				:= comedi_fops.o range.o drivers.o \
 					   comedi_buf.o
 					   comedi_buf.o
-comedi-$(CONFIG_COMEDI_PCI_DRIVERS)	+= comedi_pci.o
 comedi-$(CONFIG_PROC_FS)		+= proc.o
 comedi-$(CONFIG_PROC_FS)		+= proc.o
 comedi-$(CONFIG_COMPAT)			+= comedi_compat32.o
 comedi-$(CONFIG_COMPAT)			+= comedi_compat32.o
 
 
+obj-$(CONFIG_COMEDI_PCI_DRIVERS)	+= comedi_pci.o
 obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS)	+= comedi_pcmcia.o
 obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS)	+= comedi_pcmcia.o
 obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= comedi_usb.o
 obj-$(CONFIG_COMEDI_USB_DRIVERS)	+= comedi_usb.o
 
 

+ 16 - 0
drivers/staging/comedi/comedi_pci.c

@@ -16,6 +16,7 @@
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  */
  */
 
 
+#include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 
 
@@ -168,3 +169,18 @@ void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver,
 	comedi_driver_unregister(comedi_driver);
 	comedi_driver_unregister(comedi_driver);
 }
 }
 EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister);
 EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister);
+
+static int __init comedi_pci_init(void)
+{
+	return 0;
+}
+module_init(comedi_pci_init);
+
+static void __exit comedi_pci_exit(void)
+{
+}
+module_exit(comedi_pci_exit);
+
+MODULE_AUTHOR("http://www.comedi.org");
+MODULE_DESCRIPTION("Comedi PCI interface module");
+MODULE_LICENSE("GPL");