aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2006-04-11 01:55:08 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 09:18:49 -0400
commitd48c77841a71ba552ef4e6a862642073652f4473 (patch)
tree98e76d8bd9962eba7f5897e9d24acacc88b4e1f6 /drivers/isdn
parentb1d47464c947f08125dc4ac4a2321ced9e2fed29 (diff)
[PATCH] isdn4linux: Siemens Gigaset drivers: remove IFNULL macros
With Hansjoerg Lipp <hjlipp@web.de> Remove the IFNULL debugging macros from the Gigaset drivers. Signed-off-by: Hansjoerg Lipp <hjlipp@web.de> Signed-off-by: Tilman Schmidt <tilman@imap.cc> Cc: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/gigaset/asyncdata.c27
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c174
-rw-r--r--drivers/isdn/gigaset/ev-layer.c30
-rw-r--r--drivers/isdn/gigaset/gigaset.h27
-rw-r--r--drivers/isdn/gigaset/isocdata.c14
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c27
6 files changed, 43 insertions, 256 deletions
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c
index a375d0a411b5..8601b7a8f6a6 100644
--- a/drivers/isdn/gigaset/asyncdata.c
+++ b/drivers/isdn/gigaset/asyncdata.c
@@ -117,20 +117,14 @@ static inline int hdlc_loop(unsigned char c, unsigned char *src, int numbytes,
117{ 117{
118 struct cardstate *cs = inbuf->cs; 118 struct cardstate *cs = inbuf->cs;
119 struct bc_state *bcs = inbuf->bcs; 119 struct bc_state *bcs = inbuf->bcs;
120 int inputstate; 120 int inputstate = bcs->inputstate;
121 __u16 fcs; 121 __u16 fcs = bcs->fcs;
122 struct sk_buff *skb; 122 struct sk_buff *skb = bcs->skb;
123 unsigned char error; 123 unsigned char error;
124 struct sk_buff *compskb; 124 struct sk_buff *compskb;
125 int startbytes = numbytes; 125 int startbytes = numbytes;
126 int l; 126 int l;
127 127
128 IFNULLRETVAL(bcs, numbytes);
129 inputstate = bcs->inputstate;
130 fcs = bcs->fcs;
131 skb = bcs->skb;
132 IFNULLRETVAL(skb, numbytes);
133
134 if (unlikely(inputstate & INS_byte_stuff)) { 128 if (unlikely(inputstate & INS_byte_stuff)) {
135 inputstate &= ~INS_byte_stuff; 129 inputstate &= ~INS_byte_stuff;
136 goto byte_stuff; 130 goto byte_stuff;
@@ -292,15 +286,10 @@ static inline int iraw_loop(unsigned char c, unsigned char *src, int numbytes,
292{ 286{
293 struct cardstate *cs = inbuf->cs; 287 struct cardstate *cs = inbuf->cs;
294 struct bc_state *bcs = inbuf->bcs; 288 struct bc_state *bcs = inbuf->bcs;
295 int inputstate; 289 int inputstate = bcs->inputstate;
296 struct sk_buff *skb; 290 struct sk_buff *skb = bcs->skb;
297 int startbytes = numbytes; 291 int startbytes = numbytes;
298 292
299 IFNULLRETVAL(bcs, numbytes);
300 inputstate = bcs->inputstate;
301 skb = bcs->skb;
302 IFNULLRETVAL(skb, numbytes);
303
304 for (;;) { 293 for (;;) {
305 /* add character */ 294 /* add character */
306 inputstate |= INS_have_data; 295 inputstate |= INS_have_data;
@@ -577,11 +566,7 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb, int head, int tail)
577 */ 566 */
578int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb) 567int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
579{ 568{
580 unsigned len; 569 unsigned len = skb->len;
581
582 IFNULLRETVAL(bcs, -EFAULT);
583 IFNULLRETVAL(skb, -EFAULT);
584 len = skb->len;
585 570
586 if (bcs->proto2 == ISDN_PROTO_L2_HDLC) 571 if (bcs->proto2 == ISDN_PROTO_L2_HDLC)
587 skb = HDLC_Encode(skb, HW_HDR_LEN, 0); 572 skb = HDLC_Encode(skb, HW_HDR_LEN, 0);
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)
366static void cmd_in_timeout(unsigned long data) 363static 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 */
407static int atread_submit(struct cardstate *cs, int timeout) 400static 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 */
480static void read_int_callback(struct urb *urb, struct pt_regs *regs) 468static 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 */
639static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) 621static 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 */
849static int starturbs(struct bc_state *bcs) 812static 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 */
989static int submit_iso_write_urb(struct isow_urbctx_t *ucx) 946static 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 */
1066static void write_iso_tasklet(unsigned long data) 1016static 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 */
1238static void read_iso_tasklet(unsigned long data) 1181static 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)
1383static void req_timeout(unsigned long data) 1319static 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 */
1442static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs) 1373static 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 */
1483static int req_submit(struct bc_state *bcs, int req, int val, int timeout) 1409static 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 */
1614static void complete_cb(struct cardstate *cs) 1530static 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 */
1650static void write_command_callback(struct urb *urb, struct pt_regs *regs) 1562static 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)
1709static void atrdy_timeout(unsigned long data) 1615static 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 */
1737static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) 1639static 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)
1795static int start_cbsend(struct cardstate *cs) 1692static 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 */
2085static void freeurbs(struct cardstate *cs) 1978static 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);
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index 53490430a2e1..0bf6a283a5a6 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -442,8 +442,6 @@ static int isdn_getnum(char *p)
442{ 442{
443 int v = -1; 443 int v = -1;
444 444
445 IFNULLRETVAL(p, -1);
446
447 gig_dbg(DEBUG_TRANSCMD, "string: %s", p); 445 gig_dbg(DEBUG_TRANSCMD, "string: %s", p);
448 446
449 while (*p >= '0' && *p <= '9') 447 while (*p >= '0' && *p <= '9')
@@ -461,8 +459,6 @@ static int isdn_gethex(char *p)
461 int v = 0; 459 int v = 0;
462 int c; 460 int c;
463 461
464 IFNULLRETVAL(p, -1);
465
466 gig_dbg(DEBUG_TRANSCMD, "string: %s", p); 462 gig_dbg(DEBUG_TRANSCMD, "string: %s", p);
467 463
468 if (!*p) 464 if (!*p)
@@ -532,8 +528,6 @@ void gigaset_handle_modem_response(struct cardstate *cs)
532 int cid; 528 int cid;
533 int rawstring; 529 int rawstring;
534 530
535 IFNULLRET(cs);
536
537 len = cs->cbytes; 531 len = cs->cbytes;
538 if (!len) { 532 if (!len) {
539 /* ignore additional LFs/CRs (M10x config mode or cx100) */ 533 /* ignore additional LFs/CRs (M10x config mode or cx100) */
@@ -737,14 +731,8 @@ EXPORT_SYMBOL_GPL(gigaset_handle_modem_response);
737static void disconnect(struct at_state_t **at_state_p) 731static void disconnect(struct at_state_t **at_state_p)
738{ 732{
739 unsigned long flags; 733 unsigned long flags;
740 struct bc_state *bcs; 734 struct bc_state *bcs = (*at_state_p)->bcs;
741 struct cardstate *cs; 735 struct cardstate *cs = (*at_state_p)->cs;
742
743 IFNULLRET(at_state_p);
744 IFNULLRET(*at_state_p);
745 bcs = (*at_state_p)->bcs;
746 cs = (*at_state_p)->cs;
747 IFNULLRET(cs);
748 736
749 new_index(&(*at_state_p)->seq_index, MAX_SEQ_INDEX); 737 new_index(&(*at_state_p)->seq_index, MAX_SEQ_INDEX);
750 738
@@ -912,9 +900,6 @@ static struct at_state_t *at_state_from_cid(struct cardstate *cs, int cid)
912 900
913static void bchannel_down(struct bc_state *bcs) 901static void bchannel_down(struct bc_state *bcs)
914{ 902{
915 IFNULLRET(bcs);
916 IFNULLRET(bcs->cs);
917
918 if (bcs->chstate & CHS_B_UP) { 903 if (bcs->chstate & CHS_B_UP) {
919 bcs->chstate &= ~CHS_B_UP; 904 bcs->chstate &= ~CHS_B_UP;
920 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BHUP); 905 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BHUP);
@@ -932,8 +917,6 @@ static void bchannel_down(struct bc_state *bcs)
932 917
933static void bchannel_up(struct bc_state *bcs) 918static void bchannel_up(struct bc_state *bcs)
934{ 919{
935 IFNULLRET(bcs);
936
937 if (!(bcs->chstate & CHS_D_UP)) { 920 if (!(bcs->chstate & CHS_D_UP)) {
938 dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__); 921 dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__);
939 bcs->chstate |= CHS_D_UP; 922 bcs->chstate |= CHS_D_UP;
@@ -1607,9 +1590,6 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1607 int curact; 1590 int curact;
1608 unsigned long flags; 1591 unsigned long flags;
1609 1592
1610 IFNULLRET(cs);
1611 IFNULLRET(ev);
1612
1613 if (ev->cid >= 0) { 1593 if (ev->cid >= 0) {
1614 at_state = at_state_from_cid(cs, ev->cid); 1594 at_state = at_state_from_cid(cs, ev->cid);
1615 if (!at_state) { 1595 if (!at_state) {
@@ -1634,7 +1614,6 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1634 1614
1635 /* Setting the pointer to the dial array */ 1615 /* Setting the pointer to the dial array */
1636 rep = at_state->replystruct; 1616 rep = at_state->replystruct;
1637 IFNULLRET(rep);
1638 1617
1639 if (ev->type == EV_TIMEOUT) { 1618 if (ev->type == EV_TIMEOUT) {
1640 if (ev->parameter != atomic_read(&at_state->timer_index) 1619 if (ev->parameter != atomic_read(&at_state->timer_index)
@@ -1746,8 +1725,6 @@ static void process_command_flags(struct cardstate *cs)
1746 int i; 1725 int i;
1747 int sequence; 1726 int sequence;
1748 1727
1749 IFNULLRET(cs);
1750
1751 atomic_set(&cs->commands_pending, 0); 1728 atomic_set(&cs->commands_pending, 0);
1752 1729
1753 if (cs->cur_at_seq) { 1730 if (cs->cur_at_seq) {
@@ -1968,9 +1945,6 @@ void gigaset_handle_event(unsigned long data)
1968{ 1945{
1969 struct cardstate *cs = (struct cardstate *) data; 1946 struct cardstate *cs = (struct cardstate *) data;
1970 1947
1971 IFNULLRET(cs);
1972 IFNULLRET(cs->inbuf);
1973
1974 /* handle incoming data on control/common channel */ 1948 /* handle incoming data on control/common channel */
1975 if (atomic_read(&cs->inbuf->head) != atomic_read(&cs->inbuf->tail)) { 1949 if (atomic_read(&cs->inbuf->head) != atomic_read(&cs->inbuf->tail)) {
1976 gig_dbg(DEBUG_INTR, "processing new data"); 1950 gig_dbg(DEBUG_INTR, "processing new data");
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index 04457571923d..7acae34e66e0 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -72,33 +72,6 @@
72 72
73#define MAXACT 3 73#define MAXACT 3
74 74
75#define IFNULL(a) \
76 if (unlikely(!(a)))
77
78#define IFNULLRET(a) \
79 if (unlikely(!(a))) { \
80 err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
81 return; \
82 }
83
84#define IFNULLRETVAL(a,b) \
85 if (unlikely(!(a))) { \
86 err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
87 return (b); \
88 }
89
90#define IFNULLCONT(a) \
91 if (unlikely(!(a))) { \
92 err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
93 continue; \
94 }
95
96#define IFNULLGOTO(a,b) \
97 if (unlikely(!(a))) { \
98 err("%s==NULL at %s:%d!", #a, __FILE__, __LINE__); \
99 goto b; \
100 }
101
102extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */ 75extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */
103 76
104/* any combination of these can be given with the 'debug=' parameter to insmod, 77/* any combination of these can be given with the 'debug=' parameter to insmod,
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index 4a00d22c496e..0b7e5b610cc9 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -247,8 +247,6 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
247 static char dbgline[3 * 32 + 1]; 247 static char dbgline[3 * 32 + 1];
248 static const char hexdigit[] = "0123456789abcdef"; 248 static const char hexdigit[] = "0123456789abcdef";
249 int i = 0; 249 int i = 0;
250 IFNULLRET(tag);
251 IFNULLRET(bytes);
252 while (count-- > 0) { 250 while (count-- > 0) {
253 if (i > sizeof(dbgline) - 4) { 251 if (i > sizeof(dbgline) - 4) {
254 dbgline[i] = '\0'; 252 dbgline[i] = '\0';
@@ -663,14 +661,10 @@ static unsigned char bitcounts[256] = {
663static inline void hdlc_unpack(unsigned char *src, unsigned count, 661static inline void hdlc_unpack(unsigned char *src, unsigned count,
664 struct bc_state *bcs) 662 struct bc_state *bcs)
665{ 663{
666 struct bas_bc_state *ubc; 664 struct bas_bc_state *ubc = bcs->hw.bas;
667 int inputstate; 665 int inputstate;
668 unsigned seqlen, inbyte, inbits; 666 unsigned seqlen, inbyte, inbits;
669 667
670 IFNULLRET(bcs);
671 ubc = bcs->hw.bas;
672 IFNULLRET(ubc);
673
674 /* load previous state: 668 /* load previous state:
675 * inputstate = set of flag bits: 669 * inputstate = set of flag bits:
676 * - INS_flag_hunt: no complete opening flag received since connection setup or last abort 670 * - INS_flag_hunt: no complete opening flag received since connection setup or last abort
@@ -995,11 +989,7 @@ void gigaset_isoc_input(struct inbuf_t *inbuf)
995 */ 989 */
996int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb) 990int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb)
997{ 991{
998 int len; 992 int len = skb->len;
999
1000 IFNULLRETVAL(bcs, -EFAULT);
1001 IFNULLRETVAL(skb, -EFAULT);
1002 len = skb->len;
1003 993
1004 skb_queue_tail(&bcs->squeue, skb); 994 skb_queue_tail(&bcs->squeue, skb);
1005 gig_dbg(DEBUG_ISO, "%s: skb queued, qlen=%d", 995 gig_dbg(DEBUG_ISO, "%s: skb queued, qlen=%d",
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index a977dd570751..e1a3eeb3c21a 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -365,18 +365,12 @@ static void gigaset_modem_fill(unsigned long data)
365 */ 365 */
366static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs) 366static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs)
367{ 367{
368 struct inbuf_t *inbuf = urb->context;
369 struct cardstate *cs = inbuf->cs;
368 int resubmit = 0; 370 int resubmit = 0;
369 int r; 371 int r;
370 struct cardstate *cs;
371 unsigned numbytes; 372 unsigned numbytes;
372 unsigned char *src; 373 unsigned char *src;
373 struct inbuf_t *inbuf;
374
375 IFNULLRET(urb);
376 inbuf = (struct inbuf_t *) urb->context;
377 IFNULLRET(inbuf);
378 cs = inbuf->cs;
379 IFNULLRET(cs);
380 374
381 if (!atomic_read(&cs->connected)) { 375 if (!atomic_read(&cs->connected)) {
382 err("%s: disconnected", __func__); 376 err("%s: disconnected", __func__);
@@ -421,9 +415,8 @@ static void gigaset_read_int_callback(struct urb *urb, struct pt_regs *regs)
421/* This callback routine is called when data was transmitted to the device. */ 415/* This callback routine is called when data was transmitted to the device. */
422static void gigaset_write_bulk_callback(struct urb *urb, struct pt_regs *regs) 416static void gigaset_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
423{ 417{
424 struct cardstate *cs = (struct cardstate *) urb->context; 418 struct cardstate *cs = urb->context;
425 419
426 IFNULLRET(cs);
427#ifdef CONFIG_GIGASET_DEBUG 420#ifdef CONFIG_GIGASET_DEBUG
428 if (!atomic_read(&cs->connected)) { 421 if (!atomic_read(&cs->connected)) {
429 err("%s: not connected", __func__); 422 err("%s: not connected", __func__);
@@ -632,20 +625,13 @@ static int gigaset_initcshw(struct cardstate *cs)
632/* Send data from current skb to the device. */ 625/* Send data from current skb to the device. */
633static int write_modem(struct cardstate *cs) 626static int write_modem(struct cardstate *cs)
634{ 627{
635 int ret; 628 int ret = 0;
636 int count; 629 int count;
637 struct bc_state *bcs = &cs->bcs[0]; /* only one channel */ 630 struct bc_state *bcs = &cs->bcs[0]; /* only one channel */
638 struct usb_cardstate *ucs = cs->hw.usb; 631 struct usb_cardstate *ucs = cs->hw.usb;
639 632
640 IFNULLRETVAL(bcs->tx_skb, -EINVAL);
641
642 gig_dbg(DEBUG_WRITE, "len: %d...", bcs->tx_skb->len); 633 gig_dbg(DEBUG_WRITE, "len: %d...", bcs->tx_skb->len);
643 634
644 ret = -ENODEV;
645 IFNULLGOTO(ucs->bulk_out_buffer, error);
646 IFNULLGOTO(ucs->bulk_out_urb, error);
647 ret = 0;
648
649 if (!bcs->tx_skb->len) { 635 if (!bcs->tx_skb->len) {
650 dev_kfree_skb_any(bcs->tx_skb); 636 dev_kfree_skb_any(bcs->tx_skb);
651 bcs->tx_skb = NULL; 637 bcs->tx_skb = NULL;
@@ -683,11 +669,6 @@ static int write_modem(struct cardstate *cs)
683 } 669 }
684 670
685 return ret; 671 return ret;
686error:
687 dev_kfree_skb_any(bcs->tx_skb);
688 bcs->tx_skb = NULL;
689 return ret;
690
691} 672}
692 673
693static int gigaset_probe(struct usb_interface *interface, 674static int gigaset_probe(struct usb_interface *interface,