Commit b5391e29 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

gs: use tty_port

Switch drivers using the old "generic serial" driver to use the tty_port
structures
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4982d6b3
This diff is collapsed.
......@@ -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();
}
......@@ -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();
}
......@@ -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();
}
......@@ -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();
}
......@@ -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();
}
......@@ -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. */
......
......@@ -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");
/*
......@@ -506,7 +506,7 @@ 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 {
/*
......@@ -514,7 +514,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
*/
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");
}
......
......@@ -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);
......@@ -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);
}
......@@ -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.
......@@ -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");
......@@ -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;
......
......@@ -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);
......
......@@ -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;
}
/*
......@@ -293,7 +293,7 @@ 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);
/*
......@@ -301,16 +301,16 @@ int riotopen(struct tty_struct *tty, struct file *filp)
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);
......@@ -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)
......
This diff is collapsed.
......@@ -14,6 +14,7 @@
#ifdef __KERNEL__
#include <linux/mutex.h>
#include <linux/tty.h>
struct real_driver {
void (*disable_tx_interrupts) (void *);
......@@ -33,17 +34,12 @@ struct real_driver {
struct gs_port {
int magic;
struct tty_port port;
unsigned char *xmit_buf;
int xmit_head;
int xmit_tail;
int xmit_cnt;
struct mutex port_write_mutex;
int flags;
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
int count;
int blocked_open;
struct tty_struct *tty;
unsigned long event;
unsigned short closing_wait;
int close_delay;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment