aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/common.c
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2006-04-11 01:55:09 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 09:18:50 -0400
commit714e8236e5ea9d39169761c546274ceb7eeb765f (patch)
treeff24b813867d9461abe2bc042034d5afdd4ceae1 /drivers/isdn/gigaset/common.c
parentd48c77841a71ba552ef4e6a862642073652f4473 (diff)
[PATCH] isdn4linux: Siemens Gigaset drivers: uninline
With Hansjoerg Lipp <hjlipp@web.de> Uninline a function which was slightly too big to warrant inlining. 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/gigaset/common.c')
-rw-r--r--drivers/isdn/gigaset/common.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 2ea4976aa02a..5155c5b07a06 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -521,6 +521,47 @@ static void gigaset_inbuf_init(struct inbuf_t *inbuf, struct bc_state *bcs,
521 inbuf->inputstate = inputstate; 521 inbuf->inputstate = inputstate;
522} 522}
523 523
524/* append received bytes to inbuf */
525int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
526 unsigned numbytes)
527{
528 unsigned n, head, tail, bytesleft;
529
530 gig_dbg(DEBUG_INTR, "received %u bytes", numbytes);
531
532 if (!numbytes)
533 return 0;
534
535 bytesleft = numbytes;
536 tail = atomic_read(&inbuf->tail);
537 head = atomic_read(&inbuf->head);
538 gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
539
540 while (bytesleft) {
541 if (head > tail)
542 n = head - 1 - tail;
543 else if (head == 0)
544 n = (RBUFSIZE-1) - tail;
545 else
546 n = RBUFSIZE - tail;
547 if (!n) {
548 dev_err(inbuf->cs->dev,
549 "buffer overflow (%u bytes lost)", bytesleft);
550 break;
551 }
552 if (n > bytesleft)
553 n = bytesleft;
554 memcpy(inbuf->data + tail, src, n);
555 bytesleft -= n;
556 tail = (tail + n) % RBUFSIZE;
557 src += n;
558 }
559 gig_dbg(DEBUG_INTR, "setting tail to %u", tail);
560 atomic_set(&inbuf->tail, tail);
561 return numbytes != bytesleft;
562}
563EXPORT_SYMBOL_GPL(gigaset_fill_inbuf);
564
524/* Initialize the b-channel structure */ 565/* Initialize the b-channel structure */
525static struct bc_state *gigaset_initbcs(struct bc_state *bcs, 566static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
526 struct cardstate *cs, int channel) 567 struct cardstate *cs, int channel)