aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/ircomm/ircomm_tty_ioctl.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-06-04 07:35:21 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-12 18:50:24 -0400
commit62f228acb807c370c3b1583bf0f1aa4ab8e19aca (patch)
tree770750aa0c324f286582d6317aa2d41d5e2cc122 /net/irda/ircomm/ircomm_tty_ioctl.c
parente673927d8a210ab1db27047080fc1bdb47f7e372 (diff)
TTY: ircomm, use tty from tty_port
This also includes a switch to tty refcounting. It makes sure, the code no longer can access a freed TTY struct. Sometimes the only thing needed is to pass tty down to the callies. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Samuel Ortiz <samuel@sortiz.org> Cc: netdev@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/irda/ircomm/ircomm_tty_ioctl.c')
-rw-r--r--net/irda/ircomm/ircomm_tty_ioctl.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c
index 31b917e9c8d..0eab6500e99 100644
--- a/net/irda/ircomm/ircomm_tty_ioctl.c
+++ b/net/irda/ircomm/ircomm_tty_ioctl.c
@@ -52,17 +52,18 @@
52 * Change speed of the driver. If the remote device is a DCE, then this 52 * Change speed of the driver. If the remote device is a DCE, then this
53 * should make it change the speed of its serial port 53 * should make it change the speed of its serial port
54 */ 54 */
55static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) 55static void ircomm_tty_change_speed(struct ircomm_tty_cb *self,
56 struct tty_struct *tty)
56{ 57{
57 unsigned int cflag, cval; 58 unsigned int cflag, cval;
58 int baud; 59 int baud;
59 60
60 IRDA_DEBUG(2, "%s()\n", __func__ ); 61 IRDA_DEBUG(2, "%s()\n", __func__ );
61 62
62 if (!self->tty || !self->tty->termios || !self->ircomm) 63 if (!self->ircomm)
63 return; 64 return;
64 65
65 cflag = self->tty->termios->c_cflag; 66 cflag = tty->termios->c_cflag;
66 67
67 /* byte size and parity */ 68 /* byte size and parity */
68 switch (cflag & CSIZE) { 69 switch (cflag & CSIZE) {
@@ -81,7 +82,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self)
81 cval |= IRCOMM_PARITY_EVEN; 82 cval |= IRCOMM_PARITY_EVEN;
82 83
83 /* Determine divisor based on baud rate */ 84 /* Determine divisor based on baud rate */
84 baud = tty_get_baud_rate(self->tty); 85 baud = tty_get_baud_rate(tty);
85 if (!baud) 86 if (!baud)
86 baud = 9600; /* B0 transition handled in rs_set_termios */ 87 baud = 9600; /* B0 transition handled in rs_set_termios */
87 88
@@ -159,7 +160,7 @@ void ircomm_tty_set_termios(struct tty_struct *tty,
159 return; 160 return;
160 } 161 }
161 162
162 ircomm_tty_change_speed(self); 163 ircomm_tty_change_speed(self, tty);
163 164
164 /* Handle transition to B0 status */ 165 /* Handle transition to B0 status */
165 if ((old_termios->c_cflag & CBAUD) && 166 if ((old_termios->c_cflag & CBAUD) &&