Skip to content

Commit

Permalink
m68knommu: fix dereference of port.tty
Browse files Browse the repository at this point in the history
The struct_tty associated with a port is now a direct pointer
from within the local private driver info struct. So fix all uses
of it.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
  • Loading branch information
Greg Ungerer committed Feb 15, 2011
1 parent 8117426 commit bc0c36d
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions drivers/tty/serial/68328serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static void status_handle(struct m68k_serial *info, unsigned short status)

static void receive_chars(struct m68k_serial *info, unsigned short rx)
{
struct tty_struct *tty = info->port.tty;
struct tty_struct *tty = info->tty;
m68328_uart *uart = &uart_addr[info->line];
unsigned char ch, flag;

Expand Down Expand Up @@ -329,7 +329,7 @@ static void transmit_chars(struct m68k_serial *info)
goto clear_and_return;
}

if((info->xmit_cnt <= 0) || info->port.tty->stopped) {
if((info->xmit_cnt <= 0) || info->tty->stopped) {
/* That's peculiar... TX ints off */
uart->ustcnt &= ~USTCNT_TX_INTR_MASK;
goto clear_and_return;
Expand Down Expand Up @@ -383,7 +383,7 @@ static void do_softint(struct work_struct *work)
struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue);
struct tty_struct *tty;

tty = info->port.tty;
tty = info->tty;
if (!tty)
return;
#if 0
Expand All @@ -407,7 +407,7 @@ static void do_serial_hangup(struct work_struct *work)
struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup);
struct tty_struct *tty;

tty = info->port.tty;
tty = info->tty;
if (!tty)
return;

Expand Down Expand Up @@ -451,8 +451,8 @@ static int startup(struct m68k_serial * info)
uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK;
#endif

if (info->port.tty)
clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
if (info->tty)
clear_bit(TTY_IO_ERROR, &info->tty->flags);
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;

/*
Expand Down Expand Up @@ -486,8 +486,8 @@ static void shutdown(struct m68k_serial * info)
info->xmit_buf = 0;
}

if (info->port.tty)
set_bit(TTY_IO_ERROR, &info->port.tty->flags);
if (info->tty)
set_bit(TTY_IO_ERROR, &info->tty->flags);

info->flags &= ~S_INITIALIZED;
local_irq_restore(flags);
Expand Down Expand Up @@ -553,9 +553,9 @@ static void change_speed(struct m68k_serial *info)
unsigned cflag;
int i;

if (!info->port.tty || !info->port.tty->termios)
if (!info->tty || !info->tty->termios)
return;
cflag = info->port.tty->termios->c_cflag;
cflag = info->tty->termios->c_cflag;
if (!(port = info->port))
return;

Expand Down Expand Up @@ -970,7 +970,6 @@ static void send_break(struct m68k_serial * info, unsigned int duration)
static int rs_ioctl(struct tty_struct *tty, struct file * file,
unsigned int cmd, unsigned long arg)
{
int error;
struct m68k_serial * info = (struct m68k_serial *)tty->driver_data;
int retval;

Expand Down Expand Up @@ -1104,7 +1103,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
tty_ldisc_flush(tty);
tty->closing = 0;
info->event = 0;
info->port.tty = NULL;
info->tty = NULL;
#warning "This is not and has never been valid so fix it"
#if 0
if (tty->ldisc.num != ldiscs[N_TTY].num) {
Expand Down Expand Up @@ -1142,7 +1141,7 @@ void rs_hangup(struct tty_struct *tty)
info->event = 0;
info->count = 0;
info->flags &= ~S_NORMAL_ACTIVE;
info->port.tty = NULL;
info->tty = NULL;
wake_up_interruptible(&info->open_wait);
}

Expand Down Expand Up @@ -1261,7 +1260,7 @@ int rs_open(struct tty_struct *tty, struct file * filp)

info->count++;
tty->driver_data = info;
info->port.tty = tty;
info->tty = tty;

/*
* Start up serial port
Expand Down Expand Up @@ -1338,7 +1337,7 @@ rs68328_init(void)
info = &m68k_soft[i];
info->magic = SERIAL_MAGIC;
info->port = (int) &uart_addr[i];
info->port.tty = NULL;
info->tty = NULL;
info->irq = uart_irqs[i];
info->custom_divisor = 16;
info->close_delay = 50;
Expand Down

0 comments on commit bc0c36d

Please sign in to comment.