lkml.org 
[lkml]   [2012]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: your mail
On Sun, Feb 12, 2012 at 01:21:10AM +0100, Richard Weinberger wrote:

Not a full review by any means, but...

> +++ b/arch/um/drivers/line.c
> @@ -19,19 +19,29 @@ static irqreturn_t line_interrupt(int irq, void *data)
> {
> struct chan *chan = data;
> struct line *line = chan->line;
> + struct tty_struct *tty;
> +
> + if (line) {
> + tty = tty_port_tty_get(&line->port);
> + chan_interrupt(&line->chan_list, &line->task, tty, irq);
> + tty_kref_put(tty);
> + }
>
> - if (line)
> - chan_interrupt(&line->chan_list, &line->task, line->tty, irq);
> return IRQ_HANDLED;
> }

Is tty_kref_put() safe in interrupt? Here it seems to be OK, but in other
callers... More or less at random: drivers/tty/serial/lantiq.c has it
called from lqasc_rx_int(). It seems to be possible to have it end up
calling ->ops->shutdown() and in this case that'd be lqasc_shutdown().
Which does a bunch of free_irq(), including the ->rx_irq, i.e. the one
we have it called from. Alan?

> @@ -495,13 +413,6 @@ static int setup_one_line(struct line *lines, int n, char *init, int init_prio,
> struct line *line = &lines[n];
> int err = -EINVAL;
>
> - spin_lock(&line->count_lock);
> -
> - if (line->count) {
> - *error_out = "Device is already open";
> - goto out;
> - }

... and similar in line_open() - just what happens if you try to reconfigure
an opened one?

> @@ -612,13 +523,15 @@ int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
>
> line = &lines[dev];
>
> - spin_lock(&line->count_lock);
> + tty = tty_port_tty_get(&line->port);
> +
> if (!line->valid)
> CONFIG_CHUNK(str, size, n, "none", 1);
> - else if (line->tty == NULL)
> + else if (tty == NULL)
> CONFIG_CHUNK(str, size, n, line->init_str, 1);
> else n = chan_config_string(&line->chan_list, str, size, error_out);
> - spin_unlock(&line->count_lock);
> +
> + tty_kref_put(tty);

again, where's the exclusion with config changes?


\
 
 \ /
  Last update: 2012-02-12 02:05    [W:0.069 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site