Skip to content

Commit

Permalink
tty: Fix regressions in the char driver conversion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Apr 30, 2010
1 parent 66f41d4 commit a2d1e35
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
9 changes: 7 additions & 2 deletions drivers/char/isicom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
card = &isi_card[BOARD(tty->index)];

tty->driver_data = port;
return tty_port_open(tport, tty, filp);
}

Expand Down Expand Up @@ -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;
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);
Expand Down
2 changes: 2 additions & 0 deletions drivers/char/istallion.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
return -ENODEV;
if (portp->devnr < 1)
return -ENODEV;

tty->driver_data = portp;
return tty_port_open(&portp->port, tty, filp);
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/char/mxser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
if (!info->ioaddr)
return -ENODEV;

tty->driver_data = info;
return tty_port_open(&info->port, tty, filp);
}

Expand Down Expand Up @@ -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;

if (tty->index == MXSER_PORTS)
if (tty->index == MXSER_PORTS || info == NULL)
return;
if (tty_port_close_start(port, tty, filp) == 0)
return;
Expand Down
1 change: 1 addition & 0 deletions drivers/char/riscom8.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,7 @@ static int rc_open(struct tty_struct *tty, struct file *filp)
if (error)
return error;

tty->driver_data = port;
return tty_port_open(&port->port, tty, filp);
}

Expand Down
7 changes: 4 additions & 3 deletions drivers/char/stallion.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
{
struct stlport *portp;
struct stlbrd *brdp;
struct tty_port *port;
unsigned int minordev, brdnr, panelnr;
int portnr;

Expand Down Expand Up @@ -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;
port = &portp->port;

tty->driver_data = portp;
return tty_port_open(&portp->port, tty, filp);

}
Expand Down Expand Up @@ -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;
BUG_ON(portp == NULL);
if(portp == NULL)
return;
tty_port_close(&portp->port, tty, filp);
}

Expand Down

0 comments on commit a2d1e35

Please sign in to comment.