mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
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>
This commit is contained in:
parent
8200e38a0c
commit
a8cd98586b
1 changed files with 14 additions and 17 deletions
|
@ -147,9 +147,8 @@ static int chancall(int in_bios_function, int in_channel,
|
||||||
/*
|
/*
|
||||||
* Attempts to fetch count bytes from channel and returns actual count.
|
* Attempts to fetch count bytes from channel and returns actual count.
|
||||||
*/
|
*/
|
||||||
static int fetch_data(struct tty_struct *tty)
|
static int fetch_data(unsigned int channel)
|
||||||
{
|
{
|
||||||
unsigned int channel = tty->index;
|
|
||||||
struct dashtty_port *dport = &dashtty_ports[channel];
|
struct dashtty_port *dport = &dashtty_ports[channel];
|
||||||
int received = 0;
|
int received = 0;
|
||||||
|
|
||||||
|
@ -180,31 +179,31 @@ unlock:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find_channel_to_poll() - Returns kref to the next channel tty to poll.
|
* find_channel_to_poll() - Returns number of the next channel to poll.
|
||||||
* Returns: The TTY of the next channel to poll, or NULL if no TTY needs
|
* Returns: The number of the next channel to poll, or -1 if none need
|
||||||
* polling. Release with tty_kref_put().
|
* polling.
|
||||||
*/
|
*/
|
||||||
static struct tty_struct *find_channel_to_poll(void)
|
static int find_channel_to_poll(void)
|
||||||
{
|
{
|
||||||
static int last_polled_channel;
|
static int last_polled_channel;
|
||||||
int last = last_polled_channel;
|
int last = last_polled_channel;
|
||||||
int chan;
|
int chan;
|
||||||
struct tty_struct *tty = NULL;
|
struct dashtty_port *dport;
|
||||||
|
|
||||||
for (chan = last + 1; ; ++chan) {
|
for (chan = last + 1; ; ++chan) {
|
||||||
if (chan >= NUM_TTY_CHANNELS)
|
if (chan >= NUM_TTY_CHANNELS)
|
||||||
chan = 0;
|
chan = 0;
|
||||||
|
|
||||||
tty = tty_port_tty_get(&dashtty_ports[chan].port);
|
dport = &dashtty_ports[chan];
|
||||||
if (tty) {
|
if (dport->rx_buf) {
|
||||||
last_polled_channel = chan;
|
last_polled_channel = chan;
|
||||||
return tty;
|
return chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan == last)
|
if (chan == last)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return tty;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -302,19 +301,17 @@ static int put_data(void *arg)
|
||||||
*/
|
*/
|
||||||
static void dashtty_timer(unsigned long ignored)
|
static void dashtty_timer(unsigned long ignored)
|
||||||
{
|
{
|
||||||
struct tty_struct *tty;
|
int channel;
|
||||||
|
|
||||||
/* If there are no ports open do nothing and don't poll again. */
|
/* If there are no ports open do nothing and don't poll again. */
|
||||||
if (!atomic_read(&num_channels_need_poll))
|
if (!atomic_read(&num_channels_need_poll))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tty = find_channel_to_poll();
|
channel = find_channel_to_poll();
|
||||||
|
|
||||||
/* Did we find a channel to poll? */
|
/* Did we find a channel to poll? */
|
||||||
if (tty) {
|
if (channel >= 0)
|
||||||
fetch_data(tty);
|
fetch_data(channel);
|
||||||
tty_kref_put(tty);
|
|
||||||
}
|
|
||||||
|
|
||||||
mod_timer_pinned(&poll_timer, jiffies + DA_TTY_POLL);
|
mod_timer_pinned(&poll_timer, jiffies + DA_TTY_POLL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue