diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-04-30 03:54:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:47 -0400 |
commit | f34d7a5b7010b82fe97da95496b9971435530062 (patch) | |
tree | 87e2abec1e33ed4fe5e63ee2fd000bc2ad745e57 /drivers/char/isicom.c | |
parent | 251b8dd7eee30fda089a1dc088abf4fc9a0dee9c (diff) |
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>
Diffstat (limited to 'drivers/char/isicom.c')
-rw-r--r-- | drivers/char/isicom.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 57b115272aaa..9c6be8da220c 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -1140,28 +1140,29 @@ static int isicom_write(struct tty_struct *tty, const unsigned char *buf, | |||
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | /* put_char et all */ | 1142 | /* put_char et all */ |
1143 | static void isicom_put_char(struct tty_struct *tty, unsigned char ch) | 1143 | static int isicom_put_char(struct tty_struct *tty, unsigned char ch) |
1144 | { | 1144 | { |
1145 | struct isi_port *port = tty->driver_data; | 1145 | struct isi_port *port = tty->driver_data; |
1146 | struct isi_board *card = port->card; | 1146 | struct isi_board *card = port->card; |
1147 | unsigned long flags; | 1147 | unsigned long flags; |
1148 | 1148 | ||
1149 | if (isicom_paranoia_check(port, tty->name, "isicom_put_char")) | 1149 | if (isicom_paranoia_check(port, tty->name, "isicom_put_char")) |
1150 | return; | 1150 | return 0; |
1151 | 1151 | ||
1152 | if (!port->xmit_buf) | 1152 | if (!port->xmit_buf) |
1153 | return; | 1153 | return 0; |
1154 | 1154 | ||
1155 | spin_lock_irqsave(&card->card_lock, flags); | 1155 | spin_lock_irqsave(&card->card_lock, flags); |
1156 | if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) | 1156 | if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) { |
1157 | goto out; | 1157 | spin_unlock_irqrestore(&card->card_lock, flags); |
1158 | return 0; | ||
1159 | } | ||
1158 | 1160 | ||
1159 | port->xmit_buf[port->xmit_head++] = ch; | 1161 | port->xmit_buf[port->xmit_head++] = ch; |
1160 | port->xmit_head &= (SERIAL_XMIT_SIZE - 1); | 1162 | port->xmit_head &= (SERIAL_XMIT_SIZE - 1); |
1161 | port->xmit_cnt++; | 1163 | port->xmit_cnt++; |
1162 | spin_unlock_irqrestore(&card->card_lock, flags); | 1164 | spin_unlock_irqrestore(&card->card_lock, flags); |
1163 | out: | 1165 | return 1; |
1164 | return; | ||
1165 | } | 1166 | } |
1166 | 1167 | ||
1167 | /* flush_chars et all */ | 1168 | /* flush_chars et all */ |