speedtch Makefile, 1.9, 1.10 speedtch2.c, 1.5, 1.6 speedtch2.h, 1.4, 1.5 usbatm2.c, 1.5, 1.6 minidrivers.h, 1.1, NONE

Duncan Sands duncan at infradead.org
Sun Jan 23 09:34:56 EST 2005


Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv17022

Modified Files:
	Makefile speedtch2.c speedtch2.h usbatm2.c 
Removed Files:
	minidrivers.h 
Log Message:
Change to a dynamic registration scheme.  The main advantage I can see is
that it allows for modules external to the kernel to use usbatm, which is
important.


Index: Makefile
===================================================================
RCS file: /home/cvs/speedtch/Makefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Makefile	20 Jan 2005 16:04:20 -0000	1.9
+++ Makefile	23 Jan 2005 14:34:52 -0000	1.10
@@ -4,14 +4,7 @@
 
 FIRMWARE_EXTRACTOR := firmware
 
-#usbatm-obj-$(CONFIG_USB_SPEEDTOUCH)	+= speedtch2.o
-usbatm-obj-y	+= speedtch2.o
-#usbatm-obj-$(CONFIG_USB_CXACRU)		+= cxacru2.o
-usbatm-obj-y		+= cxacru2.o
-
-usbatm-objs	:= usbatm2.o $(usbatm-obj-y)
-
-obj-m := cxacru.o speedtch.o usb_atm.o usbatm.o
+obj-m := cxacru.o speedtch.o usb_atm.o usbatm2.o speedtch2.o
 
 all help modules modules_install:
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) $(filter-out all,$(MAKECMDGOALS)) EXTRA_CFLAGS=-DDEBUG

Index: speedtch2.c
===================================================================
RCS file: /home/cvs/speedtch/speedtch2.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- speedtch2.c	21 Jan 2005 14:49:29 -0000	1.5
+++ speedtch2.c	23 Jan 2005 14:34:52 -0000	1.6
@@ -723,3 +723,30 @@
 
 	return -ENOMEM;
 }
+
+
+/*********
+*  init  *
+*********/
+
+MODULE_DEVICE_TABLE (usb, speedtch_products);
+
+static struct usb_driver speedtch_info = {
+	.owner		= THIS_MODULE,
+	.name		= speedtch_driver_name,
+	.probe		= usbatm_usb_probe,
+	.disconnect	= usbatm_disconnect,
+	.id_table	= speedtch_products
+};
+
+static int __init speedtch_init(void)
+{
+	return usb_register(&speedtch_info);
+}
+module_init(speedtch_init);
+
+static void __exit speedtch_exit(void)
+{
+	usb_deregister (&speedtch_info);
+}
+module_exit(speedtch_exit);

Index: speedtch2.h
===================================================================
RCS file: /home/cvs/speedtch/speedtch2.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- speedtch2.h	21 Jan 2005 14:49:29 -0000	1.4
+++ speedtch2.h	23 Jan 2005 14:34:52 -0000	1.5
@@ -45,4 +45,12 @@
 	.in = 7, .out = 7
 };
 
+static const struct usb_device_id speedtch_products [] = {
+{
+	USB_DEVICE(0x06b9, 0x4061),
+	.driver_info = (unsigned long) &speedtch_driver
+},
+	{}	/* END */
+};
+
 #endif	/* _SPEEDTCH_H_ */

Index: usbatm2.c
===================================================================
RCS file: /home/cvs/speedtch/usbatm2.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- usbatm2.c	21 Jan 2005 14:49:29 -0000	1.5
+++ usbatm2.c	23 Jan 2005 14:34:52 -0000	1.6
@@ -1051,7 +1051,7 @@
 	return ret;
 }
 
-static int usbatm_usb_probe (struct usb_interface *intf, const struct usb_device_id *id)
+int usbatm_usb_probe (struct usb_interface *intf, const struct usb_device_id *id)
 {
 	struct usb_device *dev = interface_to_usbdev(intf);
 	struct usbatm_driver *driver = (struct usbatm_driver *) id->driver_info;
@@ -1219,8 +1219,9 @@
 
 	return error;
 }
+EXPORT_SYMBOL_GPL(usbatm_usb_probe);
 
-static void usbatm_disconnect(struct usb_interface *intf)
+void usbatm_disconnect(struct usb_interface *intf)
 {
 	struct usbatm_data *instance = usb_get_intfdata(intf);
 	int i;
@@ -1287,24 +1288,13 @@
 
 	udsl_put_instance(instance);	/* taken in usbatm_usb_probe */
 }
+EXPORT_SYMBOL_GPL(usbatm_disconnect);
 
 
 /***********
 **  init  **
 ***********/
 
-#include "minidrivers.h"
-
-MODULE_DEVICE_TABLE (usb, products);
-
-static struct usb_driver usbatm_driver = {
-        .owner          = THIS_MODULE,
-        .name           = driver_name,
-        .probe          = usbatm_usb_probe,
-        .disconnect     = usbatm_disconnect,
-        .id_table       = products,
-};
-
 static int __init udsl_usb_init(void)
 {
 	dbg("udsl_usb_init: driver version " DRIVER_VERSION);
@@ -1322,18 +1312,10 @@
 	    || (snd_buf_size > UDSL_MAX_SND_BUF_SIZE))
 		return -EINVAL;
 
-	return usb_register(&usbatm_driver);;
+	return 0;
 }
 module_init(udsl_usb_init);
 
-static void __exit udsl_usb_exit(void)
-{
-	dbg("udsl_usb_exit");
-
-	usb_deregister (&usbatm_driver);
-}
-module_exit(udsl_usb_exit);
-
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");

--- minidrivers.h DELETED ---




More information about the Usbatm-commits mailing list