speedtch usbatm.c,1.3,1.4 usbatm.h,1.7,1.8 cxacru.c,1.7,1.8
Duncan Sands
duncan at infradead.org
Tue Feb 1 18:20:53 EST 2005
Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv26784
Modified Files:
usbatm.c usbatm.h cxacru.c
Log Message:
Simplify registration. Patch by Roman Kagan.
Index: usbatm.c
===================================================================
RCS file: /home/cvs/speedtch/usbatm.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- usbatm.c 28 Jan 2005 23:55:40 -0000 1.3
+++ usbatm.c 1 Feb 2005 23:20:49 -0000 1.4
@@ -202,12 +202,6 @@
};
-/* mini drivers */
-
-static DECLARE_MUTEX(usbatm_driver_sem);
-static LIST_HEAD(usbatm_driver_list);
-
-
/***********
** misc **
***********/
@@ -1034,10 +1028,10 @@
return 0;
}
-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 usbatm_driver *driver)
{
struct usb_device *dev = interface_to_usbdev(intf);
- struct usbatm_driver *driver = NULL, *candidate;
struct usbatm_data *instance;
char *buf;
int error = -ENOMEM;
@@ -1047,19 +1041,6 @@
dev_dbg(&intf->dev, "trying device with vendor=0x%x, product=0x%x, ifnum %d\n", dev->descriptor.idVendor, dev->descriptor.idProduct, ifnum);
- down(&usbatm_driver_sem);
- list_for_each_entry(candidate, &usbatm_driver_list, driver_list)
- if (usb_match_id(intf, candidate->id_table)) {
- driver = candidate;
- break;
- }
- up(&usbatm_driver_sem);
-
- if (!driver) {
- dev_dbg(&intf->dev, "no matching usbatm driver!\n");
- return -ENODEV;
- }
-
/* instance init */
if (!(instance = kmalloc(sizeof(*instance), GFP_KERNEL))) {
dev_dbg(&intf->dev, "no memory for instance data!\n");
@@ -1297,28 +1278,6 @@
** init **
***********/
-int usbatm_register (struct usbatm_driver *driver)
-{
- dbg("registering usbatm driver %s", driver->driver_name);
-
- down(&usbatm_driver_sem);
- list_add(&driver->driver_list, &usbatm_driver_list);
- up(&usbatm_driver_sem);
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(usbatm_register);
-
-void usbatm_deregister (struct usbatm_driver *driver)
-{
- dbg("deregistering usbatm driver %s", driver->driver_name);
-
- down(&usbatm_driver_sem);
- list_del(&driver->driver_list);
- up(&usbatm_driver_sem);
-}
-EXPORT_SYMBOL_GPL(usbatm_deregister);
-
static int __init usbatm_usb_init(void)
{
dbg("usbatm_usb_init: driver version " DRIVER_VERSION);
Index: usbatm.h
===================================================================
RCS file: /home/cvs/speedtch/usbatm.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- usbatm.h 28 Jan 2005 23:51:52 -0000 1.7
+++ usbatm.h 1 Feb 2005 23:20:49 -0000 1.8
@@ -64,7 +64,6 @@
struct module *owner;
const char *driver_name;
- const struct usb_device_id *id_table;
/*
* init device ... can sleep, or cause probe() failure. Drivers with a heavy_init
@@ -89,15 +88,10 @@
unsigned rx_padding;
unsigned tx_padding;
-
- /* private */
- struct list_head driver_list;
};
-extern int usbatm_register(struct usbatm_driver *driver);
-extern void usbatm_deregister(struct usbatm_driver *driver);
-
-extern int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id);
+extern int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
+ struct usbatm_driver *driver);
extern void usbatm_usb_disconnect(struct usb_interface *intf);
Index: cxacru.c
===================================================================
RCS file: /home/cvs/speedtch/cxacru.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cxacru.c 28 Jan 2005 23:55:40 -0000 1.7
+++ cxacru.c 1 Feb 2005 23:20:49 -0000 1.8
@@ -825,7 +825,6 @@
static struct usbatm_driver cxacru_driver = {
.owner = THIS_MODULE,
.driver_name = cxacru_driver_name,
- .id_table = cxacru_usb_ids,
.bind = cxacru_bind,
.heavy_init = cxacru_heavy_init,
.unbind = cxacru_unbind,
@@ -836,33 +835,27 @@
.tx_padding = 11,
};
+static int cxacru_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
+{
+ return usbatm_usb_probe(intf, id, &cxacru_driver);
+}
+
static struct usb_driver cxacru_usb_driver = {
.owner = THIS_MODULE,
.name = cxacru_driver_name,
- .probe = usbatm_usb_probe,
+ .probe = cxacru_usb_probe,
.disconnect = usbatm_usb_disconnect,
.id_table = cxacru_usb_ids
};
static int __init cxacru_init(void)
{
- int ret;
-
- if ((ret = usbatm_register(&cxacru_driver)))
- return ret;
-
- if ((ret = usb_register(&cxacru_usb_driver))) {
- usbatm_deregister(&cxacru_driver);
- return ret;
- }
-
- return 0;
+ return usb_register(&cxacru_usb_driver);
}
static void __exit cxacru_cleanup(void)
{
usb_deregister(&cxacru_usb_driver);
- usbatm_deregister(&cxacru_driver);
}
module_init(cxacru_init);
More information about the Usbatm-commits
mailing list