diff options
author | Tilman Schmidt <tilman@imap.cc> | 2008-02-06 04:38:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 13:41:11 -0500 |
commit | c652cbd8ee114307baab072e4e560dce5c5fb12a (patch) | |
tree | 093a7933798841060bbb2f7c847f31d1ee1d906d /drivers/isdn | |
parent | dbd9823121b4e369bc414be75e12b4f6c84c52c0 (diff) |
gigaset: code cleanups
Some cleanups to the bas-gigaset and usb-gigaset USB ISDN drivers:
- simplified error handling
- improved debug messages
- readability improvements
- removal of obsolete defines and comments
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Cc: Greg KH <gregkh@suse.de>
Cc: Hansjoerg Lipp <hjlipp@web.de>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/gigaset/bas-gigaset.c | 45 | ||||
-rw-r--r-- | drivers/isdn/gigaset/gigaset.h | 18 | ||||
-rw-r--r-- | drivers/isdn/gigaset/usb-gigaset.c | 92 |
3 files changed, 73 insertions, 82 deletions
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 0302c40a27ea..d60a6510e92b 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -938,15 +938,15 @@ static int starturbs(struct bc_state *bcs) | |||
938 | ubc->isoouturbs[k].limit = -1; | 938 | ubc->isoouturbs[k].limit = -1; |
939 | } | 939 | } |
940 | 940 | ||
941 | /* submit two URBs, keep third one */ | 941 | /* keep one URB free, submit the others */ |
942 | for (k = 0; k < 2; ++k) { | 942 | for (k = 0; k < BAS_OUTURBS-1; ++k) { |
943 | dump_urb(DEBUG_ISO, "Initial isoc write", urb); | 943 | dump_urb(DEBUG_ISO, "Initial isoc write", urb); |
944 | rc = usb_submit_urb(ubc->isoouturbs[k].urb, GFP_ATOMIC); | 944 | rc = usb_submit_urb(ubc->isoouturbs[k].urb, GFP_ATOMIC); |
945 | if (rc != 0) | 945 | if (rc != 0) |
946 | goto error; | 946 | goto error; |
947 | } | 947 | } |
948 | dump_urb(DEBUG_ISO, "Initial isoc write (free)", urb); | 948 | dump_urb(DEBUG_ISO, "Initial isoc write (free)", urb); |
949 | ubc->isooutfree = &ubc->isoouturbs[2]; | 949 | ubc->isooutfree = &ubc->isoouturbs[BAS_OUTURBS-1]; |
950 | ubc->isooutdone = ubc->isooutovfl = NULL; | 950 | ubc->isooutdone = ubc->isooutovfl = NULL; |
951 | return 0; | 951 | return 0; |
952 | error: | 952 | error: |
@@ -1559,37 +1559,38 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout) | |||
1559 | */ | 1559 | */ |
1560 | static int gigaset_init_bchannel(struct bc_state *bcs) | 1560 | static int gigaset_init_bchannel(struct bc_state *bcs) |
1561 | { | 1561 | { |
1562 | struct cardstate *cs = bcs->cs; | ||
1562 | int req, ret; | 1563 | int req, ret; |
1563 | unsigned long flags; | 1564 | unsigned long flags; |
1564 | 1565 | ||
1565 | spin_lock_irqsave(&bcs->cs->lock, flags); | 1566 | spin_lock_irqsave(&cs->lock, flags); |
1566 | if (unlikely(!bcs->cs->connected)) { | 1567 | if (unlikely(!cs->connected)) { |
1567 | gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); | 1568 | gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); |
1568 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | 1569 | spin_unlock_irqrestore(&cs->lock, flags); |
1569 | return -ENODEV; | 1570 | return -ENODEV; |
1570 | } | 1571 | } |
1571 | 1572 | ||
1572 | if ((ret = starturbs(bcs)) < 0) { | 1573 | if ((ret = starturbs(bcs)) < 0) { |
1573 | dev_err(bcs->cs->dev, | 1574 | dev_err(cs->dev, |
1574 | "could not start isochronous I/O for channel B%d: %s\n", | 1575 | "could not start isochronous I/O for channel B%d: %s\n", |
1575 | bcs->channel + 1, | 1576 | bcs->channel + 1, |
1576 | ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); | 1577 | ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); |
1577 | if (ret != -ENODEV) | 1578 | if (ret != -ENODEV) |
1578 | error_hangup(bcs); | 1579 | error_hangup(bcs); |
1579 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | 1580 | spin_unlock_irqrestore(&cs->lock, flags); |
1580 | return ret; | 1581 | return ret; |
1581 | } | 1582 | } |
1582 | 1583 | ||
1583 | req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL; | 1584 | req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL; |
1584 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) { | 1585 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) { |
1585 | dev_err(bcs->cs->dev, "could not open channel B%d\n", | 1586 | dev_err(cs->dev, "could not open channel B%d\n", |
1586 | bcs->channel + 1); | 1587 | bcs->channel + 1); |
1587 | stopurbs(bcs->hw.bas); | 1588 | stopurbs(bcs->hw.bas); |
1588 | if (ret != -ENODEV) | 1589 | if (ret != -ENODEV) |
1589 | error_hangup(bcs); | 1590 | error_hangup(bcs); |
1590 | } | 1591 | } |
1591 | 1592 | ||
1592 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | 1593 | spin_unlock_irqrestore(&cs->lock, flags); |
1593 | return ret; | 1594 | return ret; |
1594 | } | 1595 | } |
1595 | 1596 | ||
@@ -1605,20 +1606,21 @@ static int gigaset_init_bchannel(struct bc_state *bcs) | |||
1605 | */ | 1606 | */ |
1606 | static int gigaset_close_bchannel(struct bc_state *bcs) | 1607 | static int gigaset_close_bchannel(struct bc_state *bcs) |
1607 | { | 1608 | { |
1609 | struct cardstate *cs = bcs->cs; | ||
1608 | int req, ret; | 1610 | int req, ret; |
1609 | unsigned long flags; | 1611 | unsigned long flags; |
1610 | 1612 | ||
1611 | spin_lock_irqsave(&bcs->cs->lock, flags); | 1613 | spin_lock_irqsave(&cs->lock, flags); |
1612 | if (unlikely(!bcs->cs->connected)) { | 1614 | if (unlikely(!cs->connected)) { |
1613 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | 1615 | spin_unlock_irqrestore(&cs->lock, flags); |
1614 | gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); | 1616 | gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); |
1615 | return -ENODEV; | 1617 | return -ENODEV; |
1616 | } | 1618 | } |
1617 | 1619 | ||
1618 | if (!(atomic_read(&bcs->cs->hw.bas->basstate) & | 1620 | if (!(atomic_read(&cs->hw.bas->basstate) & |
1619 | (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) { | 1621 | (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) { |
1620 | /* channel not running: just signal common.c */ | 1622 | /* channel not running: just signal common.c */ |
1621 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | 1623 | spin_unlock_irqrestore(&cs->lock, flags); |
1622 | gigaset_bchannel_down(bcs); | 1624 | gigaset_bchannel_down(bcs); |
1623 | return 0; | 1625 | return 0; |
1624 | } | 1626 | } |
@@ -1626,10 +1628,10 @@ static int gigaset_close_bchannel(struct bc_state *bcs) | |||
1626 | /* channel running: tell device to close it */ | 1628 | /* channel running: tell device to close it */ |
1627 | req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL; | 1629 | req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL; |
1628 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) | 1630 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) |
1629 | dev_err(bcs->cs->dev, "closing channel B%d failed\n", | 1631 | dev_err(cs->dev, "closing channel B%d failed\n", |
1630 | bcs->channel + 1); | 1632 | bcs->channel + 1); |
1631 | 1633 | ||
1632 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | 1634 | spin_unlock_irqrestore(&cs->lock, flags); |
1633 | return ret; | 1635 | return ret; |
1634 | } | 1636 | } |
1635 | 1637 | ||
@@ -2114,7 +2116,7 @@ static void freeurbs(struct cardstate *cs) | |||
2114 | int i, j; | 2116 | int i, j; |
2115 | 2117 | ||
2116 | gig_dbg(DEBUG_INIT, "%s: killing URBs", __func__); | 2118 | gig_dbg(DEBUG_INIT, "%s: killing URBs", __func__); |
2117 | for (j = 0; j < 2; ++j) { | 2119 | for (j = 0; j < BAS_CHANNELS; ++j) { |
2118 | ubc = cs->bcs[j].hw.bas; | 2120 | ubc = cs->bcs[j].hw.bas; |
2119 | for (i = 0; i < BAS_OUTURBS; ++i) { | 2121 | for (i = 0; i < BAS_OUTURBS; ++i) { |
2120 | usb_kill_urb(ubc->isoouturbs[i].urb); | 2122 | usb_kill_urb(ubc->isoouturbs[i].urb); |
@@ -2215,7 +2217,7 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2215 | !(ucs->urb_ctrl = usb_alloc_urb(0, GFP_KERNEL))) | 2217 | !(ucs->urb_ctrl = usb_alloc_urb(0, GFP_KERNEL))) |
2216 | goto allocerr; | 2218 | goto allocerr; |
2217 | 2219 | ||
2218 | for (j = 0; j < 2; ++j) { | 2220 | for (j = 0; j < BAS_CHANNELS; ++j) { |
2219 | ubc = cs->bcs[j].hw.bas; | 2221 | ubc = cs->bcs[j].hw.bas; |
2220 | for (i = 0; i < BAS_OUTURBS; ++i) | 2222 | for (i = 0; i < BAS_OUTURBS; ++i) |
2221 | if (!(ubc->isoouturbs[i].urb = | 2223 | if (!(ubc->isoouturbs[i].urb = |
@@ -2287,8 +2289,7 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
2287 | atomic_set(&ucs->basstate, 0); | 2289 | atomic_set(&ucs->basstate, 0); |
2288 | 2290 | ||
2289 | /* tell LL all channels are down */ | 2291 | /* tell LL all channels are down */ |
2290 | //FIXME shouldn't gigaset_stop() do this? | 2292 | for (j = 0; j < BAS_CHANNELS; ++j) |
2291 | for (j = 0; j < 2; ++j) | ||
2292 | gigaset_bchannel_down(cs->bcs + j); | 2293 | gigaset_bchannel_down(cs->bcs + j); |
2293 | 2294 | ||
2294 | /* stop driver (common part) */ | 2295 | /* stop driver (common part) */ |
@@ -2343,7 +2344,7 @@ static int __init bas_gigaset_init(void) | |||
2343 | goto error; | 2344 | goto error; |
2344 | 2345 | ||
2345 | /* allocate memory for our device state and intialize it */ | 2346 | /* allocate memory for our device state and intialize it */ |
2346 | cardstate = gigaset_initcs(driver, 2, 0, 0, cidmode, | 2347 | cardstate = gigaset_initcs(driver, BAS_CHANNELS, 0, 0, cidmode, |
2347 | GIGASET_MODULENAME); | 2348 | GIGASET_MODULENAME); |
2348 | if (!cardstate) | 2349 | if (!cardstate) |
2349 | goto error; | 2350 | goto error; |
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index c67b5f97c133..8303625d0401 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h | |||
@@ -70,22 +70,13 @@ | |||
70 | 70 | ||
71 | extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */ | 71 | extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */ |
72 | 72 | ||
73 | /* any combination of these can be given with the 'debug=' parameter to insmod, | 73 | /* debug flags, combine by adding/bitwise OR */ |
74 | * e.g. 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and | ||
75 | * DEBUG_INTR. | ||
76 | */ | ||
77 | enum debuglevel { | 74 | enum debuglevel { |
78 | DEBUG_REG = 0x0002, /* serial port I/O register operations */ | 75 | DEBUG_INTR = 0x00008, /* interrupt processing */ |
79 | DEBUG_OPEN = 0x0004, /* open/close serial port */ | ||
80 | DEBUG_INTR = 0x0008, /* interrupt processing */ | ||
81 | DEBUG_INTR_DUMP = 0x0010, /* Activating hexdump debug output on | ||
82 | interrupt requests, not available as | ||
83 | run-time option */ | ||
84 | DEBUG_CMD = 0x00020, /* sent/received LL commands */ | 76 | DEBUG_CMD = 0x00020, /* sent/received LL commands */ |
85 | DEBUG_STREAM = 0x00040, /* application data stream I/O events */ | 77 | DEBUG_STREAM = 0x00040, /* application data stream I/O events */ |
86 | DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */ | 78 | DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */ |
87 | DEBUG_LLDATA = 0x00100, /* sent/received LL data */ | 79 | DEBUG_LLDATA = 0x00100, /* sent/received LL data */ |
88 | DEBUG_INTR_0 = 0x00200, /* serial port interrupt processing */ | ||
89 | DEBUG_DRIVER = 0x00400, /* driver structure */ | 80 | DEBUG_DRIVER = 0x00400, /* driver structure */ |
90 | DEBUG_HDLC = 0x00800, /* M10x HDLC processing */ | 81 | DEBUG_HDLC = 0x00800, /* M10x HDLC processing */ |
91 | DEBUG_WRITE = 0x01000, /* M105 data write */ | 82 | DEBUG_WRITE = 0x01000, /* M105 data write */ |
@@ -93,7 +84,7 @@ enum debuglevel { | |||
93 | DEBUG_MCMD = 0x04000, /* COMMANDS THAT ARE SENT VERY OFTEN */ | 84 | DEBUG_MCMD = 0x04000, /* COMMANDS THAT ARE SENT VERY OFTEN */ |
94 | DEBUG_INIT = 0x08000, /* (de)allocation+initialization of data | 85 | DEBUG_INIT = 0x08000, /* (de)allocation+initialization of data |
95 | structures */ | 86 | structures */ |
96 | DEBUG_LOCK = 0x10000, /* semaphore operations */ | 87 | DEBUG_SUSPEND = 0x10000, /* suspend/resume processing */ |
97 | DEBUG_OUTPUT = 0x20000, /* output to device */ | 88 | DEBUG_OUTPUT = 0x20000, /* output to device */ |
98 | DEBUG_ISO = 0x40000, /* isochronous transfers */ | 89 | DEBUG_ISO = 0x40000, /* isochronous transfers */ |
99 | DEBUG_IF = 0x80000, /* character device operations */ | 90 | DEBUG_IF = 0x80000, /* character device operations */ |
@@ -191,6 +182,9 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, | |||
191 | #define HD_OPEN_ATCHANNEL (0x28) // 3070 | 182 | #define HD_OPEN_ATCHANNEL (0x28) // 3070 |
192 | #define HD_CLOSE_ATCHANNEL (0x29) // 3070 | 183 | #define HD_CLOSE_ATCHANNEL (0x29) // 3070 |
193 | 184 | ||
185 | /* number of B channels supported by base driver */ | ||
186 | #define BAS_CHANNELS 2 | ||
187 | |||
194 | /* USB frames for isochronous transfer */ | 188 | /* USB frames for isochronous transfer */ |
195 | #define BAS_FRAMETIME 1 /* number of milliseconds between frames */ | 189 | #define BAS_FRAMETIME 1 /* number of milliseconds between frames */ |
196 | #define BAS_NUMFRAMES 8 /* number of frames per URB */ | 190 | #define BAS_NUMFRAMES 8 /* number of frames per URB */ |
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index 0bd5d4ba11cd..d81c0e3f7702 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c | |||
@@ -104,6 +104,7 @@ MODULE_DEVICE_TABLE(usb, gigaset_table); | |||
104 | * flags per packet. | 104 | * flags per packet. |
105 | */ | 105 | */ |
106 | 106 | ||
107 | /* functions called if a device of this driver is connected/disconnected */ | ||
107 | static int gigaset_probe(struct usb_interface *interface, | 108 | static int gigaset_probe(struct usb_interface *interface, |
108 | const struct usb_device_id *id); | 109 | const struct usb_device_id *id); |
109 | static void gigaset_disconnect(struct usb_interface *interface); | 110 | static void gigaset_disconnect(struct usb_interface *interface); |
@@ -362,18 +363,12 @@ static void gigaset_read_int_callback(struct urb *urb) | |||
362 | struct inbuf_t *inbuf = urb->context; | 363 | struct inbuf_t *inbuf = urb->context; |
363 | struct cardstate *cs = inbuf->cs; | 364 | struct cardstate *cs = inbuf->cs; |
364 | int status = urb->status; | 365 | int status = urb->status; |
365 | int resubmit = 0; | ||
366 | int r; | 366 | int r; |
367 | unsigned numbytes; | 367 | unsigned numbytes; |
368 | unsigned char *src; | 368 | unsigned char *src; |
369 | unsigned long flags; | 369 | unsigned long flags; |
370 | 370 | ||
371 | if (!status) { | 371 | if (!status) { |
372 | if (!cs->connected) { | ||
373 | err("%s: disconnected", __func__); /* should never happen */ | ||
374 | return; | ||
375 | } | ||
376 | |||
377 | numbytes = urb->actual_length; | 372 | numbytes = urb->actual_length; |
378 | 373 | ||
379 | if (numbytes) { | 374 | if (numbytes) { |
@@ -390,28 +385,26 @@ static void gigaset_read_int_callback(struct urb *urb) | |||
390 | } | 385 | } |
391 | } else | 386 | } else |
392 | gig_dbg(DEBUG_INTR, "Received zero block length"); | 387 | gig_dbg(DEBUG_INTR, "Received zero block length"); |
393 | resubmit = 1; | ||
394 | } else { | 388 | } else { |
395 | /* The urb might have been killed. */ | 389 | /* The urb might have been killed. */ |
396 | gig_dbg(DEBUG_ANY, "%s - nonzero read bulk status received: %d", | 390 | gig_dbg(DEBUG_ANY, "%s - nonzero status received: %d", |
397 | __func__, status); | 391 | __func__, status); |
398 | if (status != -ENOENT) { /* not killed */ | 392 | if (status == -ENOENT || status == -ESHUTDOWN) |
399 | if (!cs->connected) { | 393 | /* killed or endpoint shutdown: don't resubmit */ |
400 | err("%s: disconnected", __func__); /* should never happen */ | 394 | return; |
401 | return; | ||
402 | } | ||
403 | resubmit = 1; | ||
404 | } | ||
405 | } | 395 | } |
406 | 396 | ||
407 | if (resubmit) { | 397 | /* resubmit URB */ |
408 | spin_lock_irqsave(&cs->lock, flags); | 398 | spin_lock_irqsave(&cs->lock, flags); |
409 | r = cs->connected ? usb_submit_urb(urb, GFP_ATOMIC) : -ENODEV; | 399 | if (!cs->connected) { |
410 | spin_unlock_irqrestore(&cs->lock, flags); | 400 | spin_unlock_irqrestore(&cs->lock, flags); |
411 | if (r) | 401 | err("%s: disconnected", __func__); |
412 | dev_err(cs->dev, "error %d when resubmitting urb.\n", | 402 | return; |
413 | -r); | ||
414 | } | 403 | } |
404 | r = usb_submit_urb(urb, GFP_ATOMIC); | ||
405 | spin_unlock_irqrestore(&cs->lock, flags); | ||
406 | if (r) | ||
407 | dev_err(cs->dev, "error %d resubmitting URB\n", -r); | ||
415 | } | 408 | } |
416 | 409 | ||
417 | 410 | ||
@@ -422,11 +415,19 @@ static void gigaset_write_bulk_callback(struct urb *urb) | |||
422 | int status = urb->status; | 415 | int status = urb->status; |
423 | unsigned long flags; | 416 | unsigned long flags; |
424 | 417 | ||
425 | if (status) | 418 | switch (status) { |
419 | case 0: /* normal completion */ | ||
420 | break; | ||
421 | case -ENOENT: /* killed */ | ||
422 | gig_dbg(DEBUG_ANY, "%s: killed", __func__); | ||
423 | atomic_set(&cs->hw.usb->busy, 0); | ||
424 | return; | ||
425 | default: | ||
426 | dev_err(cs->dev, "bulk transfer failed (status %d)\n", | 426 | dev_err(cs->dev, "bulk transfer failed (status %d)\n", |
427 | -status); | 427 | -status); |
428 | /* That's all we can do. Communication problems | 428 | /* That's all we can do. Communication problems |
429 | are handled by timeouts or network protocols. */ | 429 | are handled by timeouts or network protocols. */ |
430 | } | ||
430 | 431 | ||
431 | spin_lock_irqsave(&cs->lock, flags); | 432 | spin_lock_irqsave(&cs->lock, flags); |
432 | if (!cs->connected) { | 433 | if (!cs->connected) { |
@@ -682,43 +683,35 @@ static int gigaset_probe(struct usb_interface *interface, | |||
682 | { | 683 | { |
683 | int retval; | 684 | int retval; |
684 | struct usb_device *udev = interface_to_usbdev(interface); | 685 | struct usb_device *udev = interface_to_usbdev(interface); |
685 | unsigned int ifnum; | 686 | struct usb_host_interface *hostif = interface->cur_altsetting; |
686 | struct usb_host_interface *hostif; | ||
687 | struct cardstate *cs = NULL; | 687 | struct cardstate *cs = NULL; |
688 | struct usb_cardstate *ucs = NULL; | 688 | struct usb_cardstate *ucs = NULL; |
689 | struct usb_endpoint_descriptor *endpoint; | 689 | struct usb_endpoint_descriptor *endpoint; |
690 | int buffer_size; | 690 | int buffer_size; |
691 | int alt; | ||
692 | |||
693 | gig_dbg(DEBUG_ANY, | ||
694 | "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", | ||
695 | __func__, le16_to_cpu(udev->descriptor.idVendor), | ||
696 | le16_to_cpu(udev->descriptor.idProduct)); | ||
697 | 691 | ||
698 | retval = -ENODEV; //FIXME | 692 | gig_dbg(DEBUG_ANY, "%s: Check if device matches ...", __func__); |
699 | 693 | ||
700 | /* See if the device offered us matches what we can accept */ | 694 | /* See if the device offered us matches what we can accept */ |
701 | if ((le16_to_cpu(udev->descriptor.idVendor) != USB_M105_VENDOR_ID) || | 695 | if ((le16_to_cpu(udev->descriptor.idVendor) != USB_M105_VENDOR_ID) || |
702 | (le16_to_cpu(udev->descriptor.idProduct) != USB_M105_PRODUCT_ID)) | 696 | (le16_to_cpu(udev->descriptor.idProduct) != USB_M105_PRODUCT_ID)) { |
697 | gig_dbg(DEBUG_ANY, "device ID (0x%x, 0x%x) not for me - skip", | ||
698 | le16_to_cpu(udev->descriptor.idVendor), | ||
699 | le16_to_cpu(udev->descriptor.idProduct)); | ||
703 | return -ENODEV; | 700 | return -ENODEV; |
704 | 701 | } | |
705 | /* this starts to become ascii art... */ | 702 | if (hostif->desc.bInterfaceNumber != 0) { |
706 | hostif = interface->cur_altsetting; | 703 | gig_dbg(DEBUG_ANY, "interface %d not for me - skip", |
707 | alt = hostif->desc.bAlternateSetting; | 704 | hostif->desc.bInterfaceNumber); |
708 | ifnum = hostif->desc.bInterfaceNumber; // FIXME ? | 705 | return -ENODEV; |
709 | 706 | } | |
710 | if (alt != 0 || ifnum != 0) { | 707 | if (hostif->desc.bAlternateSetting != 0) { |
711 | dev_warn(&udev->dev, "ifnum %d, alt %d\n", ifnum, alt); | 708 | dev_notice(&udev->dev, "unsupported altsetting %d - skip", |
709 | hostif->desc.bAlternateSetting); | ||
712 | return -ENODEV; | 710 | return -ENODEV; |
713 | } | 711 | } |
714 | |||
715 | /* Reject application specific intefaces | ||
716 | * | ||
717 | */ | ||
718 | if (hostif->desc.bInterfaceClass != 255) { | 712 | if (hostif->desc.bInterfaceClass != 255) { |
719 | dev_info(&udev->dev, | 713 | dev_notice(&udev->dev, "unsupported interface class %d - skip", |
720 | "%s: Device matched but iface_desc[%d]->bInterfaceClass==%d!\n", | 714 | hostif->desc.bInterfaceClass); |
721 | __func__, ifnum, hostif->desc.bInterfaceClass); | ||
722 | return -ENODEV; | 715 | return -ENODEV; |
723 | } | 716 | } |
724 | 717 | ||
@@ -826,6 +819,9 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
826 | 819 | ||
827 | cs = usb_get_intfdata(interface); | 820 | cs = usb_get_intfdata(interface); |
828 | ucs = cs->hw.usb; | 821 | ucs = cs->hw.usb; |
822 | |||
823 | dev_info(cs->dev, "disconnecting Gigaset USB adapter\n"); | ||
824 | |||
829 | usb_kill_urb(ucs->read_urb); | 825 | usb_kill_urb(ucs->read_urb); |
830 | 826 | ||
831 | gigaset_stop(cs); | 827 | gigaset_stop(cs); |
@@ -833,7 +829,7 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
833 | usb_set_intfdata(interface, NULL); | 829 | usb_set_intfdata(interface, NULL); |
834 | tasklet_kill(&cs->write_tasklet); | 830 | tasklet_kill(&cs->write_tasklet); |
835 | 831 | ||
836 | usb_kill_urb(ucs->bulk_out_urb); /* FIXME: only if active? */ | 832 | usb_kill_urb(ucs->bulk_out_urb); |
837 | 833 | ||
838 | kfree(ucs->bulk_out_buffer); | 834 | kfree(ucs->bulk_out_buffer); |
839 | usb_free_urb(ucs->bulk_out_urb); | 835 | usb_free_urb(ucs->bulk_out_urb); |