Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+79 −79
Original line number Original line Diff line number Diff line
@@ -60,7 +60,7 @@ int gs_put_char(struct tty_struct * tty, unsigned char ch)


	if (!port) return 0;
	if (!port) return 0;


	if (! (port->flags & ASYNC_INITIALIZED)) return 0;
	if (! (port->port.flags & ASYNC_INITIALIZED)) return 0;


	/* Take a lock on the serial tranmit buffer! */
	/* Take a lock on the serial tranmit buffer! */
	mutex_lock(& port->port_write_mutex);
	mutex_lock(& port->port_write_mutex);
@@ -103,7 +103,7 @@ int gs_write(struct tty_struct * tty,


	if (!port) return 0;
	if (!port) return 0;


	if (! (port->flags & ASYNC_INITIALIZED))
	if (! (port->port.flags & ASYNC_INITIALIZED))
		return 0;
		return 0;


	/* get exclusive "write" access to this port (problem 3) */
	/* get exclusive "write" access to this port (problem 3) */
@@ -141,13 +141,13 @@ int gs_write(struct tty_struct * tty,
	mutex_unlock(& port->port_write_mutex);
	mutex_unlock(& port->port_write_mutex);


	gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n", 
	gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n", 
	            (port->flags & GS_TX_INTEN)?"enabled": "disabled"); 
	            (port->port.flags & GS_TX_INTEN)?"enabled": "disabled");


	if (port->xmit_cnt && 
	if (port->xmit_cnt && 
	    !tty->stopped && 
	    !tty->stopped && 
	    !tty->hw_stopped &&
	    !tty->hw_stopped &&
	    !(port->flags & GS_TX_INTEN)) {
	    !(port->port.flags & GS_TX_INTEN)) {
		port->flags |= GS_TX_INTEN;
		port->port.flags |= GS_TX_INTEN;
		port->rd->enable_tx_interrupts (port);
		port->rd->enable_tx_interrupts (port);
	}
	}
	func_exit ();
	func_exit ();
@@ -208,7 +208,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout)
	gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port);
	gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port);
	if (port) {
	if (port) {
		gs_dprintk (GS_DEBUG_FLUSH, "xmit_cnt=%x, xmit_buf=%p, tty=%p.\n", 
		gs_dprintk (GS_DEBUG_FLUSH, "xmit_cnt=%x, xmit_buf=%p, tty=%p.\n", 
		port->xmit_cnt, port->xmit_buf, port->tty);
		port->xmit_cnt, port->xmit_buf, port->port.tty);
	}
	}


	if (!port || port->xmit_cnt < 0 || !port->xmit_buf) {
	if (!port || port->xmit_cnt < 0 || !port->xmit_buf) {
@@ -217,7 +217,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout)
		return -EINVAL;  /* This is an error which we don't know how to handle. */
		return -EINVAL;  /* This is an error which we don't know how to handle. */
	}
	}


	rcib = gs_real_chars_in_buffer(port->tty);
	rcib = gs_real_chars_in_buffer(port->port.tty);


	if(rcib <= 0) {
	if(rcib <= 0) {
		gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n");
		gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n");
@@ -236,7 +236,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout)


	/* the expression is actually jiffies < end_jiffies, but that won't
	/* the expression is actually jiffies < end_jiffies, but that won't
	   work around the wraparound. Tricky eh? */
	   work around the wraparound. Tricky eh? */
	while ((charsleft = gs_real_chars_in_buffer (port->tty)) &&
	while ((charsleft = gs_real_chars_in_buffer (port->port.tty)) &&
	        time_after (end_jiffies, jiffies)) {
	        time_after (end_jiffies, jiffies)) {
		/* Units check: 
		/* Units check: 
		   chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies!
		   chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies!
@@ -309,7 +309,7 @@ void gs_flush_chars(struct tty_struct * tty)
	}
	}


	/* Beats me -- REW */
	/* Beats me -- REW */
	port->flags |= GS_TX_INTEN;
	port->port.flags |= GS_TX_INTEN;
	port->rd->enable_tx_interrupts (port);
	port->rd->enable_tx_interrupts (port);
	func_exit ();
	func_exit ();
}
}
@@ -329,8 +329,8 @@ void gs_stop(struct tty_struct * tty)


	if (port->xmit_cnt && 
	if (port->xmit_cnt && 
	    port->xmit_buf && 
	    port->xmit_buf && 
	    (port->flags & GS_TX_INTEN) ) {
	    (port->port.flags & GS_TX_INTEN) ) {
		port->flags &= ~GS_TX_INTEN;
		port->port.flags &= ~GS_TX_INTEN;
		port->rd->disable_tx_interrupts (port);
		port->rd->disable_tx_interrupts (port);
	}
	}
	func_exit ();
	func_exit ();
@@ -349,8 +349,8 @@ void gs_start(struct tty_struct * tty)


	if (port->xmit_cnt && 
	if (port->xmit_cnt && 
	    port->xmit_buf && 
	    port->xmit_buf && 
	    !(port->flags & GS_TX_INTEN) ) {
	    !(port->port.flags & GS_TX_INTEN) ) {
		port->flags |= GS_TX_INTEN;
		port->port.flags |= GS_TX_INTEN;
		port->rd->enable_tx_interrupts (port);
		port->rd->enable_tx_interrupts (port);
	}
	}
	func_exit ();
	func_exit ();
@@ -365,7 +365,7 @@ static void gs_shutdown_port (struct gs_port *port)
	
	
	if (!port) return;
	if (!port) return;
	
	
	if (!(port->flags & ASYNC_INITIALIZED))
	if (!(port->port.flags & ASYNC_INITIALIZED))
		return;
		return;


	spin_lock_irqsave(&port->driver_lock, flags);
	spin_lock_irqsave(&port->driver_lock, flags);
@@ -375,12 +375,12 @@ static void gs_shutdown_port (struct gs_port *port)
		port->xmit_buf = NULL;
		port->xmit_buf = NULL;
	}
	}


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


	port->rd->shutdown_port (port);
	port->rd->shutdown_port (port);


	port->flags &= ~ASYNC_INITIALIZED;
	port->port.flags &= ~ASYNC_INITIALIZED;
	spin_unlock_irqrestore(&port->driver_lock, flags);
	spin_unlock_irqrestore(&port->driver_lock, flags);


	func_exit();
	func_exit();
@@ -396,16 +396,16 @@ void gs_hangup(struct tty_struct *tty)
	if (!tty) return;
	if (!tty) return;


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


	gs_shutdown_port (port);
	gs_shutdown_port (port);
	port->flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE);
	port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE);
	port->tty = NULL;
	port->port.tty = NULL;
	port->count = 0;
	port->port.count = 0;


	wake_up_interruptible(&port->open_wait);
	wake_up_interruptible(&port->port.open_wait);
	func_exit ();
	func_exit ();
}
}


@@ -424,7 +424,7 @@ int gs_block_til_ready(void *port_, struct file * filp)


	if (!port) return 0;
	if (!port) return 0;


	tty = port->tty;
	tty = port->port.tty;


	if (!tty) return 0;
	if (!tty) return 0;


@@ -433,9 +433,9 @@ int gs_block_til_ready(void *port_, struct file * filp)
	 * If the device is in the middle of being closed, then block
	 * If the device is in the middle of being closed, then block
	 * until it's done, and then try again.
	 * until it's done, and then try again.
	 */
	 */
	if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) {
	if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) {
		interruptible_sleep_on(&port->close_wait);
		interruptible_sleep_on(&port->port.close_wait);
		if (port->flags & ASYNC_HUP_NOTIFY)
		if (port->port.flags & ASYNC_HUP_NOTIFY)
			return -EAGAIN;
			return -EAGAIN;
		else
		else
			return -ERESTARTSYS;
			return -ERESTARTSYS;
@@ -449,7 +449,7 @@ int gs_block_til_ready(void *port_, struct file * filp)
	 */
	 */
	if ((filp->f_flags & O_NONBLOCK) ||
	if ((filp->f_flags & O_NONBLOCK) ||
	    (tty->flags & (1 << TTY_IO_ERROR))) {
	    (tty->flags & (1 << TTY_IO_ERROR))) {
		port->flags |= ASYNC_NORMAL_ACTIVE;
		port->port.flags |= ASYNC_NORMAL_ACTIVE;
		return 0;
		return 0;
	}
	}


@@ -461,34 +461,34 @@ int gs_block_til_ready(void *port_, struct file * filp)
	/*
	/*
	 * Block waiting for the carrier detect and the line to become
	 * Block waiting for the carrier detect and the line to become
	 * free (i.e., not in use by the callout).  While we are in
	 * free (i.e., not in use by the callout).  While we are in
	 * this loop, port->count is dropped by one, so that
	 * this loop, port->port.count is dropped by one, so that
	 * rs_close() knows when to free things.  We restore it upon
	 * rs_close() knows when to free things.  We restore it upon
	 * exit, either normal or abnormal.
	 * exit, either normal or abnormal.
	 */
	 */
	retval = 0;
	retval = 0;


	add_wait_queue(&port->open_wait, &wait);
	add_wait_queue(&port->port.open_wait, &wait);


	gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n"); 
	gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n"); 
	spin_lock_irqsave(&port->driver_lock, flags);
	spin_lock_irqsave(&port->driver_lock, flags);
	if (!tty_hung_up_p(filp)) {
	if (!tty_hung_up_p(filp)) {
		port->count--;
		port->port.count--;
	}
	}
	spin_unlock_irqrestore(&port->driver_lock, flags);
	spin_unlock_irqrestore(&port->driver_lock, flags);
	port->blocked_open++;
	port->port.blocked_open++;
	while (1) {
	while (1) {
		CD = port->rd->get_CD (port);
		CD = port->rd->get_CD (port);
		gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD);
		gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD);
		set_current_state (TASK_INTERRUPTIBLE);
		set_current_state (TASK_INTERRUPTIBLE);
		if (tty_hung_up_p(filp) ||
		if (tty_hung_up_p(filp) ||
		    !(port->flags & ASYNC_INITIALIZED)) {
		    !(port->port.flags & ASYNC_INITIALIZED)) {
			if (port->flags & ASYNC_HUP_NOTIFY)
			if (port->port.flags & ASYNC_HUP_NOTIFY)
				retval = -EAGAIN;
				retval = -EAGAIN;
			else
			else
				retval = -ERESTARTSYS;
				retval = -ERESTARTSYS;
			break;
			break;
		}
		}
		if (!(port->flags & ASYNC_CLOSING) &&
		if (!(port->port.flags & ASYNC_CLOSING) &&
		    (do_clocal || CD))
		    (do_clocal || CD))
			break;
			break;
		gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n", 
		gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n", 
@@ -500,17 +500,17 @@ int gs_block_til_ready(void *port_, struct file * filp)
		schedule();
		schedule();
	}
	}
	gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n",
	gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n",
		    port->blocked_open);
		    port->port.blocked_open);
	set_current_state (TASK_RUNNING);
	set_current_state (TASK_RUNNING);
	remove_wait_queue(&port->open_wait, &wait);
	remove_wait_queue(&port->port.open_wait, &wait);
	if (!tty_hung_up_p(filp)) {
	if (!tty_hung_up_p(filp)) {
		port->count++;
		port->port.count++;
	}
	}
	port->blocked_open--;
	port->port.blocked_open--;
	if (retval)
	if (retval)
		return retval;
		return retval;


	port->flags |= ASYNC_NORMAL_ACTIVE;
	port->port.flags |= ASYNC_NORMAL_ACTIVE;
	func_exit ();
	func_exit ();
	return 0;
	return 0;
}			 
}			 
@@ -529,10 +529,10 @@ void gs_close(struct tty_struct * tty, struct file * filp)


	if (!port) return;
	if (!port) return;


	if (!port->tty) {
	if (!port->port.tty) {
		/* This seems to happen when this is called from vhangup. */
		/* This seems to happen when this is called from vhangup. */
		gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->tty is NULL\n");
		gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->port.tty is NULL\n");
		port->tty = tty;
		port->port.tty = tty;
	}
	}


	spin_lock_irqsave(&port->driver_lock, flags);
	spin_lock_irqsave(&port->driver_lock, flags);
@@ -545,23 +545,23 @@ void gs_close(struct tty_struct * tty, struct file * filp)
		return;
		return;
	}
	}


	if ((tty->count == 1) && (port->count != 1)) {
	if ((tty->count == 1) && (port->port.count != 1)) {
		printk(KERN_ERR "gs: gs_close port %p: bad port count;"
		printk(KERN_ERR "gs: gs_close port %p: bad port count;"
		       " tty->count is 1, port count is %d\n", port, port->count);
		       " tty->count is 1, port count is %d\n", port, port->port.count);
		port->count = 1;
		port->port.count = 1;
	}
	}
	if (--port->count < 0) {
	if (--port->port.count < 0) {
		printk(KERN_ERR "gs: gs_close port %p: bad port count: %d\n", port, port->count);
		printk(KERN_ERR "gs: gs_close port %p: bad port count: %d\n", port, port->port.count);
		port->count = 0;
		port->port.count = 0;
	}
	}


	if (port->count) {
	if (port->port.count) {
		gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->count);
		gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->port.count);
		spin_unlock_irqrestore(&port->driver_lock, flags);
		spin_unlock_irqrestore(&port->driver_lock, flags);
		func_exit ();
		func_exit ();
		return;
		return;
	}
	}
	port->flags |= ASYNC_CLOSING;
	port->port.flags |= ASYNC_CLOSING;


	/*
	/*
	 * Now we wait for the transmit buffer to clear; and we notify 
	 * Now we wait for the transmit buffer to clear; and we notify 
@@ -585,7 +585,7 @@ void gs_close(struct tty_struct * tty, struct file * filp)
	if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
	if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
		gs_wait_tx_flushed (port, port->closing_wait);
		gs_wait_tx_flushed (port, port->closing_wait);


	port->flags &= ~GS_ACTIVE;
	port->port.flags &= ~GS_ACTIVE;


	gs_flush_buffer(tty);
	gs_flush_buffer(tty);


@@ -595,18 +595,18 @@ void gs_close(struct tty_struct * tty, struct file * filp)
	port->event = 0;
	port->event = 0;
	port->rd->close (port);
	port->rd->close (port);
	port->rd->shutdown_port (port);
	port->rd->shutdown_port (port);
	port->tty = NULL;
	port->port.tty = NULL;


	if (port->blocked_open) {
	if (port->port.blocked_open) {
		if (port->close_delay) {
		if (port->close_delay) {
			spin_unlock_irqrestore(&port->driver_lock, flags);
			spin_unlock_irqrestore(&port->driver_lock, flags);
			msleep_interruptible(jiffies_to_msecs(port->close_delay));
			msleep_interruptible(jiffies_to_msecs(port->close_delay));
			spin_lock_irqsave(&port->driver_lock, flags);
			spin_lock_irqsave(&port->driver_lock, flags);
		}
		}
		wake_up_interruptible(&port->open_wait);
		wake_up_interruptible(&port->port.open_wait);
	}
	}
	port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED);
	port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED);
	wake_up_interruptible(&port->close_wait);
	wake_up_interruptible(&port->port.close_wait);


	func_exit ();
	func_exit ();
}
}
@@ -626,10 +626,10 @@ void gs_set_termios (struct tty_struct * tty,
	port = tty->driver_data;
	port = tty->driver_data;


	if (!port) return;
	if (!port) return;
	if (!port->tty) {
	if (!port->port.tty) {
		/* This seems to happen when this is called after gs_close. */
		/* This seems to happen when this is called after gs_close. */
		gs_dprintk (GS_DEBUG_TERMIOS, "gs: Odd: port->tty is NULL\n");
		gs_dprintk (GS_DEBUG_TERMIOS, "gs: Odd: port->port.tty is NULL\n");
		port->tty = tty;
		port->port.tty = tty;
	}
	}




@@ -651,15 +651,15 @@ void gs_set_termios (struct tty_struct * tty,
	baudrate = tty_get_baud_rate(tty);
	baudrate = tty_get_baud_rate(tty);


	if ((tiosp->c_cflag & CBAUD) == B38400) {
	if ((tiosp->c_cflag & CBAUD) == B38400) {
		if (     (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
		if (     (port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
			baudrate = 57600;
			baudrate = 57600;
		else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
		else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
			baudrate = 115200;
			baudrate = 115200;
		else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
		else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
			baudrate = 230400;
			baudrate = 230400;
		else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
		else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
			baudrate = 460800;
			baudrate = 460800;
		else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
		else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
			baudrate = (port->baud_base / port->custom_divisor);
			baudrate = (port->baud_base / port->custom_divisor);
	}
	}


@@ -715,7 +715,7 @@ int gs_init_port(struct gs_port *port)


	func_enter ();
	func_enter ();


	if (port->flags & ASYNC_INITIALIZED) {
	if (port->port.flags & ASYNC_INITIALIZED) {
		func_exit ();
		func_exit ();
		return 0;
		return 0;
	}
	}
@@ -737,15 +737,15 @@ int gs_init_port(struct gs_port *port)
	}
	}


	spin_lock_irqsave (&port->driver_lock, flags);
	spin_lock_irqsave (&port->driver_lock, flags);
	if (port->tty) 
	if (port->port.tty)
		clear_bit(TTY_IO_ERROR, &port->tty->flags);
		clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
	mutex_init(&port->port_write_mutex);
	mutex_init(&port->port_write_mutex);
	port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
	port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
	spin_unlock_irqrestore(&port->driver_lock, flags);
	spin_unlock_irqrestore(&port->driver_lock, flags);
	gs_set_termios(port->tty, NULL);
	gs_set_termios(port->port.tty, NULL);
	spin_lock_irqsave (&port->driver_lock, flags);
	spin_lock_irqsave (&port->driver_lock, flags);
	port->flags |= ASYNC_INITIALIZED;
	port->port.flags |= ASYNC_INITIALIZED;
	port->flags &= ~GS_TX_INTEN;
	port->port.flags &= ~GS_TX_INTEN;


	spin_unlock_irqrestore(&port->driver_lock, flags);
	spin_unlock_irqrestore(&port->driver_lock, flags);
	func_exit ();
	func_exit ();
@@ -764,11 +764,11 @@ int gs_setserial(struct gs_port *port, struct serial_struct __user *sp)
		if ((sio.baud_base != port->baud_base) ||
		if ((sio.baud_base != port->baud_base) ||
		    (sio.close_delay != port->close_delay) ||
		    (sio.close_delay != port->close_delay) ||
		    ((sio.flags & ~ASYNC_USR_MASK) !=
		    ((sio.flags & ~ASYNC_USR_MASK) !=
		     (port->flags & ~ASYNC_USR_MASK)))
		     (port->port.flags & ~ASYNC_USR_MASK)))
			return(-EPERM);
			return(-EPERM);
	} 
	} 


	port->flags = (port->flags & ~ASYNC_USR_MASK) |
	port->port.flags = (port->port.flags & ~ASYNC_USR_MASK) |
		(sio.flags & ASYNC_USR_MASK);
		(sio.flags & ASYNC_USR_MASK);
  
  
	port->baud_base = sio.baud_base;
	port->baud_base = sio.baud_base;
@@ -776,7 +776,7 @@ int gs_setserial(struct gs_port *port, struct serial_struct __user *sp)
	port->closing_wait = sio.closing_wait;
	port->closing_wait = sio.closing_wait;
	port->custom_divisor = sio.custom_divisor;
	port->custom_divisor = sio.custom_divisor;


	gs_set_termios (port->tty, NULL);
	gs_set_termios (port->port.tty, NULL);


	return 0;
	return 0;
}
}
@@ -793,7 +793,7 @@ int gs_getserial(struct gs_port *port, struct serial_struct __user *sp)
	struct serial_struct    sio;
	struct serial_struct    sio;


	memset(&sio, 0, sizeof(struct serial_struct));
	memset(&sio, 0, sizeof(struct serial_struct));
	sio.flags = port->flags;
	sio.flags = port->port.flags;
	sio.baud_base = port->baud_base;
	sio.baud_base = port->baud_base;
	sio.close_delay = port->close_delay;
	sio.close_delay = port->close_delay;
	sio.closing_wait = port->closing_wait;
	sio.closing_wait = port->closing_wait;
@@ -821,10 +821,10 @@ void gs_got_break(struct gs_port *port)
{
{
	func_enter ();
	func_enter ();


	tty_insert_flip_char(port->tty, 0, TTY_BREAK);
	tty_insert_flip_char(port->port.tty, 0, TTY_BREAK);
	tty_schedule_flip(port->tty);
	tty_schedule_flip(port->port.tty);
	if (port->flags & ASYNC_SAK) {
	if (port->port.flags & ASYNC_SAK) {
		do_SAK (port->tty);
		do_SAK (port->port.tty);
	}
	}


	func_exit ();
	func_exit ();
+10 −10
Original line number Original line Diff line number Diff line
@@ -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)
	 * 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)
	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)
	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)


	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)
		/*
		/*
		 * 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. */
+5 −5
Original line number Original line Diff line number Diff line
@@ -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
							 ** 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
						 */
						 */
						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");
						}
						}
+5 −5
Original line number Original line Diff line number Diff line
@@ -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)
	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)
			 ** 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)
			 ** 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)


	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;
+1 −1
Original line number Original line Diff line number Diff line
@@ -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);


Loading