linux-mips-fnet
[Top] [All Lists]

update for dz.[ch] for 2.3 kernel

To: linux-mips@fnet.fr
Subject: update for dz.[ch] for 2.3 kernel
From: Dave Airlie <airlied@csn.ul.ie>
Date: Fri, 17 Sep 1999 18:06:11 +0100 (IST)
Hi,
        Please find attached a diff for dz.c and dz.h to update them for
2.3 in the CVS tree, these patches are against the CVS tree and also
include my update patch that I sent out earlier this week for 2.2,

Dave.

------------ David Airlie, David.Airlie@ul.ie,airlied@skynet --------
Telecommunications Research Centre, ECE Dept, University of Limerick \
http://www.csn.ul.ie/~airlied   -- Telecommunications Researcher      \
--- TEL: +353-61-202695 -----------------------------------------------
--- drivers/char/dz.h.cvs       Fri Sep 17 18:02:55 1999
+++ drivers/char/dz.h   Fri Sep 17 18:03:09 1999
@@ -158,8 +158,8 @@
   struct tq_struct        tqueue_hangup;
   struct termios          normal_termios;
   struct termios          callout_termios;
-  struct wait_queue       *open_wait;
-  struct wait_queue       *close_wait;
+  wait_queue_head_t       open_wait;
+  wait_queue_head_t       close_wait;
 
   long                    session;             /* Session of opening process */
   long                    pgrp;                /* pgrp of opening process */
@@ -188,7 +188,7 @@
  * memory if large numbers of serial ports are open.
  */
 static unsigned char *tmp_buf;
-static struct semaphore tmp_buf_sem = MUTEX;
+static DECLARE_MUTEX(tmp_buf_sem);
 
 static char *dz_name = "DECstation DZ serial driver version ";
 static char *dz_version = "1.02";
--- drivers/char/dz.c.cvs       Fri Sep 17 18:02:53 1999
+++ drivers/char/dz.c   Fri Sep 17 18:03:07 1999
@@ -14,6 +14,9 @@
  *    after patches by harald to irq code.  
  * [09-JAN-99] triemer minor fix for schedule - due to removal of timeout
  *            field from "current" - somewhere between 2.1.121 and 2.1.131
+ * 
+ * Parts (C) 1999 David Airlie, airlied@linux.ie
+ * [07-SEP-99] Bugfixes
  */
 
 #ifdef MODULE
@@ -74,7 +77,7 @@
 
 DECLARE_TASK_QUEUE(tq_serial);
 
-extern struct wait_queue *keypress_wait;
+extern wait_queue_head_t keypress_wait;
 static struct dz_serial *lines[4];
 static unsigned char tmp_buffer[256];
 
@@ -131,10 +134,14 @@
 
 static void dz_stop (struct tty_struct *tty)
 {
-  struct dz_serial *info = (struct dz_serial *)tty->driver_data;
+  struct dz_serial *info;
   unsigned short mask, tmp;
 
-         
+  if (tty==0)
+    return;
+
+  info = (struct dz_serial *)tty->driver_data;
+
   mask = 1 << info->line;
   tmp = dz_in (info, DZ_TCR);       /* read the TX flag */
 
@@ -1040,7 +1047,7 @@
   }
 
   if (--info->count < 0) {
-    printk("rs_close: bad serial port count for ttys%d: %d\n",
+    printk("dz_close: bad serial port count for ttys%d: %d\n",
           info->line, info->count);
     info->count = 0;
   }
@@ -1127,7 +1134,7 @@
  */
 static int block_til_ready (struct tty_struct *tty, struct file *filp, struct 
dz_serial *info)
 {
-  struct wait_queue wait = { current, NULL };
+  DECLARE_WAITQUEUE(wait, current);
   int retval;
   int do_clocal = 0;
 
@@ -1339,9 +1346,9 @@
     panic("Couldn't register callout driver\n");
   save_flags(flags); cli();
  
-  i = 0;
-  for (info = &multi[i]; i < DZ_NB_PORT;  i++) 
+  for (i=0; i < DZ_NB_PORT;  i++) 
     {
+      info = &multi[i];
       lines[i] = info;
     info->magic = SERIAL_MAGIC;
 
@@ -1364,8 +1371,8 @@
     info->tqueue_hangup.data = info;
     info->callout_termios = callout_driver.init_termios;
     info->normal_termios = serial_driver.init_termios;
-    info->open_wait = 0;
-    info->close_wait = 0;
+    init_waitqueue_head(&info->open_wait);
+    init_waitqueue_head(&info->close_wait);
 
     /* If we are pointing to address zero then punt - not correctly
        set up in setup.c to handle this. */
@@ -1400,7 +1407,7 @@
 #ifdef CONFIG_SERIAL_CONSOLE
 static void dz_console_put_char (unsigned char ch)
 {
-  long flags;
+  unsigned long flags;
   int  loops = 2500;
   unsigned short tmp = ch;
   /* this code sends stuff out to serial device - spinning its
@@ -1414,7 +1421,7 @@
   
 
   /* spin our wheels */
-  while (((dz_in(dz_console,DZ_TCR) & DZ_TRDY) != DZ_TRDY) &&  loops--)
+  while (((dz_in(dz_console,DZ_CSR) & DZ_TRDY) != DZ_TRDY) &&  loops--)
     ;
   
   /* Actually transmit the character. */
@@ -1433,9 +1440,11 @@
                              const char *str, 
                              unsigned int count)
 {
+/*
 #ifdef DEBUG_DZ
   prom_printf((char *)str);
 #endif
+*/
   while (count--) 
     {
     if (*str == '\n')
@@ -1510,37 +1519,6 @@
                break;
        }
        co->cflag = cflag;
-
-       /* TOFIX: force to console line */
-       dz_console = &multi[CONSOLE_LINE];
-       if ((mips_machtype == MACH_DS23100) || (mips_machtype == MACH_DS5100)) 
-       dz_console->port = KN01_DZ11_BASE;
-               else 
-                       dz_console->port = KN02_DZ11_BASE; 
-       dz_console->line = CONSOLE_LINE;
-
-       dz_out(dz_console, DZ_CSR, DZ_CLR);
-       while ((tmp = dz_in(dz_console,DZ_CSR)) & DZ_CLR)
-         ;
-
-       /* enable scanning */
-       dz_out(dz_console, DZ_CSR, DZ_MSE); 
-
-        /*  Set up flags... */
-       dz_console->cflags = 0;
-       dz_console->cflags |= DZ_B9600;
-       dz_console->cflags |= DZ_CS8;
-       dz_console->cflags |= DZ_PARENB;
-       dz_out (dz_console, DZ_LPR, dz_console->cflags);
-
-
-       mask = 1 << dz_console->line;
-       tmp = dz_in (dz_console, DZ_TCR);       /* read the TX flag */
-       if (!(tmp & mask)) {
-         tmp |= mask;                   /* set the TX flag */
-         dz_out (dz_console, DZ_TCR, tmp); 
-       }
-       
 
        /* TOFIX: force to console line */
        dz_console = &multi[CONSOLE_LINE];
<Prev in Thread] Current Thread [Next in Thread>
  • update for dz.[ch] for 2.3 kernel, Dave Airlie <=