Re: [PATCH] interrupt driven hvc_console as vio device

From: Andrew Morton
Date: Tue Aug 24 2004 - 23:56:40 EST


Ryan Arnold <rsa@xxxxxxxxxx> wrote:
>
> static int hvc_write_room(struct tty_struct *tty)
> {
> struct hvc_struct *hp = tty->driver_data;
> + unsigned long flags;
> + int retval;
>
> - return N_OUTBUF - hp->n_outbuf;
> + spin_lock_irqsave(&hp->lock, flags);
> + retval = N_OUTBUF - hp->n_outbuf;
> + spin_unlock_irqrestore(&hp->lock, flags);
> + return retval;
> }
>
> static int hvc_chars_in_buffer(struct tty_struct *tty)
> {
> struct hvc_struct *hp = tty->driver_data;
> + unsigned long flags;
> + int retval;
>
> - return hp->n_outbuf;
> + spin_lock_irqsave(&hp->lock, flags);
> + retval = hp->n_outbuf;
> + spin_unlock_irqrestore(&hp->lock, flags);
> + return retval;
> }

The new locking in these functions doesn't really do anything, apart from
adding memory barriers. If that's what you really want, I suggest you
simply add (commented) memory barriers.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/