aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_gsm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-23 15:23:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-23 15:23:20 -0400
commit99dff5856220a02b8711f2e8746413ea6e53ccf6 (patch)
treed8bae7ccdf8f7ad5221b053bb74a6220df996b3a /drivers/tty/n_gsm.c
parentbb74e8ca352eecefdc5c1a9ebab01f18aa2f6f3c (diff)
parentd9a0fbfd7bc5d2c42f0fa9bcbdab62c4942d0388 (diff)
Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (48 commits) serial: 8250_pci: add support for Cronyx Omega PCI multiserial board. tty/serial: Fix break handling for PORT_TEGRA tty/serial: Add explicit PORT_TEGRA type n_tracerouter and n_tracesink ldisc additions. Intel PTI implementaiton of MIPI 1149.7. Kernel documentation for the PTI feature. export kernel call get_task_comm(). tty: Remove to support serial for S5P6442 pch_phub: Support new device ML7223 8250_pci: Add support for the Digi/IBM PCIe 2-port Adapter ASoC: Update cx20442 for TTY API change pch_uart: Support new device ML7223 IOH parport: Use request_muxed_region for IT87 probe and lock tty/serial: add support for Xilinx PS UART n_gsm: Use print_hex_dump_bytes drivers/tty/moxa.c: Put correct tty value TTY: tty_io, annotate locking functions TTY: serial_core, remove superfluous set_task_state TTY: serial_core, remove invalid test Char: moxa, fix locking in moxa_write ... Fix up trivial conflicts in drivers/bluetooth/hci_ldisc.c and drivers/tty/serial/Makefile. I did the hci_ldisc thing as an evil merge, cleaning things up.
Diffstat (limited to 'drivers/tty/n_gsm.c')
-rw-r--r--drivers/tty/n_gsm.c41
1 files changed, 14 insertions, 27 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 77623b936538..a4c42a75a3bf 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -526,19 +526,6 @@ static int gsm_stuff_frame(const u8 *input, u8 *output, int len)
526 return olen; 526 return olen;
527} 527}
528 528
529static void hex_packet(const unsigned char *p, int len)
530{
531 int i;
532 for (i = 0; i < len; i++) {
533 if (i && (i % 16) == 0) {
534 pr_cont("\n");
535 pr_debug("");
536 }
537 pr_cont("%02X ", *p++);
538 }
539 pr_cont("\n");
540}
541
542/** 529/**
543 * gsm_send - send a control frame 530 * gsm_send - send a control frame
544 * @gsm: our GSM mux 531 * @gsm: our GSM mux
@@ -685,10 +672,10 @@ static void gsm_data_kick(struct gsm_mux *gsm)
685 len = msg->len + 2; 672 len = msg->len + 2;
686 } 673 }
687 674
688 if (debug & 4) { 675 if (debug & 4)
689 pr_debug("gsm_data_kick:\n"); 676 print_hex_dump_bytes("gsm_data_kick: ",
690 hex_packet(gsm->txframe, len); 677 DUMP_PREFIX_OFFSET,
691 } 678 gsm->txframe, len);
692 679
693 if (gsm->output(gsm, gsm->txframe + skip_sof, 680 if (gsm->output(gsm, gsm->txframe + skip_sof,
694 len - skip_sof) < 0) 681 len - skip_sof) < 0)
@@ -2095,10 +2082,9 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len)
2095 set_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags); 2082 set_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags);
2096 return -ENOSPC; 2083 return -ENOSPC;
2097 } 2084 }
2098 if (debug & 4) { 2085 if (debug & 4)
2099 pr_debug("-->%d bytes out\n", len); 2086 print_hex_dump_bytes("gsmld_output: ", DUMP_PREFIX_OFFSET,
2100 hex_packet(data, len); 2087 data, len);
2101 }
2102 gsm->tty->ops->write(gsm->tty, data, len); 2088 gsm->tty->ops->write(gsm->tty, data, len);
2103 return len; 2089 return len;
2104} 2090}
@@ -2142,8 +2128,8 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
2142 gsm->tty = NULL; 2128 gsm->tty = NULL;
2143} 2129}
2144 2130
2145static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, 2131static unsigned int gsmld_receive_buf(struct tty_struct *tty,
2146 char *fp, int count) 2132 const unsigned char *cp, char *fp, int count)
2147{ 2133{
2148 struct gsm_mux *gsm = tty->disc_data; 2134 struct gsm_mux *gsm = tty->disc_data;
2149 const unsigned char *dp; 2135 const unsigned char *dp;
@@ -2152,10 +2138,9 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
2152 char buf[64]; 2138 char buf[64];
2153 char flags; 2139 char flags;
2154 2140
2155 if (debug & 4) { 2141 if (debug & 4)
2156 pr_debug("Inbytes %dd\n", count); 2142 print_hex_dump_bytes("gsmld_receive: ", DUMP_PREFIX_OFFSET,
2157 hex_packet(cp, count); 2143 cp, count);
2158 }
2159 2144
2160 for (i = count, dp = cp, f = fp; i; i--, dp++) { 2145 for (i = count, dp = cp, f = fp; i; i--, dp++) {
2161 flags = *f++; 2146 flags = *f++;
@@ -2177,6 +2162,8 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
2177 } 2162 }
2178 /* FASYNC if needed ? */ 2163 /* FASYNC if needed ? */
2179 /* If clogged call tty_throttle(tty); */ 2164 /* If clogged call tty_throttle(tty); */
2165
2166 return count;
2180} 2167}
2181 2168
2182/** 2169/**