diff options
author | James Hogan <james.hogan@imgtec.com> | 2013-02-06 09:45:02 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-06 14:10:17 -0500 |
commit | a8cd98586b1f9e3b5dd7e141bcfe8f078fbb39ed (patch) | |
tree | e442817ff8461de7925e9d77e043eb3e8070c9cb /drivers/tty | |
parent | 8200e38a0cbf95dd2acaa565badb9b6a71c0e9c3 (diff) |
tty: metag_da: avoid getting tty kref in dashtty_timer()
Getting the tty kref in dashtty_timer() is no longer necessary since it
isn't needed in fetch_data() any longer (due to changes which make the
tty flip functions refer to tty_ports instead of tty_structs), so just
pass around a channel number instead.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/metag_da.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/tty/metag_da.c b/drivers/tty/metag_da.c index fc2a36bddd3f..0e888621f484 100644 --- a/drivers/tty/metag_da.c +++ b/drivers/tty/metag_da.c | |||
@@ -147,9 +147,8 @@ static int chancall(int in_bios_function, int in_channel, | |||
147 | /* | 147 | /* |
148 | * Attempts to fetch count bytes from channel and returns actual count. | 148 | * Attempts to fetch count bytes from channel and returns actual count. |
149 | */ | 149 | */ |
150 | static int fetch_data(struct tty_struct *tty) | 150 | static int fetch_data(unsigned int channel) |
151 | { | 151 | { |
152 | unsigned int channel = tty->index; | ||
153 | struct dashtty_port *dport = &dashtty_ports[channel]; | 152 | struct dashtty_port *dport = &dashtty_ports[channel]; |
154 | int received = 0; | 153 | int received = 0; |
155 | 154 | ||
@@ -180,31 +179,31 @@ unlock: | |||
180 | } | 179 | } |
181 | 180 | ||
182 | /** | 181 | /** |
183 | * find_channel_to_poll() - Returns kref to the next channel tty to poll. | 182 | * find_channel_to_poll() - Returns number of the next channel to poll. |
184 | * Returns: The TTY of the next channel to poll, or NULL if no TTY needs | 183 | * Returns: The number of the next channel to poll, or -1 if none need |
185 | * polling. Release with tty_kref_put(). | 184 | * polling. |
186 | */ | 185 | */ |
187 | static struct tty_struct *find_channel_to_poll(void) | 186 | static int find_channel_to_poll(void) |
188 | { | 187 | { |
189 | static int last_polled_channel; | 188 | static int last_polled_channel; |
190 | int last = last_polled_channel; | 189 | int last = last_polled_channel; |
191 | int chan; | 190 | int chan; |
192 | struct tty_struct *tty = NULL; | 191 | struct dashtty_port *dport; |
193 | 192 | ||
194 | for (chan = last + 1; ; ++chan) { | 193 | for (chan = last + 1; ; ++chan) { |
195 | if (chan >= NUM_TTY_CHANNELS) | 194 | if (chan >= NUM_TTY_CHANNELS) |
196 | chan = 0; | 195 | chan = 0; |
197 | 196 | ||
198 | tty = tty_port_tty_get(&dashtty_ports[chan].port); | 197 | dport = &dashtty_ports[chan]; |
199 | if (tty) { | 198 | if (dport->rx_buf) { |
200 | last_polled_channel = chan; | 199 | last_polled_channel = chan; |
201 | return tty; | 200 | return chan; |
202 | } | 201 | } |
203 | 202 | ||
204 | if (chan == last) | 203 | if (chan == last) |
205 | break; | 204 | break; |
206 | } | 205 | } |
207 | return tty; | 206 | return -1; |
208 | } | 207 | } |
209 | 208 | ||
210 | /** | 209 | /** |
@@ -302,19 +301,17 @@ static int put_data(void *arg) | |||
302 | */ | 301 | */ |
303 | static void dashtty_timer(unsigned long ignored) | 302 | static void dashtty_timer(unsigned long ignored) |
304 | { | 303 | { |
305 | struct tty_struct *tty; | 304 | int channel; |
306 | 305 | ||
307 | /* If there are no ports open do nothing and don't poll again. */ | 306 | /* If there are no ports open do nothing and don't poll again. */ |
308 | if (!atomic_read(&num_channels_need_poll)) | 307 | if (!atomic_read(&num_channels_need_poll)) |
309 | return; | 308 | return; |
310 | 309 | ||
311 | tty = find_channel_to_poll(); | 310 | channel = find_channel_to_poll(); |
312 | 311 | ||
313 | /* Did we find a channel to poll? */ | 312 | /* Did we find a channel to poll? */ |
314 | if (tty) { | 313 | if (channel >= 0) |
315 | fetch_data(tty); | 314 | fetch_data(channel); |
316 | tty_kref_put(tty); | ||
317 | } | ||
318 | 315 | ||
319 | mod_timer_pinned(&poll_timer, jiffies + DA_TTY_POLL); | 316 | mod_timer_pinned(&poll_timer, jiffies + DA_TTY_POLL); |
320 | } | 317 | } |