diff options
Diffstat (limited to 'drivers/isdn/gigaset/bas-gigaset.c')
-rw-r--r-- | drivers/isdn/gigaset/bas-gigaset.c | 174 |
1 files changed, 29 insertions, 145 deletions
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 1cf48cfad1de..b75f2f37c355 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -205,7 +205,6 @@ static inline void dump_urb(enum debuglevel level, const char *tag, | |||
205 | { | 205 | { |
206 | #ifdef CONFIG_GIGASET_DEBUG | 206 | #ifdef CONFIG_GIGASET_DEBUG |
207 | int i; | 207 | int i; |
208 | IFNULLRET(tag); | ||
209 | gig_dbg(level, "%s urb(0x%08lx)->{", tag, (unsigned long) urb); | 208 | gig_dbg(level, "%s urb(0x%08lx)->{", tag, (unsigned long) urb); |
210 | if (urb) { | 209 | if (urb) { |
211 | gig_dbg(level, | 210 | gig_dbg(level, |
@@ -309,8 +308,6 @@ static void check_pending(struct bas_cardstate *ucs) | |||
309 | { | 308 | { |
310 | unsigned long flags; | 309 | unsigned long flags; |
311 | 310 | ||
312 | IFNULLRET(ucs); | ||
313 | |||
314 | spin_lock_irqsave(&ucs->lock, flags); | 311 | spin_lock_irqsave(&ucs->lock, flags); |
315 | switch (ucs->pending) { | 312 | switch (ucs->pending) { |
316 | case 0: | 313 | case 0: |
@@ -366,13 +363,9 @@ static void check_pending(struct bas_cardstate *ucs) | |||
366 | static void cmd_in_timeout(unsigned long data) | 363 | static void cmd_in_timeout(unsigned long data) |
367 | { | 364 | { |
368 | struct cardstate *cs = (struct cardstate *) data; | 365 | struct cardstate *cs = (struct cardstate *) data; |
369 | struct bas_cardstate *ucs; | 366 | struct bas_cardstate *ucs = cs->hw.bas; |
370 | unsigned long flags; | 367 | unsigned long flags; |
371 | 368 | ||
372 | IFNULLRET(cs); | ||
373 | ucs = cs->hw.bas; | ||
374 | IFNULLRET(ucs); | ||
375 | |||
376 | spin_lock_irqsave(&cs->lock, flags); | 369 | spin_lock_irqsave(&cs->lock, flags); |
377 | if (unlikely(!atomic_read(&cs->connected))) { | 370 | if (unlikely(!atomic_read(&cs->connected))) { |
378 | gig_dbg(DEBUG_USBREQ, "%s: disconnected", __func__); | 371 | gig_dbg(DEBUG_USBREQ, "%s: disconnected", __func__); |
@@ -406,14 +399,9 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs); | |||
406 | */ | 399 | */ |
407 | static int atread_submit(struct cardstate *cs, int timeout) | 400 | static int atread_submit(struct cardstate *cs, int timeout) |
408 | { | 401 | { |
409 | struct bas_cardstate *ucs; | 402 | struct bas_cardstate *ucs = cs->hw.bas; |
410 | int ret; | 403 | int ret; |
411 | 404 | ||
412 | IFNULLRETVAL(cs, -EINVAL); | ||
413 | ucs = cs->hw.bas; | ||
414 | IFNULLRETVAL(ucs, -EINVAL); | ||
415 | IFNULLRETVAL(ucs->urb_cmd_in, -EINVAL); | ||
416 | |||
417 | gig_dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)", | 405 | gig_dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)", |
418 | ucs->rcvbuf_size); | 406 | ucs->rcvbuf_size); |
419 | 407 | ||
@@ -479,20 +467,14 @@ inline static void update_basstate(struct bas_cardstate *ucs, | |||
479 | */ | 467 | */ |
480 | static void read_int_callback(struct urb *urb, struct pt_regs *regs) | 468 | static void read_int_callback(struct urb *urb, struct pt_regs *regs) |
481 | { | 469 | { |
482 | struct cardstate *cs; | 470 | struct cardstate *cs = urb->context; |
483 | struct bas_cardstate *ucs; | 471 | struct bas_cardstate *ucs = cs->hw.bas; |
484 | struct bc_state *bcs; | 472 | struct bc_state *bcs; |
485 | unsigned long flags; | 473 | unsigned long flags; |
486 | int status; | 474 | int status; |
487 | unsigned l; | 475 | unsigned l; |
488 | int channel; | 476 | int channel; |
489 | 477 | ||
490 | IFNULLRET(urb); | ||
491 | cs = (struct cardstate *) urb->context; | ||
492 | IFNULLRET(cs); | ||
493 | ucs = cs->hw.bas; | ||
494 | IFNULLRET(ucs); | ||
495 | |||
496 | if (unlikely(!atomic_read(&cs->connected))) { | 478 | if (unlikely(!atomic_read(&cs->connected))) { |
497 | warn("%s: disconnected", __func__); | 479 | warn("%s: disconnected", __func__); |
498 | return; | 480 | return; |
@@ -638,20 +620,12 @@ resubmit: | |||
638 | */ | 620 | */ |
639 | static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) | 621 | static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) |
640 | { | 622 | { |
641 | struct cardstate *cs; | 623 | struct inbuf_t *inbuf = urb->context; |
642 | struct bas_cardstate *ucs; | 624 | struct cardstate *cs = inbuf->cs; |
625 | struct bas_cardstate *ucs = cs->hw.bas; | ||
626 | int have_data = 0; | ||
643 | unsigned numbytes; | 627 | unsigned numbytes; |
644 | unsigned long flags; | 628 | unsigned long flags; |
645 | struct inbuf_t *inbuf; | ||
646 | int have_data = 0; | ||
647 | |||
648 | IFNULLRET(urb); | ||
649 | inbuf = (struct inbuf_t *) urb->context; | ||
650 | IFNULLRET(inbuf); | ||
651 | cs = inbuf->cs; | ||
652 | IFNULLRET(cs); | ||
653 | ucs = cs->hw.bas; | ||
654 | IFNULLRET(ucs); | ||
655 | 629 | ||
656 | spin_lock_irqsave(&cs->lock, flags); | 630 | spin_lock_irqsave(&cs->lock, flags); |
657 | if (unlikely(!atomic_read(&cs->connected))) { | 631 | if (unlikely(!atomic_read(&cs->connected))) { |
@@ -747,10 +721,6 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
747 | unsigned long flags; | 721 | unsigned long flags; |
748 | int i, rc; | 722 | int i, rc; |
749 | 723 | ||
750 | IFNULLRET(urb); | ||
751 | IFNULLRET(urb->context); | ||
752 | IFNULLRET(cardstate); | ||
753 | |||
754 | /* status codes not worth bothering the tasklet with */ | 724 | /* status codes not worth bothering the tasklet with */ |
755 | if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || | 725 | if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || |
756 | urb->status == -EINPROGRESS)) { | 726 | urb->status == -EINPROGRESS)) { |
@@ -759,9 +729,8 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
759 | return; | 729 | return; |
760 | } | 730 | } |
761 | 731 | ||
762 | bcs = (struct bc_state *) urb->context; | 732 | bcs = urb->context; |
763 | ubc = bcs->hw.bas; | 733 | ubc = bcs->hw.bas; |
764 | IFNULLRET(ubc); | ||
765 | 734 | ||
766 | spin_lock_irqsave(&ubc->isoinlock, flags); | 735 | spin_lock_irqsave(&ubc->isoinlock, flags); |
767 | if (likely(ubc->isoindone == NULL)) { | 736 | if (likely(ubc->isoindone == NULL)) { |
@@ -813,10 +782,6 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
813 | struct bas_bc_state *ubc; | 782 | struct bas_bc_state *ubc; |
814 | unsigned long flags; | 783 | unsigned long flags; |
815 | 784 | ||
816 | IFNULLRET(urb); | ||
817 | IFNULLRET(urb->context); | ||
818 | IFNULLRET(cardstate); | ||
819 | |||
820 | /* status codes not worth bothering the tasklet with */ | 785 | /* status codes not worth bothering the tasklet with */ |
821 | if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || | 786 | if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || |
822 | urb->status == -EINPROGRESS)) { | 787 | urb->status == -EINPROGRESS)) { |
@@ -826,10 +791,8 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
826 | } | 791 | } |
827 | 792 | ||
828 | /* pass URB context to tasklet */ | 793 | /* pass URB context to tasklet */ |
829 | ucx = (struct isow_urbctx_t *) urb->context; | 794 | ucx = urb->context; |
830 | IFNULLRET(ucx->bcs); | ||
831 | ubc = ucx->bcs->hw.bas; | 795 | ubc = ucx->bcs->hw.bas; |
832 | IFNULLRET(ubc); | ||
833 | 796 | ||
834 | spin_lock_irqsave(&ubc->isooutlock, flags); | 797 | spin_lock_irqsave(&ubc->isooutlock, flags); |
835 | ubc->isooutovfl = ubc->isooutdone; | 798 | ubc->isooutovfl = ubc->isooutdone; |
@@ -848,15 +811,11 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
848 | */ | 811 | */ |
849 | static int starturbs(struct bc_state *bcs) | 812 | static int starturbs(struct bc_state *bcs) |
850 | { | 813 | { |
814 | struct bas_bc_state *ubc = bcs->hw.bas; | ||
851 | struct urb *urb; | 815 | struct urb *urb; |
852 | struct bas_bc_state *ubc; | ||
853 | int j, k; | 816 | int j, k; |
854 | int rc; | 817 | int rc; |
855 | 818 | ||
856 | IFNULLRETVAL(bcs, -EFAULT); | ||
857 | ubc = bcs->hw.bas; | ||
858 | IFNULLRETVAL(ubc, -EFAULT); | ||
859 | |||
860 | /* initialize L2 reception */ | 819 | /* initialize L2 reception */ |
861 | if (bcs->proto2 == ISDN_PROTO_L2_HDLC) | 820 | if (bcs->proto2 == ISDN_PROTO_L2_HDLC) |
862 | bcs->inputstate |= INS_flag_hunt; | 821 | bcs->inputstate |= INS_flag_hunt; |
@@ -955,8 +914,6 @@ static void stopurbs(struct bas_bc_state *ubc) | |||
955 | { | 914 | { |
956 | int k, rc; | 915 | int k, rc; |
957 | 916 | ||
958 | IFNULLRET(ubc); | ||
959 | |||
960 | atomic_set(&ubc->running, 0); | 917 | atomic_set(&ubc->running, 0); |
961 | 918 | ||
962 | for (k = 0; k < BAS_INURBS; ++k) { | 919 | for (k = 0; k < BAS_INURBS; ++k) { |
@@ -988,18 +945,11 @@ static void stopurbs(struct bas_bc_state *ubc) | |||
988 | */ | 945 | */ |
989 | static int submit_iso_write_urb(struct isow_urbctx_t *ucx) | 946 | static int submit_iso_write_urb(struct isow_urbctx_t *ucx) |
990 | { | 947 | { |
991 | struct urb *urb; | 948 | struct urb *urb = ucx->urb; |
992 | struct bas_bc_state *ubc; | 949 | struct bas_bc_state *ubc = ucx->bcs->hw.bas; |
993 | struct usb_iso_packet_descriptor *ifd; | 950 | struct usb_iso_packet_descriptor *ifd; |
994 | int corrbytes, nframe, rc; | 951 | int corrbytes, nframe, rc; |
995 | 952 | ||
996 | IFNULLRETVAL(ucx, -EFAULT); | ||
997 | urb = ucx->urb; | ||
998 | IFNULLRETVAL(urb, -EFAULT); | ||
999 | IFNULLRETVAL(ucx->bcs, -EFAULT); | ||
1000 | ubc = ucx->bcs->hw.bas; | ||
1001 | IFNULLRETVAL(ubc, -EFAULT); | ||
1002 | |||
1003 | /* urb->dev is clobbered by USB subsystem */ | 953 | /* urb->dev is clobbered by USB subsystem */ |
1004 | urb->dev = ucx->bcs->cs->hw.bas->udev; | 954 | urb->dev = ucx->bcs->cs->hw.bas->udev; |
1005 | urb->transfer_flags = URB_ISO_ASAP; | 955 | urb->transfer_flags = URB_ISO_ASAP; |
@@ -1065,9 +1015,9 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) | |||
1065 | */ | 1015 | */ |
1066 | static void write_iso_tasklet(unsigned long data) | 1016 | static void write_iso_tasklet(unsigned long data) |
1067 | { | 1017 | { |
1068 | struct bc_state *bcs; | 1018 | struct bc_state *bcs = (struct bc_state *) data; |
1069 | struct bas_bc_state *ubc; | 1019 | struct bas_bc_state *ubc = bcs->hw.bas; |
1070 | struct cardstate *cs; | 1020 | struct cardstate *cs = bcs->cs; |
1071 | struct isow_urbctx_t *done, *next, *ovfl; | 1021 | struct isow_urbctx_t *done, *next, *ovfl; |
1072 | struct urb *urb; | 1022 | struct urb *urb; |
1073 | struct usb_iso_packet_descriptor *ifd; | 1023 | struct usb_iso_packet_descriptor *ifd; |
@@ -1077,13 +1027,6 @@ static void write_iso_tasklet(unsigned long data) | |||
1077 | struct sk_buff *skb; | 1027 | struct sk_buff *skb; |
1078 | int len; | 1028 | int len; |
1079 | 1029 | ||
1080 | bcs = (struct bc_state *) data; | ||
1081 | IFNULLRET(bcs); | ||
1082 | ubc = bcs->hw.bas; | ||
1083 | IFNULLRET(ubc); | ||
1084 | cs = bcs->cs; | ||
1085 | IFNULLRET(cs); | ||
1086 | |||
1087 | /* loop while completed URBs arrive in time */ | 1030 | /* loop while completed URBs arrive in time */ |
1088 | for (;;) { | 1031 | for (;;) { |
1089 | if (unlikely(!atomic_read(&cs->connected))) { | 1032 | if (unlikely(!atomic_read(&cs->connected))) { |
@@ -1237,21 +1180,14 @@ static void write_iso_tasklet(unsigned long data) | |||
1237 | */ | 1180 | */ |
1238 | static void read_iso_tasklet(unsigned long data) | 1181 | static void read_iso_tasklet(unsigned long data) |
1239 | { | 1182 | { |
1240 | struct bc_state *bcs; | 1183 | struct bc_state *bcs = (struct bc_state *) data; |
1241 | struct bas_bc_state *ubc; | 1184 | struct bas_bc_state *ubc = bcs->hw.bas; |
1242 | struct cardstate *cs; | 1185 | struct cardstate *cs = bcs->cs; |
1243 | struct urb *urb; | 1186 | struct urb *urb; |
1244 | char *rcvbuf; | 1187 | char *rcvbuf; |
1245 | unsigned long flags; | 1188 | unsigned long flags; |
1246 | int totleft, numbytes, offset, frame, rc; | 1189 | int totleft, numbytes, offset, frame, rc; |
1247 | 1190 | ||
1248 | bcs = (struct bc_state *) data; | ||
1249 | IFNULLRET(bcs); | ||
1250 | ubc = bcs->hw.bas; | ||
1251 | IFNULLRET(ubc); | ||
1252 | cs = bcs->cs; | ||
1253 | IFNULLRET(cs); | ||
1254 | |||
1255 | /* loop while more completed URBs arrive in the meantime */ | 1191 | /* loop while more completed URBs arrive in the meantime */ |
1256 | for (;;) { | 1192 | for (;;) { |
1257 | if (unlikely(!atomic_read(&cs->connected))) { | 1193 | if (unlikely(!atomic_read(&cs->connected))) { |
@@ -1383,15 +1319,10 @@ static void read_iso_tasklet(unsigned long data) | |||
1383 | static void req_timeout(unsigned long data) | 1319 | static void req_timeout(unsigned long data) |
1384 | { | 1320 | { |
1385 | struct bc_state *bcs = (struct bc_state *) data; | 1321 | struct bc_state *bcs = (struct bc_state *) data; |
1386 | struct bas_cardstate *ucs; | 1322 | struct bas_cardstate *ucs = bcs->cs->hw.bas; |
1387 | int pending; | 1323 | int pending; |
1388 | unsigned long flags; | 1324 | unsigned long flags; |
1389 | 1325 | ||
1390 | IFNULLRET(bcs); | ||
1391 | IFNULLRET(bcs->cs); | ||
1392 | ucs = bcs->cs->hw.bas; | ||
1393 | IFNULLRET(ucs); | ||
1394 | |||
1395 | check_pending(ucs); | 1326 | check_pending(ucs); |
1396 | 1327 | ||
1397 | spin_lock_irqsave(&ucs->lock, flags); | 1328 | spin_lock_irqsave(&ucs->lock, flags); |
@@ -1441,14 +1372,9 @@ static void req_timeout(unsigned long data) | |||
1441 | */ | 1372 | */ |
1442 | static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs) | 1373 | static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs) |
1443 | { | 1374 | { |
1444 | struct bas_cardstate *ucs; | 1375 | struct bas_cardstate *ucs = urb->context; |
1445 | unsigned long flags; | 1376 | unsigned long flags; |
1446 | 1377 | ||
1447 | IFNULLRET(urb); | ||
1448 | IFNULLRET(urb->context); | ||
1449 | IFNULLRET(cardstate); | ||
1450 | |||
1451 | ucs = (struct bas_cardstate *) urb->context; | ||
1452 | spin_lock_irqsave(&ucs->lock, flags); | 1378 | spin_lock_irqsave(&ucs->lock, flags); |
1453 | if (urb->status && ucs->pending) { | 1379 | if (urb->status && ucs->pending) { |
1454 | dev_err(&ucs->interface->dev, | 1380 | dev_err(&ucs->interface->dev, |
@@ -1482,16 +1408,10 @@ static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
1482 | */ | 1408 | */ |
1483 | static int req_submit(struct bc_state *bcs, int req, int val, int timeout) | 1409 | static int req_submit(struct bc_state *bcs, int req, int val, int timeout) |
1484 | { | 1410 | { |
1485 | struct bas_cardstate *ucs; | 1411 | struct bas_cardstate *ucs = bcs->cs->hw.bas; |
1486 | int ret; | 1412 | int ret; |
1487 | unsigned long flags; | 1413 | unsigned long flags; |
1488 | 1414 | ||
1489 | IFNULLRETVAL(bcs, -EINVAL); | ||
1490 | IFNULLRETVAL(bcs->cs, -EINVAL); | ||
1491 | ucs = bcs->cs->hw.bas; | ||
1492 | IFNULLRETVAL(ucs, -EINVAL); | ||
1493 | IFNULLRETVAL(ucs->urb_ctrl, -EINVAL); | ||
1494 | |||
1495 | gig_dbg(DEBUG_USBREQ, "-------> 0x%02x (%d)", req, val); | 1415 | gig_dbg(DEBUG_USBREQ, "-------> 0x%02x (%d)", req, val); |
1496 | 1416 | ||
1497 | spin_lock_irqsave(&ucs->lock, flags); | 1417 | spin_lock_irqsave(&ucs->lock, flags); |
@@ -1551,8 +1471,6 @@ static int gigaset_init_bchannel(struct bc_state *bcs) | |||
1551 | { | 1471 | { |
1552 | int req, ret; | 1472 | int req, ret; |
1553 | 1473 | ||
1554 | IFNULLRETVAL(bcs, -EINVAL); | ||
1555 | |||
1556 | if ((ret = starturbs(bcs)) < 0) { | 1474 | if ((ret = starturbs(bcs)) < 0) { |
1557 | dev_err(bcs->cs->dev, | 1475 | dev_err(bcs->cs->dev, |
1558 | "could not start isochronous I/O for channel %d\n", | 1476 | "could not start isochronous I/O for channel %d\n", |
@@ -1585,8 +1503,6 @@ static int gigaset_close_bchannel(struct bc_state *bcs) | |||
1585 | { | 1503 | { |
1586 | int req, ret; | 1504 | int req, ret; |
1587 | 1505 | ||
1588 | IFNULLRETVAL(bcs, -EINVAL); | ||
1589 | |||
1590 | if (!(atomic_read(&bcs->cs->hw.bas->basstate) & | 1506 | if (!(atomic_read(&bcs->cs->hw.bas->basstate) & |
1591 | (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) { | 1507 | (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) { |
1592 | /* channel not running: just signal common.c */ | 1508 | /* channel not running: just signal common.c */ |
@@ -1613,11 +1529,7 @@ static int gigaset_close_bchannel(struct bc_state *bcs) | |||
1613 | */ | 1529 | */ |
1614 | static void complete_cb(struct cardstate *cs) | 1530 | static void complete_cb(struct cardstate *cs) |
1615 | { | 1531 | { |
1616 | struct cmdbuf_t *cb; | 1532 | struct cmdbuf_t *cb = cs->cmdbuf; |
1617 | |||
1618 | IFNULLRET(cs); | ||
1619 | cb = cs->cmdbuf; | ||
1620 | IFNULLRET(cb); | ||
1621 | 1533 | ||
1622 | /* unqueue completed buffer */ | 1534 | /* unqueue completed buffer */ |
1623 | cs->cmdbytes -= cs->curlen; | 1535 | cs->cmdbytes -= cs->curlen; |
@@ -1649,15 +1561,9 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len); | |||
1649 | */ | 1561 | */ |
1650 | static void write_command_callback(struct urb *urb, struct pt_regs *regs) | 1562 | static void write_command_callback(struct urb *urb, struct pt_regs *regs) |
1651 | { | 1563 | { |
1652 | struct cardstate *cs; | 1564 | struct cardstate *cs = urb->context; |
1565 | struct bas_cardstate *ucs = cs->hw.bas; | ||
1653 | unsigned long flags; | 1566 | unsigned long flags; |
1654 | struct bas_cardstate *ucs; | ||
1655 | |||
1656 | IFNULLRET(urb); | ||
1657 | cs = (struct cardstate *) urb->context; | ||
1658 | IFNULLRET(cs); | ||
1659 | ucs = cs->hw.bas; | ||
1660 | IFNULLRET(ucs); | ||
1661 | 1567 | ||
1662 | /* check status */ | 1568 | /* check status */ |
1663 | switch (urb->status) { | 1569 | switch (urb->status) { |
@@ -1709,11 +1615,7 @@ static void write_command_callback(struct urb *urb, struct pt_regs *regs) | |||
1709 | static void atrdy_timeout(unsigned long data) | 1615 | static void atrdy_timeout(unsigned long data) |
1710 | { | 1616 | { |
1711 | struct cardstate *cs = (struct cardstate *) data; | 1617 | struct cardstate *cs = (struct cardstate *) data; |
1712 | struct bas_cardstate *ucs; | 1618 | struct bas_cardstate *ucs = cs->hw.bas; |
1713 | |||
1714 | IFNULLRET(cs); | ||
1715 | ucs = cs->hw.bas; | ||
1716 | IFNULLRET(ucs); | ||
1717 | 1619 | ||
1718 | dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n"); | 1620 | dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n"); |
1719 | 1621 | ||
@@ -1736,14 +1638,9 @@ static void atrdy_timeout(unsigned long data) | |||
1736 | */ | 1638 | */ |
1737 | static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) | 1639 | static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) |
1738 | { | 1640 | { |
1739 | struct bas_cardstate *ucs; | 1641 | struct bas_cardstate *ucs = cs->hw.bas; |
1740 | int ret; | 1642 | int ret; |
1741 | 1643 | ||
1742 | IFNULLRETVAL(cs, -EFAULT); | ||
1743 | ucs = cs->hw.bas; | ||
1744 | IFNULLRETVAL(ucs, -EFAULT); | ||
1745 | IFNULLRETVAL(ucs->urb_cmd_out, -EFAULT); | ||
1746 | |||
1747 | gig_dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len); | 1644 | gig_dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len); |
1748 | 1645 | ||
1749 | if (ucs->urb_cmd_out->status == -EINPROGRESS) { | 1646 | if (ucs->urb_cmd_out->status == -EINPROGRESS) { |
@@ -1795,15 +1692,11 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) | |||
1795 | static int start_cbsend(struct cardstate *cs) | 1692 | static int start_cbsend(struct cardstate *cs) |
1796 | { | 1693 | { |
1797 | struct cmdbuf_t *cb; | 1694 | struct cmdbuf_t *cb; |
1798 | struct bas_cardstate *ucs; | 1695 | struct bas_cardstate *ucs = cs->hw.bas; |
1799 | unsigned long flags; | 1696 | unsigned long flags; |
1800 | int rc; | 1697 | int rc; |
1801 | int retval = 0; | 1698 | int retval = 0; |
1802 | 1699 | ||
1803 | IFNULLRETVAL(cs, -EFAULT); | ||
1804 | ucs = cs->hw.bas; | ||
1805 | IFNULLRETVAL(ucs, -EFAULT); | ||
1806 | |||
1807 | /* check if AT channel is open */ | 1700 | /* check if AT channel is open */ |
1808 | if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) { | 1701 | if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) { |
1809 | gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open"); | 1702 | gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open"); |
@@ -2084,17 +1977,12 @@ static int gigaset_initcshw(struct cardstate *cs) | |||
2084 | */ | 1977 | */ |
2085 | static void freeurbs(struct cardstate *cs) | 1978 | static void freeurbs(struct cardstate *cs) |
2086 | { | 1979 | { |
2087 | struct bas_cardstate *ucs; | 1980 | struct bas_cardstate *ucs = cs->hw.bas; |
2088 | struct bas_bc_state *ubc; | 1981 | struct bas_bc_state *ubc; |
2089 | int i, j; | 1982 | int i, j; |
2090 | 1983 | ||
2091 | IFNULLRET(cs); | ||
2092 | ucs = cs->hw.bas; | ||
2093 | IFNULLRET(ucs); | ||
2094 | |||
2095 | for (j = 0; j < 2; ++j) { | 1984 | for (j = 0; j < 2; ++j) { |
2096 | ubc = cs->bcs[j].hw.bas; | 1985 | ubc = cs->bcs[j].hw.bas; |
2097 | IFNULLCONT(ubc); | ||
2098 | for (i = 0; i < BAS_OUTURBS; ++i) | 1986 | for (i = 0; i < BAS_OUTURBS; ++i) |
2099 | if (ubc->isoouturbs[i].urb) { | 1987 | if (ubc->isoouturbs[i].urb) { |
2100 | usb_kill_urb(ubc->isoouturbs[i].urb); | 1988 | usb_kill_urb(ubc->isoouturbs[i].urb); |
@@ -2160,8 +2048,6 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2160 | int i, j; | 2048 | int i, j; |
2161 | int ret; | 2049 | int ret; |
2162 | 2050 | ||
2163 | IFNULLRETVAL(udev, -ENODEV); | ||
2164 | |||
2165 | gig_dbg(DEBUG_ANY, | 2051 | gig_dbg(DEBUG_ANY, |
2166 | "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", | 2052 | "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", |
2167 | __func__, le16_to_cpu(udev->descriptor.idVendor), | 2053 | __func__, le16_to_cpu(udev->descriptor.idVendor), |
@@ -2314,9 +2200,7 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
2314 | 2200 | ||
2315 | cs = usb_get_intfdata(interface); | 2201 | cs = usb_get_intfdata(interface); |
2316 | 2202 | ||
2317 | IFNULLRET(cs); | ||
2318 | ucs = cs->hw.bas; | 2203 | ucs = cs->hw.bas; |
2319 | IFNULLRET(ucs); | ||
2320 | 2204 | ||
2321 | dev_info(cs->dev, "disconnecting Gigaset base\n"); | 2205 | dev_info(cs->dev, "disconnecting Gigaset base\n"); |
2322 | gigaset_stop(cs); | 2206 | gigaset_stop(cs); |