aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2008-10-21 06:01:42 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-10-22 12:56:39 -0400
commitdd38da4617471cd8a46243318e2a14922240c711 (patch)
tree175f76ce6a04e694662ccfa0160a97717f36c232
parentdc7e04fe28e3354e8b2e13146b2d6a5da1002ff4 (diff)
Staging: w35und: module init cleanup
This patch cleans up the module init functions a bit and removes the redundant device ID check from wb35_probe() function. Acked-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/winbond/linux/wbusb.c87
1 files changed, 31 insertions, 56 deletions
diff --git a/drivers/staging/winbond/linux/wbusb.c b/drivers/staging/winbond/linux/wbusb.c
index e09b2720850b..fb216de1c6ba 100644
--- a/drivers/staging/winbond/linux/wbusb.c
+++ b/drivers/staging/winbond/linux/wbusb.c
@@ -6,36 +6,23 @@
6#include "sysdef.h" 6#include "sysdef.h"
7#include <net/mac80211.h> 7#include <net/mac80211.h>
8 8
9 9MODULE_AUTHOR(DRIVER_AUTHOR);
10MODULE_AUTHOR( DRIVER_AUTHOR ); 10MODULE_DESCRIPTION(DRIVER_DESC);
11MODULE_DESCRIPTION( DRIVER_DESC );
12MODULE_LICENSE("GPL"); 11MODULE_LICENSE("GPL");
13MODULE_VERSION("0.1"); 12MODULE_VERSION("0.1");
14 13
15 14static struct usb_device_id wb35_table[] __devinitdata = {
16//============================================================ 15 {USB_DEVICE(0x0416, 0x0035)},
17// vendor ID and product ID can into here for others 16 {USB_DEVICE(0x18E8, 0x6201)},
18//============================================================ 17 {USB_DEVICE(0x18E8, 0x6206)},
19static struct usb_device_id Id_Table[] = 18 {USB_DEVICE(0x18E8, 0x6217)},
20{ 19 {USB_DEVICE(0x18E8, 0x6230)},
21 {USB_DEVICE( 0x0416, 0x0035 )}, 20 {USB_DEVICE(0x18E8, 0x6233)},
22 {USB_DEVICE( 0x18E8, 0x6201 )}, 21 {USB_DEVICE(0x1131, 0x2035)},
23 {USB_DEVICE( 0x18E8, 0x6206 )}, 22 {}
24 {USB_DEVICE( 0x18E8, 0x6217 )},
25 {USB_DEVICE( 0x18E8, 0x6230 )},
26 {USB_DEVICE( 0x18E8, 0x6233 )},
27 {USB_DEVICE( 0x1131, 0x2035 )},
28 { }
29}; 23};
30 24
31MODULE_DEVICE_TABLE(usb, Id_Table); 25MODULE_DEVICE_TABLE(usb, wb35_table);
32
33static struct usb_driver wb35_driver = {
34 .name = "w35und",
35 .probe = wb35_probe,
36 .disconnect = wb35_disconnect,
37 .id_table = Id_Table,
38};
39 26
40static const struct ieee80211_rate wbsoft_rates[] = { 27static const struct ieee80211_rate wbsoft_rates[] = {
41 { .bitrate = 10, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, 28 { .bitrate = 10, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
@@ -187,21 +174,6 @@ struct wbsoft_priv {
187}; 174};
188 175
189 176
190int __init wb35_init(void)
191{
192 printk("[w35und]driver init\n");
193 return usb_register(&wb35_driver);
194}
195
196void __exit wb35_exit(void)
197{
198 printk("[w35und]driver exit\n");
199 usb_deregister( &wb35_driver );
200}
201
202module_init(wb35_init);
203module_exit(wb35_exit);
204
205// Usb kernel subsystem will call this function when a new device is plugged into. 177// Usb kernel subsystem will call this function when a new device is plugged into.
206int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table) 178int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
207{ 179{
@@ -210,7 +182,7 @@ int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
210 PWBUSB pWbUsb; 182 PWBUSB pWbUsb;
211 struct usb_host_interface *interface; 183 struct usb_host_interface *interface;
212 struct usb_endpoint_descriptor *endpoint; 184 struct usb_endpoint_descriptor *endpoint;
213 int i, ret = -1; 185 int ret = -1;
214 u32 ltmp; 186 u32 ltmp;
215 struct usb_device *udev = interface_to_usbdev(intf); 187 struct usb_device *udev = interface_to_usbdev(intf);
216 188
@@ -218,21 +190,6 @@ int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table)
218 190
219 printk("[w35und]wb35_probe ->\n"); 191 printk("[w35und]wb35_probe ->\n");
220 192
221 for (i=0; i<(sizeof(Id_Table)/sizeof(struct usb_device_id)); i++ ) {
222 if ((udev->descriptor.idVendor == Id_Table[i].idVendor) &&
223 (udev->descriptor.idProduct == Id_Table[i].idProduct)) {
224 printk("[w35und]Found supported hardware\n");
225 break;
226 }
227 }
228
229 if ((i == (sizeof(Id_Table)/sizeof(struct usb_device_id)))) {
230 #ifdef _PE_USB_INI_DUMP_
231 WBDEBUG(("[w35und] This is not the one we are interested about\n"));
232 #endif
233 return -ENODEV;
234 }
235
236 // 20060630.2 Check the device if it already be opened 193 // 20060630.2 Check the device if it already be opened
237 ret = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ), 194 ret = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ),
238 0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN, 195 0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN,
@@ -398,4 +355,22 @@ void wb35_disconnect(struct usb_interface *intf)
398 355
399} 356}
400 357
358static struct usb_driver wb35_driver = {
359 .name = "w35und",
360 .id_table = wb35_table,
361 .probe = wb35_probe,
362 .disconnect = wb35_disconnect,
363};
364
365static int __init wb35_init(void)
366{
367 return usb_register(&wb35_driver);
368}
369
370static void __exit wb35_exit(void)
371{
372 usb_deregister(&wb35_driver);
373}
401 374
375module_init(wb35_init);
376module_exit(wb35_exit);