diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-04-30 03:54:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:45 -0400 |
commit | 76b25a5509bbafdbfc7d7d6b41a3c64947d59360 (patch) | |
tree | 244786bdb849657dc9ab885c7ac2abb3eb4185d7 | |
parent | 257afa3cb6beaad60849655cb272d4b9de74cf63 (diff) |
char: switch gs, cyclades and esp to return int for put_char
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/char/cyclades.c | 9 | ||||
-rw-r--r-- | drivers/char/esp.c | 9 | ||||
-rw-r--r-- | drivers/char/generic_serial.c | 11 | ||||
-rw-r--r-- | include/linux/generic_serial.h | 2 |
4 files changed, 18 insertions, 13 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 571e4fab5bfa..b8fb251f80ee 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -2814,7 +2814,7 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count) | |||
2814 | * done stuffing characters into the driver. If there is no room | 2814 | * done stuffing characters into the driver. If there is no room |
2815 | * in the queue, the character is ignored. | 2815 | * in the queue, the character is ignored. |
2816 | */ | 2816 | */ |
2817 | static void cy_put_char(struct tty_struct *tty, unsigned char ch) | 2817 | static int cy_put_char(struct tty_struct *tty, unsigned char ch) |
2818 | { | 2818 | { |
2819 | struct cyclades_port *info = tty->driver_data; | 2819 | struct cyclades_port *info = tty->driver_data; |
2820 | unsigned long flags; | 2820 | unsigned long flags; |
@@ -2824,15 +2824,15 @@ static void cy_put_char(struct tty_struct *tty, unsigned char ch) | |||
2824 | #endif | 2824 | #endif |
2825 | 2825 | ||
2826 | if (serial_paranoia_check(info, tty->name, "cy_put_char")) | 2826 | if (serial_paranoia_check(info, tty->name, "cy_put_char")) |
2827 | return; | 2827 | return 0; |
2828 | 2828 | ||
2829 | if (!info->xmit_buf) | 2829 | if (!info->xmit_buf) |
2830 | return; | 2830 | return 0; |
2831 | 2831 | ||
2832 | spin_lock_irqsave(&info->card->card_lock, flags); | 2832 | spin_lock_irqsave(&info->card->card_lock, flags); |
2833 | if (info->xmit_cnt >= (int)(SERIAL_XMIT_SIZE - 1)) { | 2833 | if (info->xmit_cnt >= (int)(SERIAL_XMIT_SIZE - 1)) { |
2834 | spin_unlock_irqrestore(&info->card->card_lock, flags); | 2834 | spin_unlock_irqrestore(&info->card->card_lock, flags); |
2835 | return; | 2835 | return 0; |
2836 | } | 2836 | } |
2837 | 2837 | ||
2838 | info->xmit_buf[info->xmit_head++] = ch; | 2838 | info->xmit_buf[info->xmit_head++] = ch; |
@@ -2841,6 +2841,7 @@ static void cy_put_char(struct tty_struct *tty, unsigned char ch) | |||
2841 | info->idle_stats.xmit_bytes++; | 2841 | info->idle_stats.xmit_bytes++; |
2842 | info->idle_stats.xmit_idle = jiffies; | 2842 | info->idle_stats.xmit_idle = jiffies; |
2843 | spin_unlock_irqrestore(&info->card->card_lock, flags); | 2843 | spin_unlock_irqrestore(&info->card->card_lock, flags); |
2844 | return 1; | ||
2844 | } /* cy_put_char */ | 2845 | } /* cy_put_char */ |
2845 | 2846 | ||
2846 | /* | 2847 | /* |
diff --git a/drivers/char/esp.c b/drivers/char/esp.c index b1f92db31331..996d3230c929 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c | |||
@@ -1156,24 +1156,27 @@ static void change_speed(struct esp_struct *info) | |||
1156 | spin_unlock_irqrestore(&info->lock, flags); | 1156 | spin_unlock_irqrestore(&info->lock, flags); |
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | static void rs_put_char(struct tty_struct *tty, unsigned char ch) | 1159 | static int rs_put_char(struct tty_struct *tty, unsigned char ch) |
1160 | { | 1160 | { |
1161 | struct esp_struct *info = (struct esp_struct *)tty->driver_data; | 1161 | struct esp_struct *info = (struct esp_struct *)tty->driver_data; |
1162 | unsigned long flags; | 1162 | unsigned long flags; |
1163 | int ret = 0; | ||
1163 | 1164 | ||
1164 | if (serial_paranoia_check(info, tty->name, "rs_put_char")) | 1165 | if (serial_paranoia_check(info, tty->name, "rs_put_char")) |
1165 | return; | 1166 | return 0; |
1166 | 1167 | ||
1167 | if (!info->xmit_buf) | 1168 | if (!info->xmit_buf) |
1168 | return; | 1169 | return 0; |
1169 | 1170 | ||
1170 | spin_lock_irqsave(&info->lock, flags); | 1171 | spin_lock_irqsave(&info->lock, flags); |
1171 | if (info->xmit_cnt < ESP_XMIT_SIZE - 1) { | 1172 | if (info->xmit_cnt < ESP_XMIT_SIZE - 1) { |
1172 | info->xmit_buf[info->xmit_head++] = ch; | 1173 | info->xmit_buf[info->xmit_head++] = ch; |
1173 | info->xmit_head &= ESP_XMIT_SIZE-1; | 1174 | info->xmit_head &= ESP_XMIT_SIZE-1; |
1174 | info->xmit_cnt++; | 1175 | info->xmit_cnt++; |
1176 | ret = 1; | ||
1175 | } | 1177 | } |
1176 | spin_unlock_irqrestore(&info->lock, flags); | 1178 | spin_unlock_irqrestore(&info->lock, flags); |
1179 | return ret; | ||
1177 | } | 1180 | } |
1178 | 1181 | ||
1179 | static void rs_flush_chars(struct tty_struct *tty) | 1182 | static void rs_flush_chars(struct tty_struct *tty) |
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c index f6610f28d657..149518e22fa6 100644 --- a/drivers/char/generic_serial.c +++ b/drivers/char/generic_serial.c | |||
@@ -48,19 +48,19 @@ static int gs_debug; | |||
48 | module_param(gs_debug, int, 0644); | 48 | module_param(gs_debug, int, 0644); |
49 | 49 | ||
50 | 50 | ||
51 | void gs_put_char(struct tty_struct * tty, unsigned char ch) | 51 | int gs_put_char(struct tty_struct * tty, unsigned char ch) |
52 | { | 52 | { |
53 | struct gs_port *port; | 53 | struct gs_port *port; |
54 | 54 | ||
55 | func_enter (); | 55 | func_enter (); |
56 | 56 | ||
57 | if (!tty) return; | 57 | if (!tty) return 0; |
58 | 58 | ||
59 | port = tty->driver_data; | 59 | port = tty->driver_data; |
60 | 60 | ||
61 | if (!port) return; | 61 | if (!port) return 0; |
62 | 62 | ||
63 | if (! (port->flags & ASYNC_INITIALIZED)) return; | 63 | if (! (port->flags & ASYNC_INITIALIZED)) return 0; |
64 | 64 | ||
65 | /* Take a lock on the serial tranmit buffer! */ | 65 | /* Take a lock on the serial tranmit buffer! */ |
66 | mutex_lock(& port->port_write_mutex); | 66 | mutex_lock(& port->port_write_mutex); |
@@ -68,7 +68,7 @@ void gs_put_char(struct tty_struct * tty, unsigned char ch) | |||
68 | if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) { | 68 | if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) { |
69 | /* Sorry, buffer is full, drop character. Update statistics???? -- REW */ | 69 | /* Sorry, buffer is full, drop character. Update statistics???? -- REW */ |
70 | mutex_unlock(&port->port_write_mutex); | 70 | mutex_unlock(&port->port_write_mutex); |
71 | return; | 71 | return 0; |
72 | } | 72 | } |
73 | 73 | ||
74 | port->xmit_buf[port->xmit_head++] = ch; | 74 | port->xmit_buf[port->xmit_head++] = ch; |
@@ -77,6 +77,7 @@ void gs_put_char(struct tty_struct * tty, unsigned char ch) | |||
77 | 77 | ||
78 | mutex_unlock(&port->port_write_mutex); | 78 | mutex_unlock(&port->port_write_mutex); |
79 | func_exit (); | 79 | func_exit (); |
80 | return 1; | ||
80 | } | 81 | } |
81 | 82 | ||
82 | 83 | ||
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h index 5412da28fa47..110833666e37 100644 --- a/include/linux/generic_serial.h +++ b/include/linux/generic_serial.h | |||
@@ -78,7 +78,7 @@ struct gs_port { | |||
78 | #define GS_DEBUG_WRITE 0x00000040 | 78 | #define GS_DEBUG_WRITE 0x00000040 |
79 | 79 | ||
80 | #ifdef __KERNEL__ | 80 | #ifdef __KERNEL__ |
81 | void gs_put_char(struct tty_struct *tty, unsigned char ch); | 81 | int gs_put_char(struct tty_struct *tty, unsigned char ch); |
82 | int gs_write(struct tty_struct *tty, | 82 | int gs_write(struct tty_struct *tty, |
83 | const unsigned char *buf, int count); | 83 | const unsigned char *buf, int count); |
84 | int gs_write_room(struct tty_struct *tty); | 84 | int gs_write_room(struct tty_struct *tty); |