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) ...@@ -431,7 +431,7 @@ static void rio_disable_tx_interrupts(void *ptr)
{ {
func_enter(); func_enter();
/* port->gs.flags &= ~GS_TX_INTEN; */ /* port->gs.port.flags &= ~GS_TX_INTEN; */
func_exit(); func_exit();
} }
...@@ -455,7 +455,7 @@ static void rio_enable_tx_interrupts(void *ptr) ...@@ -455,7 +455,7 @@ static void rio_enable_tx_interrupts(void *ptr)
* In general we cannot count on "tx empty" interrupts, although * In general we cannot count on "tx empty" interrupts, although
* the interrupt routine seems to be able to tell the difference. * 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(); func_exit();
} }
...@@ -510,7 +510,7 @@ static void rio_shutdown_port(void *ptr) ...@@ -510,7 +510,7 @@ static void rio_shutdown_port(void *ptr)
func_enter(); func_enter();
PortP = (struct Port *) ptr; PortP = (struct Port *) ptr;
PortP->gs.tty = NULL; PortP->gs.port.tty = NULL;
func_exit(); func_exit();
} }
...@@ -529,7 +529,7 @@ static void rio_hungup(void *ptr) ...@@ -529,7 +529,7 @@ static void rio_hungup(void *ptr)
func_enter(); func_enter();
PortP = (struct Port *) ptr; PortP = (struct Port *) ptr;
PortP->gs.tty = NULL; PortP->gs.port.tty = NULL;
func_exit(); func_exit();
} }
...@@ -549,12 +549,12 @@ static void rio_close(void *ptr) ...@@ -549,12 +549,12 @@ static void rio_close(void *ptr)
riotclose(ptr); riotclose(ptr);
if (PortP->gs.count) { if (PortP->gs.port.count) {
printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.count); printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.port.count);
PortP->gs.count = 0; PortP->gs.port.count = 0;
} }
PortP->gs.tty = NULL; PortP->gs.port.tty = NULL;
func_exit(); func_exit();
} }
...@@ -849,8 +849,8 @@ static int rio_init_datastructures(void) ...@@ -849,8 +849,8 @@ static int rio_init_datastructures(void)
/* /*
* Initializing wait queue * Initializing wait queue
*/ */
init_waitqueue_head(&port->gs.open_wait); init_waitqueue_head(&port->gs.port.open_wait);
init_waitqueue_head(&port->gs.close_wait); init_waitqueue_head(&port->gs.port.close_wait);
} }
#else #else
/* We could postpone initializing them to when they are configured. */ /* 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 ...@@ -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 ** If the device is a modem, then check the modem
** carrier. ** carrier.
*/ */
if (PortP->gs.tty == NULL) if (PortP->gs.port.tty == NULL)
break; break;
if (PortP->gs.tty->termios == NULL) if (PortP->gs.port.tty->termios == NULL)
break; 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"); 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 ...@@ -506,7 +506,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
** wakeup anyone in WOPEN ** wakeup anyone in WOPEN
*/ */
if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) if (PortP->State & (PORT_ISOPEN | RIO_WOPEN))
wake_up_interruptible(&PortP->gs.open_wait); wake_up_interruptible(&PortP->gs.port.open_wait);
} }
} else { } else {
/* /*
...@@ -514,7 +514,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc ...@@ -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 & RIO_CARR_ON) {
if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN)) 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; PortP->State &= ~RIO_CARR_ON;
rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n");
} }
......
...@@ -102,7 +102,7 @@ void RIOTxEnable(char *en) ...@@ -102,7 +102,7 @@ void RIOTxEnable(char *en)
PortP = (struct Port *) en; PortP = (struct Port *) en;
p = (struct rio_info *) PortP->p; 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); 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) ...@@ -158,7 +158,7 @@ void RIOTxEnable(char *en)
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) 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) ...@@ -241,7 +241,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP)
** find corresponding tty structure. The process of mapping ** find corresponding tty structure. The process of mapping
** the ports puts these here. ** the ports puts these here.
*/ */
ttyP = PortP->gs.tty; ttyP = PortP->gs.port.tty;
/* /*
** Lock the port before we begin working on it. ** Lock the port before we begin working on it.
...@@ -335,7 +335,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP) ...@@ -335,7 +335,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP)
** find corresponding tty structure. The process of mapping ** find corresponding tty structure. The process of mapping
** the ports puts these here. ** 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 is NULL, the port is getting closed. Forget about it. */
if (!ttyP) { if (!ttyP) {
rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n"); rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n");
...@@ -542,7 +542,7 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP) ...@@ -542,7 +542,7 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
intCount++; intCount++;
TtyP = PortP->gs.tty; TtyP = PortP->gs.port.tty;
if (!TtyP) { if (!TtyP) {
rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n");
return; return;
......
...@@ -160,7 +160,7 @@ int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag) ...@@ -160,7 +160,7 @@ int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag)
func_enter(); 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); 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) ...@@ -140,14 +140,14 @@ int riotopen(struct tty_struct *tty, struct file *filp)
tty->driver_data = PortP; tty->driver_data = PortP;
PortP->gs.tty = tty; PortP->gs.port.tty = tty;
PortP->gs.count++; PortP->gs.port.count++;
rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt); rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);
retval = gs_init_port(&PortP->gs); retval = gs_init_port(&PortP->gs);
if (retval) { if (retval) {
PortP->gs.count--; PortP->gs.port.count--;
return -ENXIO; return -ENXIO;
} }
/* /*
...@@ -293,7 +293,7 @@ int riotopen(struct tty_struct *tty, struct file *filp) ...@@ -293,7 +293,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
** insert test for carrier here. -- ??? ** insert test for carrier here. -- ???
** I already see that test here. What's the deal? -- REW ** 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)) { (PortP->ModemState & RIOC_MSVR1_CD)) {
rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); 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) ...@@ -301,16 +301,16 @@ int riotopen(struct tty_struct *tty, struct file *filp)
wakeup((caddr_t) &tp->tm.c_canq); wakeup((caddr_t) &tp->tm.c_canq);
*/ */
PortP->State |= RIO_CARR_ON; 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 */ } 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 ) !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
*/ */
while (!(PortP->State & RIO_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); 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; PortP->State |= RIO_WOPEN;
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
...@@ -380,7 +380,7 @@ int riotclose(void *ptr) ...@@ -380,7 +380,7 @@ int riotclose(void *ptr)
/* PortP = p->RIOPortp[SysPort]; */ /* PortP = p->RIOPortp[SysPort]; */
rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP); rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP);
/* tp = PortP->TtyP; *//* Get tty */ /* 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); rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty);
if (PortP->gs.closing_wait) if (PortP->gs.closing_wait)
......
This diff is collapsed.
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/tty.h>
struct real_driver { struct real_driver {
void (*disable_tx_interrupts) (void *); void (*disable_tx_interrupts) (void *);
...@@ -33,17 +34,12 @@ struct real_driver { ...@@ -33,17 +34,12 @@ struct real_driver {
struct gs_port { struct gs_port {
int magic; int magic;
struct tty_port port;
unsigned char *xmit_buf; unsigned char *xmit_buf;
int xmit_head; int xmit_head;
int xmit_tail; int xmit_tail;
int xmit_cnt; int xmit_cnt;
struct mutex port_write_mutex; 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 long event;
unsigned short closing_wait; unsigned short closing_wait;
int close_delay; 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