Skip to content

Commit

Permalink
gs: use tty_port
Browse files Browse the repository at this point in the history
Switch drivers using the old "generic serial" driver to use the tty_port
structures

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Jul 21, 2008
1 parent 4982d6b commit b5391e2
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 173 deletions.
158 changes: 79 additions & 79 deletions drivers/char/generic_serial.c

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions drivers/char/rio/rio_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ static void rio_disable_tx_interrupts(void *ptr)
{
func_enter();

/* port->gs.flags &= ~GS_TX_INTEN; */
/* port->gs.port.flags &= ~GS_TX_INTEN; */

func_exit();
}
Expand All @@ -455,7 +455,7 @@ static void rio_enable_tx_interrupts(void *ptr)
* In general we cannot count on "tx empty" interrupts, although
* the interrupt routine seems to be able to tell the difference.
*/
PortP->gs.flags &= ~GS_TX_INTEN;
PortP->gs.port.flags &= ~GS_TX_INTEN;

func_exit();
}
Expand Down Expand Up @@ -510,7 +510,7 @@ static void rio_shutdown_port(void *ptr)
func_enter();

PortP = (struct Port *) ptr;
PortP->gs.tty = NULL;
PortP->gs.port.tty = NULL;
func_exit();
}

Expand All @@ -529,7 +529,7 @@ static void rio_hungup(void *ptr)
func_enter();

PortP = (struct Port *) ptr;
PortP->gs.tty = NULL;
PortP->gs.port.tty = NULL;

func_exit();
}
Expand All @@ -549,12 +549,12 @@ static void rio_close(void *ptr)

riotclose(ptr);

if (PortP->gs.count) {
printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.count);
PortP->gs.count = 0;
if (PortP->gs.port.count) {
printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.port.count);
PortP->gs.port.count = 0;
}

PortP->gs.tty = NULL;
PortP->gs.port.tty = NULL;
func_exit();
}

Expand Down Expand Up @@ -849,8 +849,8 @@ static int rio_init_datastructures(void)
/*
* Initializing wait queue
*/
init_waitqueue_head(&port->gs.open_wait);
init_waitqueue_head(&port->gs.close_wait);
init_waitqueue_head(&port->gs.port.open_wait);
init_waitqueue_head(&port->gs.port.close_wait);
}
#else
/* We could postpone initializing them to when they are configured. */
Expand Down
10 changes: 5 additions & 5 deletions drivers/char/rio/riocmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,12 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
** If the device is a modem, then check the modem
** carrier.
*/
if (PortP->gs.tty == NULL)
if (PortP->gs.port.tty == NULL)
break;
if (PortP->gs.tty->termios == NULL)
if (PortP->gs.port.tty->termios == NULL)
break;

if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) {
if (!(PortP->gs.port.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) {

rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n");
/*
Expand All @@ -506,15 +506,15 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
** wakeup anyone in WOPEN
*/
if (PortP->State & (PORT_ISOPEN | RIO_WOPEN))
wake_up_interruptible(&PortP->gs.open_wait);
wake_up_interruptible(&PortP->gs.port.open_wait);
}
} else {
/*
** Has carrier just dropped?
*/
if (PortP->State & RIO_CARR_ON) {
if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN))
tty_hangup(PortP->gs.tty);
tty_hangup(PortP->gs.port.tty);
PortP->State &= ~RIO_CARR_ON;
rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n");
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/char/rio/riointr.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void RIOTxEnable(char *en)

PortP = (struct Port *) en;
p = (struct rio_info *) PortP->p;
tty = PortP->gs.tty;
tty = PortP->gs.port.tty;


rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt);
Expand Down Expand Up @@ -158,7 +158,7 @@ void RIOTxEnable(char *en)
rio_spin_unlock_irqrestore(&PortP->portSem, flags);

if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN))
tty_wakeup(PortP->gs.tty);
tty_wakeup(PortP->gs.port.tty);

}

Expand Down Expand Up @@ -241,7 +241,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP)
** find corresponding tty structure. The process of mapping
** the ports puts these here.
*/
ttyP = PortP->gs.tty;
ttyP = PortP->gs.port.tty;

/*
** Lock the port before we begin working on it.
Expand Down Expand Up @@ -335,7 +335,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP)
** find corresponding tty structure. The process of mapping
** the ports puts these here.
*/
ttyP = PortP->gs.tty;
ttyP = PortP->gs.port.tty;
/* If ttyP is NULL, the port is getting closed. Forget about it. */
if (!ttyP) {
rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n");
Expand Down Expand Up @@ -542,7 +542,7 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)

intCount++;

TtyP = PortP->gs.tty;
TtyP = PortP->gs.port.tty;
if (!TtyP) {
rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n");
return;
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/rio/rioparam.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag)

func_enter();

TtyP = PortP->gs.tty;
TtyP = PortP->gs.port.tty;

rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP);

Expand Down
16 changes: 8 additions & 8 deletions drivers/char/rio/riotty.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ int riotopen(struct tty_struct *tty, struct file *filp)

tty->driver_data = PortP;

PortP->gs.tty = tty;
PortP->gs.count++;
PortP->gs.port.tty = tty;
PortP->gs.port.count++;

rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);

retval = gs_init_port(&PortP->gs);
if (retval) {
PortP->gs.count--;
PortP->gs.port.count--;
return -ENXIO;
}
/*
Expand Down Expand Up @@ -293,24 +293,24 @@ int riotopen(struct tty_struct *tty, struct file *filp)
** insert test for carrier here. -- ???
** I already see that test here. What's the deal? -- REW
*/
if ((PortP->gs.tty->termios->c_cflag & CLOCAL) ||
if ((PortP->gs.port.tty->termios->c_cflag & CLOCAL) ||
(PortP->ModemState & RIOC_MSVR1_CD)) {
rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort);
/*
tp->tm.c_state |= CARR_ON;
wakeup((caddr_t) &tp->tm.c_canq);
*/
PortP->State |= RIO_CARR_ON;
wake_up_interruptible(&PortP->gs.open_wait);
wake_up_interruptible(&PortP->gs.port.open_wait);
} else { /* no carrier - wait for DCD */
/*
while (!(PortP->gs.tty->termios->c_state & CARR_ON) &&
while (!(PortP->gs.port.tty->termios->c_state & CARR_ON) &&
!(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
*/
while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) {
rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort);
/*
PortP->gs.tty->termios->c_state |= WOPEN;
PortP->gs.port.tty->termios->c_state |= WOPEN;
*/
PortP->State |= RIO_WOPEN;
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
Expand Down Expand Up @@ -380,7 +380,7 @@ int riotclose(void *ptr)
/* PortP = p->RIOPortp[SysPort]; */
rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP);
/* tp = PortP->TtyP; *//* Get tty */
tty = PortP->gs.tty;
tty = PortP->gs.port.tty;
rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty);

if (PortP->gs.closing_wait)
Expand Down
Loading

0 comments on commit b5391e2

Please sign in to comment.