From: Mark Hounschell Date: Wed, 21 May 2014 19:08:32 +0000 (-0400) Subject: staging: dgap: Remove dead sniff buffer code X-Git-Tag: v4.14-rc1~7083^2~39^2~356 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d78acae3d172991dd960b57ad9f18e4471b7d8fe;p=platform%2Fkernel%2Flinux-rpi.git staging: dgap: Remove dead sniff buffer code The sniff buffer was a /proc filesystem file. This module no longer uses /proc. This patch removes the deaed code associated with the sniff buffer. Signed-off-by: Mark Hounschell Tested-by: Mark Hounschell Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 8cf0816..b452d84 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -1464,7 +1464,6 @@ static int dgap_tty_init(struct board_t *brd) init_waitqueue_head(&ch->ch_flags_wait); init_waitqueue_head(&ch->ch_tun.un_flags_wait); init_waitqueue_head(&ch->ch_pun.un_flags_wait); - init_waitqueue_head(&ch->ch_sniff_wait); /* Turn on all modem interrupts for now */ modem = (DM_CD | DM_DSR | DM_CTS | DM_RI); @@ -1531,123 +1530,6 @@ static void dgap_tty_uninit(struct board_t *brd) } } -#define TMPBUFLEN (1024) -/* - * dgap_sniff - Dump data out to the "sniff" buffer if the - * proc sniff file is opened... - */ -static void dgap_sniff_nowait_nolock(struct channel_t *ch, u8 *text, - u8 *buf, int len) -{ - struct timeval tv; - int n; - int r; - int nbuf; - int i; - int tmpbuflen; - char tmpbuf[TMPBUFLEN]; - char *p = tmpbuf; - int too_much_data; - - /* Leave if sniff not open */ - if (!(ch->ch_sniff_flags & SNIFF_OPEN)) - return; - - do_gettimeofday(&tv); - - /* Create our header for data dump */ - p += sprintf(p, "<%ld %ld><%s><", tv.tv_sec, tv.tv_usec, text); - tmpbuflen = p - tmpbuf; - - do { - too_much_data = 0; - - for (i = 0; i < len && tmpbuflen < (TMPBUFLEN - 4); i++) { - p += sprintf(p, "%02x ", *buf); - buf++; - tmpbuflen = p - tmpbuf; - } - - if (tmpbuflen < (TMPBUFLEN - 4)) { - if (i > 0) - p += sprintf(p - 1, "%s\n", ">"); - else - p += sprintf(p, "%s\n", ">"); - } else { - too_much_data = 1; - len -= i; - } - - nbuf = strlen(tmpbuf); - p = tmpbuf; - - /* - * Loop while data remains. - */ - while (nbuf > 0 && ch->ch_sniff_buf) { - /* - * Determine the amount of available space left in the - * buffer. If there's none, wait until some appears. - */ - n = (ch->ch_sniff_out - ch->ch_sniff_in - 1) & - SNIFF_MASK; - - /* - * If there is no space left to write to in our sniff - * buffer, we have no choice but to drop the data. - * We *cannot* sleep here waiting for space, because - * this function was probably called by the - * interrupt/timer routines! - */ - if (n == 0) - return; - - /* - * Copy as much data as will fit. - */ - - if (n > nbuf) - n = nbuf; - - r = SNIFF_MAX - ch->ch_sniff_in; - - if (r <= n) { - memcpy(ch->ch_sniff_buf + - ch->ch_sniff_in, p, r); - - n -= r; - ch->ch_sniff_in = 0; - p += r; - nbuf -= r; - } - - memcpy(ch->ch_sniff_buf + ch->ch_sniff_in, p, n); - - ch->ch_sniff_in += n; - p += n; - nbuf -= n; - - /* - * Wakeup any thread waiting for data - */ - if (ch->ch_sniff_flags & SNIFF_WAIT_DATA) { - ch->ch_sniff_flags &= ~SNIFF_WAIT_DATA; - wake_up_interruptible(&ch->ch_sniff_wait); - } - } - - /* - * If the user sent us too much data to push into our tmpbuf, - * we need to keep looping around on all the data. - */ - if (too_much_data) { - p = tmpbuf; - tmpbuflen = 0; - } - - } while (too_much_data); -} - /*======================================================================= * * dgap_input - Process received data. @@ -1811,7 +1693,6 @@ static void dgap_input(struct channel_t *ch) break; memcpy_fromio(buf, ch->ch_raddr + tail, s); - dgap_sniff_nowait_nolock(ch, "USER READ", buf, s); tail += s; buf += s; @@ -2875,8 +2756,6 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, vaddr = ch->ch_taddr + head; memcpy_toio(vaddr, (u8 *) buf, remain); - dgap_sniff_nowait_nolock(ch, "USER WRITE", (u8 *) buf, - remain); head = ch->ch_tstart; buf += remain; @@ -2891,9 +2770,6 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, remain = n; memcpy_toio(vaddr, (u8 *) buf, remain); - dgap_sniff_nowait_nolock(ch, "USER WRITE", (u8 *)buf, - remain); - head += remain; } diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h index 650a462..03c020e 100644 --- a/drivers/staging/dgap/dgap.h +++ b/drivers/staging/dgap/dgap.h @@ -1041,12 +1041,6 @@ struct channel_t { ulong ch_err_frame; /* Count of framing errors on channel */ ulong ch_err_break; /* Count of breaks on channel */ ulong ch_err_overrun; /* Count of overruns on channel */ - - uint ch_sniff_in; - uint ch_sniff_out; - char *ch_sniff_buf; /* Sniff buffer for proc */ - ulong ch_sniff_flags; /* Channel flags */ - wait_queue_head_t ch_sniff_wait; }; /************************************************************************