提交 76b25a55 编写于 作者: A Alan Cox 提交者: Linus Torvalds

char: switch gs, cyclades and esp to return int for put_char

Signed-off-by: NAlan Cox <alan@redhat.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 257afa3c
......@@ -2814,7 +2814,7 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count)
* done stuffing characters into the driver. If there is no room
* in the queue, the character is ignored.
*/
static void cy_put_char(struct tty_struct *tty, unsigned char ch)
static int cy_put_char(struct tty_struct *tty, unsigned char ch)
{
struct cyclades_port *info = tty->driver_data;
unsigned long flags;
......@@ -2824,15 +2824,15 @@ static void cy_put_char(struct tty_struct *tty, unsigned char ch)
#endif
if (serial_paranoia_check(info, tty->name, "cy_put_char"))
return;
return 0;
if (!info->xmit_buf)
return;
return 0;
spin_lock_irqsave(&info->card->card_lock, flags);
if (info->xmit_cnt >= (int)(SERIAL_XMIT_SIZE - 1)) {
spin_unlock_irqrestore(&info->card->card_lock, flags);
return;
return 0;
}
info->xmit_buf[info->xmit_head++] = ch;
......@@ -2841,6 +2841,7 @@ static void cy_put_char(struct tty_struct *tty, unsigned char ch)
info->idle_stats.xmit_bytes++;
info->idle_stats.xmit_idle = jiffies;
spin_unlock_irqrestore(&info->card->card_lock, flags);
return 1;
} /* cy_put_char */
/*
......
......@@ -1156,24 +1156,27 @@ static void change_speed(struct esp_struct *info)
spin_unlock_irqrestore(&info->lock, flags);
}
static void rs_put_char(struct tty_struct *tty, unsigned char ch)
static int rs_put_char(struct tty_struct *tty, unsigned char ch)
{
struct esp_struct *info = (struct esp_struct *)tty->driver_data;
unsigned long flags;
int ret = 0;
if (serial_paranoia_check(info, tty->name, "rs_put_char"))
return;
return 0;
if (!info->xmit_buf)
return;
return 0;
spin_lock_irqsave(&info->lock, flags);
if (info->xmit_cnt < ESP_XMIT_SIZE - 1) {
info->xmit_buf[info->xmit_head++] = ch;
info->xmit_head &= ESP_XMIT_SIZE-1;
info->xmit_cnt++;
ret = 1;
}
spin_unlock_irqrestore(&info->lock, flags);
return ret;
}
static void rs_flush_chars(struct tty_struct *tty)
......
......@@ -48,19 +48,19 @@ static int gs_debug;
module_param(gs_debug, int, 0644);
void gs_put_char(struct tty_struct * tty, unsigned char ch)
int gs_put_char(struct tty_struct * tty, unsigned char ch)
{
struct gs_port *port;
func_enter ();
if (!tty) return;
if (!tty) return 0;
port = tty->driver_data;
if (!port) return;
if (!port) return 0;
if (! (port->flags & ASYNC_INITIALIZED)) return;
if (! (port->flags & ASYNC_INITIALIZED)) return 0;
/* Take a lock on the serial tranmit buffer! */
mutex_lock(& port->port_write_mutex);
......@@ -68,7 +68,7 @@ void gs_put_char(struct tty_struct * tty, unsigned char ch)
if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) {
/* Sorry, buffer is full, drop character. Update statistics???? -- REW */
mutex_unlock(&port->port_write_mutex);
return;
return 0;
}
port->xmit_buf[port->xmit_head++] = ch;
......@@ -77,6 +77,7 @@ void gs_put_char(struct tty_struct * tty, unsigned char ch)
mutex_unlock(&port->port_write_mutex);
func_exit ();
return 1;
}
......
......@@ -78,7 +78,7 @@ struct gs_port {
#define GS_DEBUG_WRITE 0x00000040
#ifdef __KERNEL__
void gs_put_char(struct tty_struct *tty, unsigned char ch);
int gs_put_char(struct tty_struct *tty, unsigned char ch);
int gs_write(struct tty_struct *tty,
const unsigned char *buf, int count);
int gs_write_room(struct tty_struct *tty);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册