Skip to contentSkip to conversation

s390 (8/10): console device drivers.

PATCH New Martin Schwidefsky 1 participant 1 message May 26, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390 (8/10): console device drivers.

s390 console driver fixes:
- Register console ttys via module_init. Remove sclp_tty_init and tty3215_init from tty_io.c
- con3215: use set_current_state.
- sclp: Fix race condition in sclp interrupt handler. Fix deadlock on sclp_conbuf_lock for certain error conditions.

diffstat:

 drivers/char/tty_io.c        |    5 ---
 drivers/s390/char/con3215.c  |    4 +--
 drivers/s390/char/sclp.c     |   42 +++++++++++++++++++++------------
 drivers/s390/char/sclp_con.c |   54 ++++++++++++++++++++++++-------------------
 drivers/s390/char/sclp_tty.c |   25 +++++++++++--------
 drivers/s390/char/sclp_tty.h |    4 +++
 6 files changed, 79 insertions(+), 55 deletions(-)
drivers/char/tty_io.c +0 -5
diff -urN linux-2.5/drivers/char/tty_io.c linux-2.5-s390/drivers/char/tty_io.c
@@ -145,8 +145,6 @@
 extern int vme_scc_init (void);
 extern int serial167_init(void);
 extern int rs_8xx_init(void);
-extern void sclp_tty_init(void);
-extern void tty3215_init(void);
 extern void tub3270_init(void);
 extern void rs_360_init(void);
 extern void tx3912_rs_init(void);
@@ -2480,9 +2478,6 @@
 #ifdef CONFIG_TN3270
 	tub3270_init();
 #endif
-#ifdef CONFIG_SCLP_TTY
-	sclp_tty_init();
-#endif
 #ifdef CONFIG_A2232
 	a2232board_init();
 #endif
drivers/s390/char/con3215.c +2 -2
diff -urN linux-2.5/drivers/s390/char/con3215.c linux-2.5-s390/drivers/s390/char/con3215.c
@@ -697,12 +697,12 @@
 	    raw->queued_read != NULL) {
 		raw->flags |= RAW3215_CLOSING;
 		add_wait_queue(&raw->empty_wait, &wait);
-		current->state = TASK_INTERRUPTIBLE;
+		set_current_state(TASK_INTERRUPTIBLE);
 		spin_unlock_irqrestore(raw->lock, flags);
 		schedule();
 		spin_lock_irqsave(raw->lock, flags);
 		remove_wait_queue(&raw->empty_wait, &wait);
-		current->state = TASK_RUNNING;
+		set_current_state(TASK_RUNNING);
 		raw->flags &= ~(RAW3215_ACTIVE | RAW3215_CLOSING);
 	}
 	spin_unlock_irqrestore(raw->lock, flags);
drivers/s390/char/sclp.c +27 -15

112 lines not on this page · raw message

drivers/s390/char/sclp_con.c +31 -23

113 lines not on this page · raw message

drivers/s390/char/sclp_tty.c +15 -10
diff -urN linux-2.5/drivers/s390/char/sclp_tty.c linux-2.5-s390/drivers/s390/char/sclp_tty.c
@@ -16,6 +16,8 @@
 #include <linux/sched.h>
 #include <linux/wait.h>
 #include <linux/slab.h>
+#include <linux/err.h>
+#include <linux/init.h>
 #include <asm/uaccess.h>
 
 #include "ctrlchar.h"
@@ -55,7 +57,7 @@
 static unsigned char sclp_tty_chars[SCLP_TTY_BUF_SIZE];
 static unsigned short int sclp_tty_chars_count;
 
-static struct tty_driver sclp_tty_driver;
+struct tty_driver sclp_tty_driver;
 static struct tty_struct * sclp_tty_table[1];
 static struct termios * sclp_tty_termios[1];
 static struct termios * sclp_tty_termios_locked[1];
@@ -710,7 +712,7 @@
 	.receiver_fn = sclp_tty_receiver
 };
 
-void
+int __init
 sclp_tty_init(void)
 {
 	void *page;
@@ -718,20 +720,20 @@
 	int rc;
 
 	if (!CONSOLE_IS_SCLP)
-		return;
+		return 0;
 	rc = sclp_rw_init();
-	if (rc != 0) {
+	if (rc) {
 		printk(KERN_ERR SCLP_TTY_PRINT_HEADER
 		       "could not register tty - "
 		       "sclp_rw_init returned %d\n", rc);
-		return;
+		return rc;
 	}
 	/* Allocate pages for output buffering */
 	INIT_LIST_HEAD(&sclp_tty_pages);
 	for (i = 0; i < MAX_KMEM_PAGES; i++) {
 		page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
 		if (page == NULL)
-			return;
+			return -ENOMEM;
 		list_add_tail((struct list_head *) page, &sclp_tty_pages);
 	}
 	INIT_LIST_HEAD(&sclp_tty_outqueue);
@@ -753,8 +755,9 @@
 	sclp_tty_chars_count = 0;
 	sclp_tty = NULL;
 
-	if (sclp_register(&sclp_input_event) != 0)
-		return;
+	rc = sclp_register(&sclp_input_event);
+	if (rc)
+		return rc;
 
 	memset (&sclp_tty_driver, 0, sizeof(struct tty_driver));
 	sclp_tty_driver.magic = TTY_DRIVER_MAGIC;
@@ -810,8 +813,10 @@
 	sclp_tty_driver.write_proc = NULL;
 
 	rc = tty_register_driver(&sclp_tty_driver);
-	if (rc != 0)
+	if (rc)
 		printk(KERN_ERR SCLP_TTY_PRINT_HEADER
 		       "could not register tty - "
-		       "sclp_drv_register returned %d\n", rc);
+		       "tty_register_driver returned %d\n", rc);
+	return rc;
 }
+module_init(sclp_tty_init);
drivers/s390/char/sclp_tty.h +4 -0
diff -urN linux-2.5/drivers/s390/char/sclp_tty.h linux-2.5-s390/drivers/s390/char/sclp_tty.h
@@ -12,6 +12,8 @@
 #define __SCLP_TTY_H__
 
 #include <linux/ioctl.h>
+#include <linux/termios.h>
+#include <linux/tty_driver.h>
 
 /* This is the type of data structures storing sclp ioctl setting. */
 struct sclp_ioctls {
@@ -64,4 +66,6 @@
 /* get the number of buffers/pages got from kernel at startup */
 #define TIOCSCLPGKBUF	_IOR(SCLP_IOCTL_LETTER, 20, unsigned short)
 
+extern struct tty_driver sclp_tty_driver;
+
 #endif	/* __SCLP_TTY_H__ */