aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/isocdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/gigaset/isocdata.c')
-rw-r--r--drivers/isdn/gigaset/isocdata.c139
1 files changed, 68 insertions, 71 deletions
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index 5744eb91b315..45f017ed6e8c 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -10,10 +10,6 @@
10 * published by the Free Software Foundation; either version 2 of 10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version. 11 * the License, or (at your option) any later version.
12 * ===================================================================== 12 * =====================================================================
13 * ToDo: ...
14 * =====================================================================
15 * Version: $Id: isocdata.c,v 1.2.2.5 2005/11/13 23:05:19 hjlipp Exp $
16 * =====================================================================
17 */ 13 */
18 14
19#include "gigaset.h" 15#include "gigaset.h"
@@ -87,14 +83,14 @@ static inline int isowbuf_startwrite(struct isowbuf_t *iwb)
87{ 83{
88 if (!atomic_dec_and_test(&iwb->writesem)) { 84 if (!atomic_dec_and_test(&iwb->writesem)) {
89 atomic_inc(&iwb->writesem); 85 atomic_inc(&iwb->writesem);
90 dbg(DEBUG_ISO, 86 gig_dbg(DEBUG_ISO, "%s: couldn't acquire iso write semaphore",
91 "%s: couldn't acquire iso write semaphore", __func__); 87 __func__);
92 return 0; 88 return 0;
93 } 89 }
94#ifdef CONFIG_GIGASET_DEBUG 90#ifdef CONFIG_GIGASET_DEBUG
95 dbg(DEBUG_ISO, 91 gig_dbg(DEBUG_ISO,
96 "%s: acquired iso write semaphore, data[write]=%02x, nbits=%d", 92 "%s: acquired iso write semaphore, data[write]=%02x, nbits=%d",
97 __func__, iwb->data[atomic_read(&iwb->write)], iwb->wbits); 93 __func__, iwb->data[atomic_read(&iwb->write)], iwb->wbits);
98#endif 94#endif
99 return 1; 95 return 1;
100} 96}
@@ -147,7 +143,7 @@ static inline void isowbuf_putflag(struct isowbuf_t *iwb)
147 /* recover the idle flag byte */ 143 /* recover the idle flag byte */
148 write = atomic_read(&iwb->write); 144 write = atomic_read(&iwb->write);
149 iwb->idle = iwb->data[write]; 145 iwb->idle = iwb->data[write];
150 dbg(DEBUG_ISO, "idle fill byte %02x", iwb->idle); 146 gig_dbg(DEBUG_ISO, "idle fill byte %02x", iwb->idle);
151 /* mask extraneous bits in buffer */ 147 /* mask extraneous bits in buffer */
152 iwb->data[write] &= (1 << iwb->wbits) - 1; 148 iwb->data[write] &= (1 << iwb->wbits) - 1;
153} 149}
@@ -166,15 +162,14 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
166 read = atomic_read(&iwb->nextread); 162 read = atomic_read(&iwb->nextread);
167 write = atomic_read(&iwb->write); 163 write = atomic_read(&iwb->write);
168 if (likely(read == write)) { 164 if (likely(read == write)) {
169 //dbg(DEBUG_STREAM, "%s: send buffer empty", __func__);
170 /* return idle frame */ 165 /* return idle frame */
171 return read < BAS_OUTBUFPAD ? 166 return read < BAS_OUTBUFPAD ?
172 BAS_OUTBUFSIZE : read - BAS_OUTBUFPAD; 167 BAS_OUTBUFSIZE : read - BAS_OUTBUFPAD;
173 } 168 }
174 169
175 limit = read + size; 170 limit = read + size;
176 dbg(DEBUG_STREAM, 171 gig_dbg(DEBUG_STREAM, "%s: read=%d write=%d limit=%d",
177 "%s: read=%d write=%d limit=%d", __func__, read, write, limit); 172 __func__, read, write, limit);
178#ifdef CONFIG_GIGASET_DEBUG 173#ifdef CONFIG_GIGASET_DEBUG
179 if (unlikely(size < 0 || size > BAS_OUTBUFPAD)) { 174 if (unlikely(size < 0 || size > BAS_OUTBUFPAD)) {
180 err("invalid size %d", size); 175 err("invalid size %d", size);
@@ -196,11 +191,12 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
196 return -EBUSY; 191 return -EBUSY;
197 /* write position could have changed */ 192 /* write position could have changed */
198 if (limit >= (write = atomic_read(&iwb->write))) { 193 if (limit >= (write = atomic_read(&iwb->write))) {
199 pbyte = iwb->data[write]; /* save partial byte */ 194 pbyte = iwb->data[write]; /* save
195 partial byte */
200 limit = write + BAS_OUTBUFPAD; 196 limit = write + BAS_OUTBUFPAD;
201 dbg(DEBUG_STREAM, 197 gig_dbg(DEBUG_STREAM,
202 "%s: filling %d->%d with %02x", 198 "%s: filling %d->%d with %02x",
203 __func__, write, limit, iwb->idle); 199 __func__, write, limit, iwb->idle);
204 if (write + BAS_OUTBUFPAD < BAS_OUTBUFSIZE) 200 if (write + BAS_OUTBUFPAD < BAS_OUTBUFSIZE)
205 memset(iwb->data + write, iwb->idle, 201 memset(iwb->data + write, iwb->idle,
206 BAS_OUTBUFPAD); 202 BAS_OUTBUFPAD);
@@ -211,9 +207,11 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
211 - write); 207 - write);
212 limit = 0; 208 limit = 0;
213 } 209 }
214 dbg(DEBUG_STREAM, "%s: restoring %02x at %d", 210 gig_dbg(DEBUG_STREAM,
215 __func__, pbyte, limit); 211 "%s: restoring %02x at %d",
216 iwb->data[limit] = pbyte; /* restore partial byte */ 212 __func__, pbyte, limit);
213 iwb->data[limit] = pbyte; /* restore
214 partial byte */
217 atomic_set(&iwb->write, limit); 215 atomic_set(&iwb->write, limit);
218 } 216 }
219 isowbuf_donewrite(iwb); 217 isowbuf_donewrite(iwb);
@@ -242,19 +240,17 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size)
242 * write hex bytes to syslog for debugging 240 * write hex bytes to syslog for debugging
243 */ 241 */
244static inline void dump_bytes(enum debuglevel level, const char *tag, 242static inline void dump_bytes(enum debuglevel level, const char *tag,
245 unsigned char *bytes, int count) 243 unsigned char *bytes, int count)
246{ 244{
247#ifdef CONFIG_GIGASET_DEBUG 245#ifdef CONFIG_GIGASET_DEBUG
248 unsigned char c; 246 unsigned char c;
249 static char dbgline[3 * 32 + 1]; 247 static char dbgline[3 * 32 + 1];
250 static const char hexdigit[] = "0123456789abcdef"; 248 static const char hexdigit[] = "0123456789abcdef";
251 int i = 0; 249 int i = 0;
252 IFNULLRET(tag);
253 IFNULLRET(bytes);
254 while (count-- > 0) { 250 while (count-- > 0) {
255 if (i > sizeof(dbgline) - 4) { 251 if (i > sizeof(dbgline) - 4) {
256 dbgline[i] = '\0'; 252 dbgline[i] = '\0';
257 dbg(level, "%s:%s", tag, dbgline); 253 gig_dbg(level, "%s:%s", tag, dbgline);
258 i = 0; 254 i = 0;
259 } 255 }
260 c = *bytes++; 256 c = *bytes++;
@@ -264,7 +260,7 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
264 dbgline[i++] = hexdigit[c & 0x0f]; 260 dbgline[i++] = hexdigit[c & 0x0f];
265 } 261 }
266 dbgline[i] = '\0'; 262 dbgline[i] = '\0';
267 dbg(level, "%s:%s", tag, dbgline); 263 gig_dbg(level, "%s:%s", tag, dbgline);
268#endif 264#endif
269} 265}
270 266
@@ -380,7 +376,7 @@ static u16 stufftab[5 * 256] = {
380 */ 376 */
381 377
382static inline int hdlc_bitstuff_byte(struct isowbuf_t *iwb, unsigned char cin, 378static inline int hdlc_bitstuff_byte(struct isowbuf_t *iwb, unsigned char cin,
383 int ones) 379 int ones)
384{ 380{
385 u16 stuff; 381 u16 stuff;
386 int shiftinc, newones; 382 int shiftinc, newones;
@@ -422,7 +418,7 @@ static inline int hdlc_bitstuff_byte(struct isowbuf_t *iwb, unsigned char cin,
422 */ 418 */
423 419
424static inline int hdlc_buildframe(struct isowbuf_t *iwb, 420static inline int hdlc_buildframe(struct isowbuf_t *iwb,
425 unsigned char *in, int count) 421 unsigned char *in, int count)
426{ 422{
427 int ones; 423 int ones;
428 u16 fcs; 424 u16 fcs;
@@ -431,8 +427,8 @@ static inline int hdlc_buildframe(struct isowbuf_t *iwb,
431 427
432 if (isowbuf_freebytes(iwb) < count + count / 5 + 6 || 428 if (isowbuf_freebytes(iwb) < count + count / 5 + 6 ||
433 !isowbuf_startwrite(iwb)) { 429 !isowbuf_startwrite(iwb)) {
434 dbg(DEBUG_ISO, "%s: %d bytes free -> -EAGAIN", 430 gig_dbg(DEBUG_ISO, "%s: %d bytes free -> -EAGAIN",
435 __func__, isowbuf_freebytes(iwb)); 431 __func__, isowbuf_freebytes(iwb));
436 return -EAGAIN; 432 return -EAGAIN;
437 } 433 }
438 434
@@ -484,11 +480,11 @@ static inline int trans_buildframe(struct isowbuf_t *iwb,
484 480
485 if (isowbuf_freebytes(iwb) < count || 481 if (isowbuf_freebytes(iwb) < count ||
486 !isowbuf_startwrite(iwb)) { 482 !isowbuf_startwrite(iwb)) {
487 dbg(DEBUG_ISO, "can't put %d bytes", count); 483 gig_dbg(DEBUG_ISO, "can't put %d bytes", count);
488 return -EAGAIN; 484 return -EAGAIN;
489 } 485 }
490 486
491 dbg(DEBUG_STREAM, "put %d bytes", count); 487 gig_dbg(DEBUG_STREAM, "put %d bytes", count);
492 write = atomic_read(&iwb->write); 488 write = atomic_read(&iwb->write);
493 do { 489 do {
494 c = gigaset_invtab[*in++]; 490 c = gigaset_invtab[*in++];
@@ -508,11 +504,13 @@ int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len)
508 switch (bcs->proto2) { 504 switch (bcs->proto2) {
509 case ISDN_PROTO_L2_HDLC: 505 case ISDN_PROTO_L2_HDLC:
510 result = hdlc_buildframe(bcs->hw.bas->isooutbuf, in, len); 506 result = hdlc_buildframe(bcs->hw.bas->isooutbuf, in, len);
511 dbg(DEBUG_ISO, "%s: %d bytes HDLC -> %d", __func__, len, result); 507 gig_dbg(DEBUG_ISO, "%s: %d bytes HDLC -> %d",
508 __func__, len, result);
512 break; 509 break;
513 default: /* assume transparent */ 510 default: /* assume transparent */
514 result = trans_buildframe(bcs->hw.bas->isooutbuf, in, len); 511 result = trans_buildframe(bcs->hw.bas->isooutbuf, in, len);
515 dbg(DEBUG_ISO, "%s: %d bytes trans -> %d", __func__, len, result); 512 gig_dbg(DEBUG_ISO, "%s: %d bytes trans -> %d",
513 __func__, len, result);
516 } 514 }
517 return result; 515 return result;
518} 516}
@@ -528,13 +526,13 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs)
528 return; 526 return;
529 } 527 }
530 if (unlikely(bcs->skb->len == SBUFSIZE)) { 528 if (unlikely(bcs->skb->len == SBUFSIZE)) {
531 warn("received oversized packet discarded"); 529 dev_warn(bcs->cs->dev, "received oversized packet discarded\n");
532 bcs->hw.bas->giants++; 530 bcs->hw.bas->giants++;
533 dev_kfree_skb_any(bcs->skb); 531 dev_kfree_skb_any(bcs->skb);
534 bcs->skb = NULL; 532 bcs->skb = NULL;
535 return; 533 return;
536 } 534 }
537 *gigaset_skb_put_quick(bcs->skb, 1) = c; 535 *__skb_put(bcs->skb, 1) = c;
538} 536}
539 537
540/* hdlc_flush 538/* hdlc_flush
@@ -549,7 +547,7 @@ static inline void hdlc_flush(struct bc_state *bcs)
549 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) 547 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
550 skb_reserve(bcs->skb, HW_HDR_LEN); 548 skb_reserve(bcs->skb, HW_HDR_LEN);
551 else 549 else
552 err("could not allocate skb"); 550 dev_err(bcs->cs->dev, "could not allocate skb\n");
553 } 551 }
554 552
555 /* reset packet state */ 553 /* reset packet state */
@@ -571,23 +569,25 @@ static inline void hdlc_done(struct bc_state *bcs)
571 569
572 if ((procskb = bcs->skb) == NULL) { 570 if ((procskb = bcs->skb) == NULL) {
573 /* previous error */ 571 /* previous error */
574 dbg(DEBUG_ISO, "%s: skb=NULL", __func__); 572 gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__);
575 gigaset_rcv_error(NULL, bcs->cs, bcs); 573 gigaset_rcv_error(NULL, bcs->cs, bcs);
576 } else if (procskb->len < 2) { 574 } else if (procskb->len < 2) {
577 notice("received short frame (%d octets)", procskb->len); 575 dev_notice(bcs->cs->dev, "received short frame (%d octets)\n",
576 procskb->len);
578 bcs->hw.bas->runts++; 577 bcs->hw.bas->runts++;
579 gigaset_rcv_error(procskb, bcs->cs, bcs); 578 gigaset_rcv_error(procskb, bcs->cs, bcs);
580 } else if (bcs->fcs != PPP_GOODFCS) { 579 } else if (bcs->fcs != PPP_GOODFCS) {
581 notice("frame check error (0x%04x)", bcs->fcs); 580 dev_notice(bcs->cs->dev, "frame check error (0x%04x)\n",
581 bcs->fcs);
582 bcs->hw.bas->fcserrs++; 582 bcs->hw.bas->fcserrs++;
583 gigaset_rcv_error(procskb, bcs->cs, bcs); 583 gigaset_rcv_error(procskb, bcs->cs, bcs);
584 } else { 584 } else {
585 procskb->len -= 2; /* subtract FCS */ 585 procskb->len -= 2; /* subtract FCS */
586 procskb->tail -= 2; 586 procskb->tail -= 2;
587 dbg(DEBUG_ISO, 587 gig_dbg(DEBUG_ISO, "%s: good frame (%d octets)",
588 "%s: good frame (%d octets)", __func__, procskb->len); 588 __func__, procskb->len);
589 dump_bytes(DEBUG_STREAM, 589 dump_bytes(DEBUG_STREAM,
590 "rcv data", procskb->data, procskb->len); 590 "rcv data", procskb->data, procskb->len);
591 bcs->hw.bas->goodbytes += procskb->len; 591 bcs->hw.bas->goodbytes += procskb->len;
592 gigaset_rcv_skb(procskb, bcs->cs, bcs); 592 gigaset_rcv_skb(procskb, bcs->cs, bcs);
593 } 593 }
@@ -595,7 +595,7 @@ static inline void hdlc_done(struct bc_state *bcs)
595 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) 595 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
596 skb_reserve(bcs->skb, HW_HDR_LEN); 596 skb_reserve(bcs->skb, HW_HDR_LEN);
597 else 597 else
598 err("could not allocate skb"); 598 dev_err(bcs->cs->dev, "could not allocate skb\n");
599 bcs->fcs = PPP_INITFCS; 599 bcs->fcs = PPP_INITFCS;
600} 600}
601 601
@@ -610,14 +610,14 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits)
610 return; 610 return;
611 } 611 }
612 612
613 notice("received partial byte (%d bits)", inbits); 613 dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits);
614 bcs->hw.bas->alignerrs++; 614 bcs->hw.bas->alignerrs++;
615 gigaset_rcv_error(bcs->skb, bcs->cs, bcs); 615 gigaset_rcv_error(bcs->skb, bcs->cs, bcs);
616 616
617 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) 617 if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
618 skb_reserve(bcs->skb, HW_HDR_LEN); 618 skb_reserve(bcs->skb, HW_HDR_LEN);
619 else 619 else
620 err("could not allocate skb"); 620 dev_err(bcs->cs->dev, "could not allocate skb\n");
621 bcs->fcs = PPP_INITFCS; 621 bcs->fcs = PPP_INITFCS;
622} 622}
623 623
@@ -659,16 +659,12 @@ static unsigned char bitcounts[256] = {
659 * bcs receiving B channel structure 659 * bcs receiving B channel structure
660 */ 660 */
661static inline void hdlc_unpack(unsigned char *src, unsigned count, 661static inline void hdlc_unpack(unsigned char *src, unsigned count,
662 struct bc_state *bcs) 662 struct bc_state *bcs)
663{ 663{
664 struct bas_bc_state *ubc; 664 struct bas_bc_state *ubc = bcs->hw.bas;
665 int inputstate; 665 int inputstate;
666 unsigned seqlen, inbyte, inbits; 666 unsigned seqlen, inbyte, inbits;
667 667
668 IFNULLRET(bcs);
669 ubc = bcs->hw.bas;
670 IFNULLRET(ubc);
671
672 /* load previous state: 668 /* load previous state:
673 * inputstate = set of flag bits: 669 * inputstate = set of flag bits:
674 * - 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
@@ -856,7 +852,7 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count,
856 * bcs receiving B channel structure 852 * bcs receiving B channel structure
857 */ 853 */
858static inline void trans_receive(unsigned char *src, unsigned count, 854static inline void trans_receive(unsigned char *src, unsigned count,
859 struct bc_state *bcs) 855 struct bc_state *bcs)
860{ 856{
861 struct sk_buff *skb; 857 struct sk_buff *skb;
862 int dobytes; 858 int dobytes;
@@ -870,7 +866,7 @@ static inline void trans_receive(unsigned char *src, unsigned count,
870 if (unlikely((skb = bcs->skb) == NULL)) { 866 if (unlikely((skb = bcs->skb) == NULL)) {
871 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN); 867 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN);
872 if (!skb) { 868 if (!skb) {
873 err("could not allocate skb"); 869 dev_err(bcs->cs->dev, "could not allocate skb\n");
874 return; 870 return;
875 } 871 }
876 skb_reserve(skb, HW_HDR_LEN); 872 skb_reserve(skb, HW_HDR_LEN);
@@ -888,7 +884,8 @@ static inline void trans_receive(unsigned char *src, unsigned count,
888 gigaset_rcv_skb(skb, bcs->cs, bcs); 884 gigaset_rcv_skb(skb, bcs->cs, bcs);
889 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN); 885 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN);
890 if (!skb) { 886 if (!skb) {
891 err("could not allocate skb"); 887 dev_err(bcs->cs->dev,
888 "could not allocate skb\n");
892 return; 889 return;
893 } 890 }
894 skb_reserve(bcs->skb, HW_HDR_LEN); 891 skb_reserve(bcs->skb, HW_HDR_LEN);
@@ -921,8 +918,8 @@ static void cmd_loop(unsigned char *src, int numbytes, struct inbuf_t *inbuf)
921 case '\r': 918 case '\r':
922 case '\n': 919 case '\n':
923 /* end of line */ 920 /* end of line */
924 dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)", 921 gig_dbg(DEBUG_TRANSCMD, "%s: End of Command (%d Bytes)",
925 __func__, cbytes); 922 __func__, cbytes);
926 cs->cbytes = cbytes; 923 cs->cbytes = cbytes;
927 gigaset_handle_modem_response(cs); 924 gigaset_handle_modem_response(cs);
928 cbytes = 0; 925 cbytes = 0;
@@ -932,7 +929,7 @@ static void cmd_loop(unsigned char *src, int numbytes, struct inbuf_t *inbuf)
932 if (cbytes < MAX_RESP_SIZE - 1) 929 if (cbytes < MAX_RESP_SIZE - 1)
933 cbytes++; 930 cbytes++;
934 else 931 else
935 warn("response too large"); 932 dev_warn(cs->dev, "response too large\n");
936 } 933 }
937 } 934 }
938 935
@@ -951,27 +948,27 @@ void gigaset_isoc_input(struct inbuf_t *inbuf)
951 948
952 head = atomic_read(&inbuf->head); 949 head = atomic_read(&inbuf->head);
953 while (head != (tail = atomic_read(&inbuf->tail))) { 950 while (head != (tail = atomic_read(&inbuf->tail))) {
954 dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail); 951 gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
955 if (head > tail) 952 if (head > tail)
956 tail = RBUFSIZE; 953 tail = RBUFSIZE;
957 src = inbuf->data + head; 954 src = inbuf->data + head;
958 numbytes = tail - head; 955 numbytes = tail - head;
959 dbg(DEBUG_INTR, "processing %u bytes", numbytes); 956 gig_dbg(DEBUG_INTR, "processing %u bytes", numbytes);
960 957
961 if (atomic_read(&cs->mstate) == MS_LOCKED) { 958 if (atomic_read(&cs->mstate) == MS_LOCKED) {
962 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response", 959 gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
963 numbytes, src, 0); 960 numbytes, src);
964 gigaset_if_receive(inbuf->cs, src, numbytes); 961 gigaset_if_receive(inbuf->cs, src, numbytes);
965 } else { 962 } else {
966 gigaset_dbg_buffer(DEBUG_CMD, "received response", 963 gigaset_dbg_buffer(DEBUG_CMD, "received response",
967 numbytes, src, 0); 964 numbytes, src);
968 cmd_loop(src, numbytes, inbuf); 965 cmd_loop(src, numbytes, inbuf);
969 } 966 }
970 967
971 head += numbytes; 968 head += numbytes;
972 if (head == RBUFSIZE) 969 if (head == RBUFSIZE)
973 head = 0; 970 head = 0;
974 dbg(DEBUG_INTR, "setting head to %u", head); 971 gig_dbg(DEBUG_INTR, "setting head to %u", head);
975 atomic_set(&inbuf->head, head); 972 atomic_set(&inbuf->head, head);
976 } 973 }
977} 974}
@@ -992,18 +989,18 @@ void gigaset_isoc_input(struct inbuf_t *inbuf)
992 */ 989 */
993int 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)
994{ 991{
995 int len; 992 int len = skb->len;
996 993 unsigned long flags;
997 IFNULLRETVAL(bcs, -EFAULT);
998 IFNULLRETVAL(skb, -EFAULT);
999 len = skb->len;
1000 994
1001 skb_queue_tail(&bcs->squeue, skb); 995 skb_queue_tail(&bcs->squeue, skb);
1002 dbg(DEBUG_ISO, 996 gig_dbg(DEBUG_ISO, "%s: skb queued, qlen=%d",
1003 "%s: skb queued, qlen=%d", __func__, skb_queue_len(&bcs->squeue)); 997 __func__, skb_queue_len(&bcs->squeue));
1004 998
1005 /* tasklet submits URB if necessary */ 999 /* tasklet submits URB if necessary */
1006 tasklet_schedule(&bcs->hw.bas->sent_tasklet); 1000 spin_lock_irqsave(&bcs->cs->lock, flags);
1001 if (bcs->cs->connected)
1002 tasklet_schedule(&bcs->hw.bas->sent_tasklet);
1003 spin_unlock_irqrestore(&bcs->cs->lock, flags);
1007 1004
1008 return len; /* ok so far */ 1005 return len; /* ok so far */
1009} 1006}