aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/bas-gigaset.c
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2009-10-25 05:30:37 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-29 04:37:14 -0400
commit7891adf18ad9658950e532b840f1d84d8ac6cce2 (patch)
treeb26fca6cf86a0af2e29fa24ad816f7bd144c5bbd /drivers/isdn/gigaset/bas-gigaset.c
parentae67d7d81436c7e85104d586562b1a220d3cd94b (diff)
bas_gigaset: checkpatch cleanup
On the quest for the holy grail of checkpatch.pl silence. Impact: cosmetic Signed-off-by: Tilman Schmidt <tilman@imap.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/gigaset/bas-gigaset.c')
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c68
1 files changed, 41 insertions, 27 deletions
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 388e63a8ae94..9fd19db045fb 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -57,7 +57,7 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode");
57#define USB_SX353_PRODUCT_ID 0x0022 57#define USB_SX353_PRODUCT_ID 0x0022
58 58
59/* table of devices that work with this driver */ 59/* table of devices that work with this driver */
60static const struct usb_device_id gigaset_table [] = { 60static const struct usb_device_id gigaset_table[] = {
61 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) }, 61 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) },
62 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) }, 62 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) },
63 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) }, 63 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) },
@@ -137,7 +137,7 @@ struct bas_cardstate {
137#define BS_RESETTING 0x200 /* waiting for HD_RESET_INTERRUPT_PIPE_ACK */ 137#define BS_RESETTING 0x200 /* waiting for HD_RESET_INTERRUPT_PIPE_ACK */
138 138
139 139
140static struct gigaset_driver *driver = NULL; 140static struct gigaset_driver *driver;
141 141
142/* usb specific object needed to register this driver with the usb subsystem */ 142/* usb specific object needed to register this driver with the usb subsystem */
143static struct usb_driver gigaset_usb_driver = { 143static struct usb_driver gigaset_usb_driver = {
@@ -601,11 +601,12 @@ static int atread_submit(struct cardstate *cs, int timeout)
601 ucs->dr_cmd_in.wLength = cpu_to_le16(ucs->rcvbuf_size); 601 ucs->dr_cmd_in.wLength = cpu_to_le16(ucs->rcvbuf_size);
602 usb_fill_control_urb(ucs->urb_cmd_in, ucs->udev, 602 usb_fill_control_urb(ucs->urb_cmd_in, ucs->udev,
603 usb_rcvctrlpipe(ucs->udev, 0), 603 usb_rcvctrlpipe(ucs->udev, 0),
604 (unsigned char*) & ucs->dr_cmd_in, 604 (unsigned char *) &ucs->dr_cmd_in,
605 ucs->rcvbuf, ucs->rcvbuf_size, 605 ucs->rcvbuf, ucs->rcvbuf_size,
606 read_ctrl_callback, cs->inbuf); 606 read_ctrl_callback, cs->inbuf);
607 607
608 if ((ret = usb_submit_urb(ucs->urb_cmd_in, GFP_ATOMIC)) != 0) { 608 ret = usb_submit_urb(ucs->urb_cmd_in, GFP_ATOMIC);
609 if (ret != 0) {
609 update_basstate(ucs, 0, BS_ATRDPEND); 610 update_basstate(ucs, 0, BS_ATRDPEND);
610 dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: %s\n", 611 dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: %s\n",
611 get_usb_rcmsg(ret)); 612 get_usb_rcmsg(ret));
@@ -652,13 +653,11 @@ static void read_int_callback(struct urb *urb)
652 return; 653 return;
653 case -ENODEV: /* device removed */ 654 case -ENODEV: /* device removed */
654 case -ESHUTDOWN: /* device shut down */ 655 case -ESHUTDOWN: /* device shut down */
655 //FIXME use this as disconnect indicator?
656 gig_dbg(DEBUG_USBREQ, "%s: device disconnected", __func__); 656 gig_dbg(DEBUG_USBREQ, "%s: device disconnected", __func__);
657 return; 657 return;
658 default: /* severe trouble */ 658 default: /* severe trouble */
659 dev_warn(cs->dev, "interrupt read: %s\n", 659 dev_warn(cs->dev, "interrupt read: %s\n",
660 get_usb_statmsg(status)); 660 get_usb_statmsg(status));
661 //FIXME corrective action? resubmission always ok?
662 goto resubmit; 661 goto resubmit;
663 } 662 }
664 663
@@ -742,7 +741,8 @@ static void read_int_callback(struct urb *urb)
742 kfree(ucs->rcvbuf); 741 kfree(ucs->rcvbuf);
743 ucs->rcvbuf_size = 0; 742 ucs->rcvbuf_size = 0;
744 } 743 }
745 if ((ucs->rcvbuf = kmalloc(l, GFP_ATOMIC)) == NULL) { 744 ucs->rcvbuf = kmalloc(l, GFP_ATOMIC);
745 if (ucs->rcvbuf == NULL) {
746 spin_unlock_irqrestore(&cs->lock, flags); 746 spin_unlock_irqrestore(&cs->lock, flags);
747 dev_err(cs->dev, "out of memory receiving AT data\n"); 747 dev_err(cs->dev, "out of memory receiving AT data\n");
748 error_reset(cs); 748 error_reset(cs);
@@ -750,12 +750,12 @@ static void read_int_callback(struct urb *urb)
750 } 750 }
751 ucs->rcvbuf_size = l; 751 ucs->rcvbuf_size = l;
752 ucs->retry_cmd_in = 0; 752 ucs->retry_cmd_in = 0;
753 if ((rc = atread_submit(cs, BAS_TIMEOUT)) < 0) { 753 rc = atread_submit(cs, BAS_TIMEOUT);
754 if (rc < 0) {
754 kfree(ucs->rcvbuf); 755 kfree(ucs->rcvbuf);
755 ucs->rcvbuf = NULL; 756 ucs->rcvbuf = NULL;
756 ucs->rcvbuf_size = 0; 757 ucs->rcvbuf_size = 0;
757 if (rc != -ENODEV) { 758 if (rc != -ENODEV) {
758 //FIXME corrective action?
759 spin_unlock_irqrestore(&cs->lock, flags); 759 spin_unlock_irqrestore(&cs->lock, flags);
760 error_reset(cs); 760 error_reset(cs);
761 break; 761 break;
@@ -940,7 +940,8 @@ static int starturbs(struct bc_state *bcs)
940 } 940 }
941 941
942 dump_urb(DEBUG_ISO, "Initial isoc read", urb); 942 dump_urb(DEBUG_ISO, "Initial isoc read", urb);
943 if ((rc = usb_submit_urb(urb, GFP_ATOMIC)) != 0) 943 rc = usb_submit_urb(urb, GFP_ATOMIC);
944 if (rc != 0)
944 goto error; 945 goto error;
945 } 946 }
946 947
@@ -1045,7 +1046,8 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
1045 1046
1046 /* compute frame length according to flow control */ 1047 /* compute frame length according to flow control */
1047 ifd->length = BAS_NORMFRAME; 1048 ifd->length = BAS_NORMFRAME;
1048 if ((corrbytes = atomic_read(&ubc->corrbytes)) != 0) { 1049 corrbytes = atomic_read(&ubc->corrbytes);
1050 if (corrbytes != 0) {
1049 gig_dbg(DEBUG_ISO, "%s: corrbytes=%d", 1051 gig_dbg(DEBUG_ISO, "%s: corrbytes=%d",
1050 __func__, corrbytes); 1052 __func__, corrbytes);
1051 if (corrbytes > BAS_HIGHFRAME - BAS_NORMFRAME) 1053 if (corrbytes > BAS_HIGHFRAME - BAS_NORMFRAME)
@@ -1284,7 +1286,8 @@ static void read_iso_tasklet(unsigned long data)
1284 for (;;) { 1286 for (;;) {
1285 /* retrieve URB */ 1287 /* retrieve URB */
1286 spin_lock_irqsave(&ubc->isoinlock, flags); 1288 spin_lock_irqsave(&ubc->isoinlock, flags);
1287 if (!(urb = ubc->isoindone)) { 1289 urb = ubc->isoindone;
1290 if (!urb) {
1288 spin_unlock_irqrestore(&ubc->isoinlock, flags); 1291 spin_unlock_irqrestore(&ubc->isoinlock, flags);
1289 return; 1292 return;
1290 } 1293 }
@@ -1371,7 +1374,7 @@ static void read_iso_tasklet(unsigned long data)
1371 "isochronous read: %d data bytes missing\n", 1374 "isochronous read: %d data bytes missing\n",
1372 totleft); 1375 totleft);
1373 1376
1374 error: 1377error:
1375 /* URB processed, resubmit */ 1378 /* URB processed, resubmit */
1376 for (frame = 0; frame < BAS_NUMFRAMES; frame++) { 1379 for (frame = 0; frame < BAS_NUMFRAMES; frame++) {
1377 urb->iso_frame_desc[frame].status = 0; 1380 urb->iso_frame_desc[frame].status = 0;
@@ -1568,7 +1571,7 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout)
1568 ucs->dr_ctrl.wLength = 0; 1571 ucs->dr_ctrl.wLength = 0;
1569 usb_fill_control_urb(ucs->urb_ctrl, ucs->udev, 1572 usb_fill_control_urb(ucs->urb_ctrl, ucs->udev,
1570 usb_sndctrlpipe(ucs->udev, 0), 1573 usb_sndctrlpipe(ucs->udev, 0),
1571 (unsigned char*) &ucs->dr_ctrl, NULL, 0, 1574 (unsigned char *) &ucs->dr_ctrl, NULL, 0,
1572 write_ctrl_callback, ucs); 1575 write_ctrl_callback, ucs);
1573 ucs->retry_ctrl = 0; 1576 ucs->retry_ctrl = 0;
1574 ret = usb_submit_urb(ucs->urb_ctrl, GFP_ATOMIC); 1577 ret = usb_submit_urb(ucs->urb_ctrl, GFP_ATOMIC);
@@ -1621,7 +1624,8 @@ static int gigaset_init_bchannel(struct bc_state *bcs)
1621 return -EHOSTUNREACH; 1624 return -EHOSTUNREACH;
1622 } 1625 }
1623 1626
1624 if ((ret = starturbs(bcs)) < 0) { 1627 ret = starturbs(bcs);
1628 if (ret < 0) {
1625 dev_err(cs->dev, 1629 dev_err(cs->dev,
1626 "could not start isochronous I/O for channel B%d: %s\n", 1630 "could not start isochronous I/O for channel B%d: %s\n",
1627 bcs->channel + 1, 1631 bcs->channel + 1,
@@ -1633,7 +1637,8 @@ static int gigaset_init_bchannel(struct bc_state *bcs)
1633 } 1637 }
1634 1638
1635 req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL; 1639 req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL;
1636 if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) { 1640 ret = req_submit(bcs, req, 0, BAS_TIMEOUT);
1641 if (ret < 0) {
1637 dev_err(cs->dev, "could not open channel B%d\n", 1642 dev_err(cs->dev, "could not open channel B%d\n",
1638 bcs->channel + 1); 1643 bcs->channel + 1);
1639 stopurbs(bcs->hw.bas); 1644 stopurbs(bcs->hw.bas);
@@ -1677,7 +1682,8 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
1677 1682
1678 /* channel running: tell device to close it */ 1683 /* channel running: tell device to close it */
1679 req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL; 1684 req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL;
1680 if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) 1685 ret = req_submit(bcs, req, 0, BAS_TIMEOUT);
1686 if (ret < 0)
1681 dev_err(cs->dev, "closing channel B%d failed\n", 1687 dev_err(cs->dev, "closing channel B%d failed\n",
1682 bcs->channel + 1); 1688 bcs->channel + 1);
1683 1689
@@ -1703,10 +1709,12 @@ static void complete_cb(struct cardstate *cs)
1703 gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, 1709 gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD,
1704 "write_command: sent %u bytes, %u left", 1710 "write_command: sent %u bytes, %u left",
1705 cs->curlen, cs->cmdbytes); 1711 cs->curlen, cs->cmdbytes);
1706 if ((cs->cmdbuf = cb->next) != NULL) { 1712 if (cb->next != NULL) {
1713 cs->cmdbuf = cb->next;
1707 cs->cmdbuf->prev = NULL; 1714 cs->cmdbuf->prev = NULL;
1708 cs->curlen = cs->cmdbuf->len; 1715 cs->curlen = cs->cmdbuf->len;
1709 } else { 1716 } else {
1717 cs->cmdbuf = NULL;
1710 cs->lastcmdbuf = NULL; 1718 cs->lastcmdbuf = NULL;
1711 cs->curlen = 0; 1719 cs->curlen = 0;
1712 } 1720 }
@@ -1833,7 +1841,7 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len)
1833 ucs->dr_cmd_out.wLength = cpu_to_le16(len); 1841 ucs->dr_cmd_out.wLength = cpu_to_le16(len);
1834 usb_fill_control_urb(ucs->urb_cmd_out, ucs->udev, 1842 usb_fill_control_urb(ucs->urb_cmd_out, ucs->udev,
1835 usb_sndctrlpipe(ucs->udev, 0), 1843 usb_sndctrlpipe(ucs->udev, 0),
1836 (unsigned char*) &ucs->dr_cmd_out, buf, len, 1844 (unsigned char *) &ucs->dr_cmd_out, buf, len,
1837 write_command_callback, cs); 1845 write_command_callback, cs);
1838 rc = usb_submit_urb(ucs->urb_cmd_out, GFP_ATOMIC); 1846 rc = usb_submit_urb(ucs->urb_cmd_out, GFP_ATOMIC);
1839 if (unlikely(rc)) { 1847 if (unlikely(rc)) {
@@ -1953,7 +1961,8 @@ static int gigaset_write_cmd(struct cardstate *cs,
1953 1961
1954 if (len > IF_WRITEBUF) 1962 if (len > IF_WRITEBUF)
1955 len = IF_WRITEBUF; 1963 len = IF_WRITEBUF;
1956 if (!(cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC))) { 1964 cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC);
1965 if (!cb) {
1957 dev_err(cs->dev, "%s: out of memory\n", __func__); 1966 dev_err(cs->dev, "%s: out of memory\n", __func__);
1958 rc = -ENOMEM; 1967 rc = -ENOMEM;
1959 goto notqueued; 1968 goto notqueued;
@@ -2100,7 +2109,8 @@ static int gigaset_initbcshw(struct bc_state *bcs)
2100 } 2109 }
2101 ubc->isooutdone = ubc->isooutfree = ubc->isooutovfl = NULL; 2110 ubc->isooutdone = ubc->isooutfree = ubc->isooutovfl = NULL;
2102 ubc->numsub = 0; 2111 ubc->numsub = 0;
2103 if (!(ubc->isooutbuf = kmalloc(sizeof(struct isowbuf_t), GFP_KERNEL))) { 2112 ubc->isooutbuf = kmalloc(sizeof(struct isowbuf_t), GFP_KERNEL);
2113 if (!ubc->isooutbuf) {
2104 pr_err("out of memory\n"); 2114 pr_err("out of memory\n");
2105 kfree(ubc); 2115 kfree(ubc);
2106 bcs->hw.bas = NULL; 2116 bcs->hw.bas = NULL;
@@ -2252,7 +2262,8 @@ static int gigaset_probe(struct usb_interface *interface,
2252 gig_dbg(DEBUG_ANY, 2262 gig_dbg(DEBUG_ANY,
2253 "%s: wrong alternate setting %d - trying to switch", 2263 "%s: wrong alternate setting %d - trying to switch",
2254 __func__, hostif->desc.bAlternateSetting); 2264 __func__, hostif->desc.bAlternateSetting);
2255 if (usb_set_interface(udev, hostif->desc.bInterfaceNumber, 3) < 0) { 2265 if (usb_set_interface(udev, hostif->desc.bInterfaceNumber, 3)
2266 < 0) {
2256 dev_warn(&udev->dev, "usb_set_interface failed, " 2267 dev_warn(&udev->dev, "usb_set_interface failed, "
2257 "device %d interface %d altsetting %d\n", 2268 "device %d interface %d altsetting %d\n",
2258 udev->devnum, hostif->desc.bInterfaceNumber, 2269 udev->devnum, hostif->desc.bInterfaceNumber,
@@ -2321,14 +2332,16 @@ static int gigaset_probe(struct usb_interface *interface,
2321 (endpoint->bEndpointAddress) & 0x0f), 2332 (endpoint->bEndpointAddress) & 0x0f),
2322 ucs->int_in_buf, IP_MSGSIZE, read_int_callback, cs, 2333 ucs->int_in_buf, IP_MSGSIZE, read_int_callback, cs,
2323 endpoint->bInterval); 2334 endpoint->bInterval);
2324 if ((rc = usb_submit_urb(ucs->urb_int_in, GFP_KERNEL)) != 0) { 2335 rc = usb_submit_urb(ucs->urb_int_in, GFP_KERNEL);
2336 if (rc != 0) {
2325 dev_err(cs->dev, "could not submit interrupt URB: %s\n", 2337 dev_err(cs->dev, "could not submit interrupt URB: %s\n",
2326 get_usb_rcmsg(rc)); 2338 get_usb_rcmsg(rc));
2327 goto error; 2339 goto error;
2328 } 2340 }
2329 2341
2330 /* tell the device that the driver is ready */ 2342 /* tell the device that the driver is ready */
2331 if ((rc = req_submit(cs->bcs, HD_DEVICE_INIT_ACK, 0, 0)) != 0) 2343 rc = req_submit(cs->bcs, HD_DEVICE_INIT_ACK, 0, 0);
2344 if (rc != 0)
2332 goto error; 2345 goto error;
2333 2346
2334 /* tell common part that the device is ready */ 2347 /* tell common part that the device is ready */
@@ -2524,9 +2537,10 @@ static int __init bas_gigaset_init(void)
2524 int result; 2537 int result;
2525 2538
2526 /* allocate memory for our driver state and intialize it */ 2539 /* allocate memory for our driver state and intialize it */
2527 if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, 2540 driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
2528 GIGASET_MODULENAME, GIGASET_DEVNAME, 2541 GIGASET_MODULENAME, GIGASET_DEVNAME,
2529 &gigops, THIS_MODULE)) == NULL) 2542 &gigops, THIS_MODULE);
2543 if (driver == NULL)
2530 goto error; 2544 goto error;
2531 2545
2532 /* register this driver with the USB subsystem */ 2546 /* register this driver with the USB subsystem */