tty: Fix regressions in the char driver conversion
authorAlan Cox <alan@linux.intel.com>
Fri, 23 Apr 2010 15:01:18 +0000 (16:01 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 30 Apr 2010 16:20:33 +0000 (09:20 -0700)
This forgot to update a field in the old char drivers. The fact nobody
has basically noticed (except one mxser user) rather suggests most of these
drivers could go into the bitbucket.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Dan Carpenter <error27@gmail.com>
Cc: Andreas Pretzsch <apr@cn-eng.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/char/isicom.c
drivers/char/istallion.c
drivers/char/mxser.c
drivers/char/riscom8.c
drivers/char/stallion.c

index 0fa2e4a..c1ab303 100644 (file)
@@ -879,8 +879,8 @@ static int isicom_open(struct tty_struct *tty, struct file *filp)
        if (tport == NULL)
                return -ENODEV;
        port = container_of(tport, struct isi_port, port);
        if (tport == NULL)
                return -ENODEV;
        port = container_of(tport, struct isi_port, port);
-       card = &isi_card[BOARD(tty->index)];
 
 
+       tty->driver_data = port;
        return tty_port_open(tport, tty, filp);
 }
 
        return tty_port_open(tport, tty, filp);
 }
 
@@ -936,7 +936,12 @@ static void isicom_shutdown(struct tty_port *port)
 static void isicom_close(struct tty_struct *tty, struct file *filp)
 {
        struct isi_port *ip = tty->driver_data;
 static void isicom_close(struct tty_struct *tty, struct file *filp)
 {
        struct isi_port *ip = tty->driver_data;
-       struct tty_port *port = &ip->port;
+       struct tty_port *port;
+
+       if (ip == NULL)
+               return;
+
+       port = &ip->port;
        if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
                return;
        tty_port_close(port, tty, filp);
        if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
                return;
        tty_port_close(port, tty, filp);
index 4cd6c52..4e395c9 100644 (file)
@@ -827,6 +827,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
                return -ENODEV;
        if (portp->devnr < 1)
                return -ENODEV;
                return -ENODEV;
        if (portp->devnr < 1)
                return -ENODEV;
+
+       tty->driver_data = portp;
        return tty_port_open(&portp->port, tty, filp);
 }
 
        return tty_port_open(&portp->port, tty, filp);
 }
 
index 4702305..d2692d4 100644 (file)
@@ -1011,6 +1011,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
        if (!info->ioaddr)
                return -ENODEV;
 
        if (!info->ioaddr)
                return -ENODEV;
 
+       tty->driver_data = info;
        return tty_port_open(&info->port, tty, filp);
 }
 
        return tty_port_open(&info->port, tty, filp);
 }
 
@@ -1074,7 +1075,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
        struct mxser_port *info = tty->driver_data;
        struct tty_port *port = &info->port;
 
        struct mxser_port *info = tty->driver_data;
        struct tty_port *port = &info->port;
 
-       if (tty->index == MXSER_PORTS)
+       if (tty->index == MXSER_PORTS || info == NULL)
                return;
        if (tty_port_close_start(port, tty, filp) == 0)
                return;
                return;
        if (tty_port_close_start(port, tty, filp) == 0)
                return;
index 0a8d1e5..b02332a 100644 (file)
@@ -909,6 +909,7 @@ static int rc_open(struct tty_struct *tty, struct file *filp)
        if (error)
                return error;
 
        if (error)
                return error;
 
+       tty->driver_data = port;
        return tty_port_open(&port->port, tty, filp);
 }
 
        return tty_port_open(&port->port, tty, filp);
 }
 
index 0e511d6..6049fd7 100644 (file)
@@ -724,7 +724,6 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
 {
        struct stlport  *portp;
        struct stlbrd   *brdp;
 {
        struct stlport  *portp;
        struct stlbrd   *brdp;
-       struct tty_port *port;
        unsigned int    minordev, brdnr, panelnr;
        int             portnr;
 
        unsigned int    minordev, brdnr, panelnr;
        int             portnr;
 
@@ -754,7 +753,8 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
        portp = brdp->panels[panelnr]->ports[portnr];
        if (portp == NULL)
                return -ENODEV;
        portp = brdp->panels[panelnr]->ports[portnr];
        if (portp == NULL)
                return -ENODEV;
-       port = &portp->port;
+
+       tty->driver_data = portp;
        return tty_port_open(&portp->port, tty, filp);
 
 }
        return tty_port_open(&portp->port, tty, filp);
 
 }
@@ -841,7 +841,8 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
        pr_debug("stl_close(tty=%p,filp=%p)\n", tty, filp);
 
        portp = tty->driver_data;
        pr_debug("stl_close(tty=%p,filp=%p)\n", tty, filp);
 
        portp = tty->driver_data;
-       BUG_ON(portp == NULL);
+       if(portp == NULL)
+               return;
        tty_port_close(&portp->port, tty, filp);
 }
 
        tty_port_close(&portp->port, tty, filp);
 }