diff options
Diffstat (limited to 'drivers/isdn/gigaset/gigaset.h')
-rw-r--r-- | drivers/isdn/gigaset/gigaset.h | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index 7acae34e66e0..446a078224a9 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h | |||
@@ -902,47 +902,9 @@ static inline void gigaset_rcv_error(struct sk_buff *procskb, | |||
902 | /* bitwise byte inversion table */ | 902 | /* bitwise byte inversion table */ |
903 | extern __u8 gigaset_invtab[]; /* in common.c */ | 903 | extern __u8 gigaset_invtab[]; /* in common.c */ |
904 | 904 | ||
905 | |||
906 | /* append received bytes to inbuf */ | 905 | /* append received bytes to inbuf */ |
907 | static inline int gigaset_fill_inbuf(struct inbuf_t *inbuf, | 906 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, |
908 | const unsigned char *src, | 907 | unsigned numbytes); |
909 | unsigned numbytes) | ||
910 | { | ||
911 | unsigned n, head, tail, bytesleft; | ||
912 | |||
913 | gig_dbg(DEBUG_INTR, "received %u bytes", numbytes); | ||
914 | |||
915 | if (!numbytes) | ||
916 | return 0; | ||
917 | |||
918 | bytesleft = numbytes; | ||
919 | tail = atomic_read(&inbuf->tail); | ||
920 | head = atomic_read(&inbuf->head); | ||
921 | gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail); | ||
922 | |||
923 | while (bytesleft) { | ||
924 | if (head > tail) | ||
925 | n = head - 1 - tail; | ||
926 | else if (head == 0) | ||
927 | n = (RBUFSIZE-1) - tail; | ||
928 | else | ||
929 | n = RBUFSIZE - tail; | ||
930 | if (!n) { | ||
931 | dev_err(inbuf->cs->dev, | ||
932 | "buffer overflow (%u bytes lost)", bytesleft); | ||
933 | break; | ||
934 | } | ||
935 | if (n > bytesleft) | ||
936 | n = bytesleft; | ||
937 | memcpy(inbuf->data + tail, src, n); | ||
938 | bytesleft -= n; | ||
939 | tail = (tail + n) % RBUFSIZE; | ||
940 | src += n; | ||
941 | } | ||
942 | gig_dbg(DEBUG_INTR, "setting tail to %u", tail); | ||
943 | atomic_set(&inbuf->tail, tail); | ||
944 | return numbytes != bytesleft; | ||
945 | } | ||
946 | 908 | ||
947 | /* =========================================================================== | 909 | /* =========================================================================== |
948 | * Functions implemented in interface.c | 910 | * Functions implemented in interface.c |