2.5.40 s390 (27/27): control characters.
PATCH 1/1 2.5.40 s390 (27/27): control characters.
Replace IMMEDIATE_BH bottom half by tasklets in helper functions for console control characters. Fix a race condition and make it look nicer.
drivers/s390/char/con3215.c +13 -9
@@ -455,7 +455,7 @@if ((raw = req->info) ==NULL )return ;/* That shouldn't happen ... */ if (req->type ==RAW3215_READ && raw->tty !=NULL ) { -char *cchar; +unsigned int cchar; tty = raw->tty; count =160 - req->residual;
@@ -467,14 +467,19 @@if (count >=TTY_FLIPBUF_SIZE - tty->flip.count) count =TTY_FLIPBUF_SIZE - tty->flip.count -1 ;EBCASC (raw->inbuf, count); -if ((cchar =ctrlchar_handle (raw->inbuf, count, tty))) { -if (cchar == (char *)-1 ) - goto in_out; + cchar =ctrlchar_handle (raw->inbuf, count, tty); +switch (cchar &CTRLCHAR_MASK ) { +case CTRLCHAR_SYSRQ : +break ; + +case CTRLCHAR_CTRL : tty->flip.count++; *tty->flip.flag_buf_ptr++ =TTY_NORMAL ; - *tty->flip.char_buf_ptr++ = *cchar; + *tty->flip.char_buf_ptr++ = cchar;tty_flip_buffer_push (raw->tty); - }else { +break ; + +case CTRLCHAR_NONE :memcpy (tty->flip.char_buf_ptr, raw->inbuf, count); if (count < 2 ||
@@ -491,12 +496,13 @@ tty->flip.flag_buf_ptr += count; tty->flip.count += count;tty_flip_buffer_push (raw->tty); +break ; } }else if (req->type ==RAW3215_WRITE ) { raw->count -= req->len; raw->written -= req->len; } -in_out: + raw->flags &= ~RAW3215_WORKING ;raw3215_free_req (req);/* check for empty wait */
@@ -1095,8 +1101,6 @@ raw3215_freelist = req; } -ctrlchar_init (); -#ifdef CONFIG_TN3215_CONSOLE raw3215[0 ] = raw = (raw3215_info *)alloc_bootmem_low (sizeof (raw3215_info));
drivers/s390/char/ctrlchar.c +40 -59
128 lines not on this page · raw message
drivers/s390/char/ctrlchar.h +9 -4
@@ -7,9 +7,14 @@* */ -#include <linux/config.h> -#include <linux/types.h> #include <linux/tty.h> -extern void ctrlchar_init (void ); -extern char *ctrlchar_handle (const char *buf,int len,struct tty_struct *tty); +extern unsigned int +ctrlchar_handle (const char *buf,int len,struct tty_struct *tty); + + +#define CTRLCHAR_NONE (1 << 8) +#define CTRLCHAR_CTRL (2 << 8) +#define CTRLCHAR_SYSRQ (3 << 8) + +#define CTRLCHAR_MASK (~0xffu)
drivers/s390/char/hwc_tty.c +11 -8
@@ -188,15 +188,19 @@struct tty_struct *tty = hwc_tty_data.tty;if (tty !=NULL ) { -char *cchar; -if ((cchar =ctrlchar_handle (buf, count, tty))) { -if (cchar == (char *)-1 ) -return ; +unsigned int cchar =ctrlchar_handle (buf, count, tty); + +switch (cchar &CTRLCHAR_MASK ) { +case CTRLCHAR_SYSRQ : +return ; + +case CTRLCHAR_CTRL : tty->flip.count++; *tty->flip.flag_buf_ptr++ =TTY_NORMAL ; - *tty->flip.char_buf_ptr++ = *cchar; - }else { + *tty->flip.char_buf_ptr++ = cchar; +break ; +case CTRLCHAR_NONE :memcpy (tty->flip.char_buf_ptr, buf, count); if (count < 2 || ( strncmp (buf + count - 2, "^n", 2) ||
@@ -209,6 +213,7 @@ tty->flip.char_buf_ptr += count; tty->flip.flag_buf_ptr += count; tty->flip.count += count; +break ; }tty_flip_buffer_push (tty);hwc_tty_wake_up ();
@@ -221,8 +226,6 @@if (!CONSOLE_IS_HWC )return ; -ctrlchar_init (); -memset (&hwc_tty_driver,0 ,sizeof (struct tty_driver ));memset (&hwc_tty_data,0 ,sizeof (hwc_tty_data_struct)); hwc_tty_driver.magic =TTY_DRIVER_MAGIC ;