diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-04-02 07:54:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-09 14:30:39 -0400 |
commit | 19ef1b7151dc58c4d90a76d364dc93721bb04e9b (patch) | |
tree | 510b743245840dc666e092d7f2f3e1dc6dc711b2 /drivers/tty/ipwireless | |
parent | 7393af808fe1564ad34289b507b950445dfc06ac (diff) |
TTY: ipwireless, use tty from tty_port
It does not make the driver less racy though. Close and hangup should
be rewritten and tty refcounting used properly.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/ipwireless')
-rw-r--r-- | drivers/tty/ipwireless/tty.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index 0b4964d1eea5..f8b5fa0093a3 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c | |||
@@ -51,7 +51,6 @@ struct ipw_tty { | |||
51 | unsigned int secondary_channel_idx; | 51 | unsigned int secondary_channel_idx; |
52 | int tty_type; | 52 | int tty_type; |
53 | struct ipw_network *network; | 53 | struct ipw_network *network; |
54 | struct tty_struct *linux_tty; | ||
55 | unsigned int control_lines; | 54 | unsigned int control_lines; |
56 | struct mutex ipw_tty_mutex; | 55 | struct mutex ipw_tty_mutex; |
57 | int tx_bytes_queued; | 56 | int tx_bytes_queued; |
@@ -105,7 +104,7 @@ static int ipw_open(struct tty_struct *linux_tty, struct file *filp) | |||
105 | 104 | ||
106 | tty->port.count++; | 105 | tty->port.count++; |
107 | 106 | ||
108 | tty->linux_tty = linux_tty; | 107 | tty->port.tty = linux_tty; |
109 | linux_tty->driver_data = tty; | 108 | linux_tty->driver_data = tty; |
110 | linux_tty->low_latency = 1; | 109 | linux_tty->low_latency = 1; |
111 | 110 | ||
@@ -122,10 +121,10 @@ static void do_ipw_close(struct ipw_tty *tty) | |||
122 | tty->port.count--; | 121 | tty->port.count--; |
123 | 122 | ||
124 | if (tty->port.count == 0) { | 123 | if (tty->port.count == 0) { |
125 | struct tty_struct *linux_tty = tty->linux_tty; | 124 | struct tty_struct *linux_tty = tty->port.tty; |
126 | 125 | ||
127 | if (linux_tty != NULL) { | 126 | if (linux_tty != NULL) { |
128 | tty->linux_tty = NULL; | 127 | tty->port.tty = NULL; |
129 | linux_tty->driver_data = NULL; | 128 | linux_tty->driver_data = NULL; |
130 | 129 | ||
131 | if (tty->tty_type == TTYTYPE_MODEM) | 130 | if (tty->tty_type == TTYTYPE_MODEM) |
@@ -165,7 +164,7 @@ void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data, | |||
165 | int work = 0; | 164 | int work = 0; |
166 | 165 | ||
167 | mutex_lock(&tty->ipw_tty_mutex); | 166 | mutex_lock(&tty->ipw_tty_mutex); |
168 | linux_tty = tty->linux_tty; | 167 | linux_tty = tty->port.tty; |
169 | if (linux_tty == NULL) { | 168 | if (linux_tty == NULL) { |
170 | mutex_unlock(&tty->ipw_tty_mutex); | 169 | mutex_unlock(&tty->ipw_tty_mutex); |
171 | return; | 170 | return; |
@@ -553,9 +552,9 @@ void ipwireless_tty_free(struct ipw_tty *tty) | |||
553 | ": deregistering %s device ttyIPWp%d\n", | 552 | ": deregistering %s device ttyIPWp%d\n", |
554 | tty_type_name(ttyj->tty_type), j); | 553 | tty_type_name(ttyj->tty_type), j); |
555 | ttyj->closing = 1; | 554 | ttyj->closing = 1; |
556 | if (ttyj->linux_tty != NULL) { | 555 | if (ttyj->port.tty != NULL) { |
557 | mutex_unlock(&ttyj->ipw_tty_mutex); | 556 | mutex_unlock(&ttyj->ipw_tty_mutex); |
558 | tty_vhangup(ttyj->linux_tty); | 557 | tty_vhangup(ttyj->port.tty); |
559 | /* FIXME: Exactly how is the tty object locked here | 558 | /* FIXME: Exactly how is the tty object locked here |
560 | against a parallel ioctl etc */ | 559 | against a parallel ioctl etc */ |
561 | /* FIXME2: hangup does not mean all processes | 560 | /* FIXME2: hangup does not mean all processes |
@@ -651,8 +650,8 @@ ipwireless_tty_notify_control_line_change(struct ipw_tty *tty, | |||
651 | */ | 650 | */ |
652 | if ((old_control_lines & IPW_CONTROL_LINE_DCD) | 651 | if ((old_control_lines & IPW_CONTROL_LINE_DCD) |
653 | && !(tty->control_lines & IPW_CONTROL_LINE_DCD) | 652 | && !(tty->control_lines & IPW_CONTROL_LINE_DCD) |
654 | && tty->linux_tty) { | 653 | && tty->port.tty) { |
655 | tty_hangup(tty->linux_tty); | 654 | tty_hangup(tty->port.tty); |
656 | } | 655 | } |
657 | } | 656 | } |
658 | 657 | ||