tty: The big operations rework
- Operations are now a shared const function block as with most other Linux objects - Introduce wrappers for some optional functions to get consistent behaviour - Wrap put_char which used to be patched by the tty layer - Document which functions are needed/optional - Make put_char report success/fail - Cache the driver->ops pointer in the tty as tty->ops - Remove various surplus lock calls we no longer need - Remove proc_write method as noted by Alexey Dobriyan - Introduce some missing sanity checks where certain driver/ldisc combinations would oops as they didn't check needed methods were present [akpm@linux-foundation.org: fix fs/compat_ioctl.c build] [akpm@linux-foundation.org: fix isicom] [akpm@linux-foundation.org: fix arch/ia64/hp/sim/simserial.c build] [akpm@linux-foundation.org: fix kgdb] Signed-off-by: Alan Cox <alan@redhat.com> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Cc: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -1140,28 +1140,29 @@ static int isicom_write(struct tty_struct *tty, const unsigned char *buf,
|
||||
}
|
||||
|
||||
/* put_char et all */
|
||||
static void isicom_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
static int isicom_put_char(struct tty_struct *tty, unsigned char ch)
|
||||
{
|
||||
struct isi_port *port = tty->driver_data;
|
||||
struct isi_board *card = port->card;
|
||||
unsigned long flags;
|
||||
|
||||
if (isicom_paranoia_check(port, tty->name, "isicom_put_char"))
|
||||
return;
|
||||
return 0;
|
||||
|
||||
if (!port->xmit_buf)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
spin_lock_irqsave(&card->card_lock, flags);
|
||||
if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1)
|
||||
goto out;
|
||||
if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) {
|
||||
spin_unlock_irqrestore(&card->card_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
port->xmit_buf[port->xmit_head++] = ch;
|
||||
port->xmit_head &= (SERIAL_XMIT_SIZE - 1);
|
||||
port->xmit_cnt++;
|
||||
spin_unlock_irqrestore(&card->card_lock, flags);
|
||||
out:
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* flush_chars et all */
|
||||
|
Reference in New Issue
Block a user