[PATCH 7/9] staging/sb105x: use tty_port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use struct tty_port wherever is needed, fixing compilation errors.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@xxxxxxxxxx>
---
 drivers/staging/sb105x/sb_pci_mp.c   |   18 +++++++++++-------
 drivers/staging/sb105x/sb_ser_core.h |    1 +
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/sb105x/sb_pci_mp.c b/drivers/staging/sb105x/sb_pci_mp.c
index 7fa6ef7..deeeed2 100644
--- a/drivers/staging/sb105x/sb_pci_mp.c
+++ b/drivers/staging/sb105x/sb_pci_mp.c
@@ -878,7 +878,7 @@ static int mp_set_info(struct sb_uart_state *state, struct serial_struct *newinf
 	state->closing_wait    = closing_wait;
 	port->fifosize         = new_serial.xmit_fifo_size;
 	if (state->info->tty)
-		state->info->tty->low_latency =
+		port->tty_port.low_latency =
 			(port->flags & UPF_LOW_LATENCY) ? 1 : 0;
 
 check_and_exit:
@@ -1323,6 +1323,7 @@ static void mp_close(struct tty_struct *tty, struct file *filp)
 	mp_shutdown(state);
 	mp_flush_buffer(tty);
 	tty_ldisc_flush(tty);
+	tty_port_close(&state->port->tty_port, tty, filp);
 	tty->closing = 0;
 	state->info->tty = NULL;
 
@@ -1525,7 +1526,7 @@ static int mp_open(struct tty_struct *tty, struct file *filp)
 	mtpt  = (struct mp_port *)state->port;
 
 	tty->driver_data = state;
-	tty->low_latency = (state->port->flags & UPF_LOW_LATENCY) ? 1 : 0;
+	state->port->tty_port.low_latency = (state->port->flags & UPF_LOW_LATENCY) ? 1 : 0;
 	tty->alt_speed = 0;
 	state->info->tty = tty;
 
@@ -1553,6 +1554,7 @@ static int mp_open(struct tty_struct *tty, struct file *filp)
 
 	uart_clear_mctrl(state->port, TIOCM_RTS);
 	try_module_get(THIS_MODULE);
+	retval = tty_port_open(&state->port->tty_port, tty, filp);
 fail:
 	return retval;
 }
@@ -1784,7 +1786,9 @@ static int mp_add_one_port(struct uart_driver *drv, struct sb_uart_port *port)
 
 	mp_configure_port(drv, state, port);
 
-	tty_register_device(drv->tty_driver, port->line, port->dev);
+	tty_port_init(&port->tty_port);
+//	port->tty_port.ops = &mp_tty_port_ops; /* XXX: Need to define tty_port ops */
+	tty_port_register_device(&port->tty_port, port->info->tty->driver, port->line, port->dev);
 
 out:
 	MP_MUTEX_UNLOCK(mp_mutex);
@@ -1804,6 +1808,7 @@ static int mp_remove_one_port(struct uart_driver *drv, struct sb_uart_port *port
 	MP_MUTEX_LOCK(mp_mutex);
 
 	tty_unregister_device(drv->tty_driver, port->line);
+	tty_port_destroy(&port->tty_port);
 
 	mp_unconfigure_port(drv, state);
 	state->port = NULL;
@@ -2009,7 +2014,6 @@ static void multi_enable_ms(struct sb_uart_port *port)
 
 static inline void receive_chars(struct mp_port *mtpt, int *status )
 {
-	struct tty_struct *tty = mtpt->port.info->tty;
 	unsigned char lsr = *status;
 	int max_count = 256;
 	unsigned char ch;
@@ -2044,17 +2048,17 @@ static inline void receive_chars(struct mp_port *mtpt, int *status )
 					mtpt->port.icount.overrun++;
 					flag = TTY_OVERRUN;
 				}
-				tty_insert_flip_char(tty, ch, flag);
+				tty_insert_flip_char(&mtpt->port.tty_port, ch, flag);
 			} else {
 				ch = serial_inp(mtpt, UART_RX);
-				tty_insert_flip_char(tty, ch, 0);
+				tty_insert_flip_char(&mtpt->port.tty_port, ch, 0);
 			}
 		}
 ignore_char:
 		lsr = serial_inp(mtpt, UART_LSR);
 	} while ((lsr & UART_LSR_DR) && (max_count-- > 0));
 
-	tty_flip_buffer_push(tty);
+	tty_flip_buffer_push(&mtpt->port.tty_port);
 }
 
 
diff --git a/drivers/staging/sb105x/sb_ser_core.h b/drivers/staging/sb105x/sb_ser_core.h
index 41111b0..90de931 100644
--- a/drivers/staging/sb105x/sb_ser_core.h
+++ b/drivers/staging/sb105x/sb_ser_core.h
@@ -143,6 +143,7 @@ struct sb_uart_port {
 	struct device		*dev;			/* parent device */
 	unsigned char		hub6;			/* this should be in the 8250 driver */
 	unsigned char		unused[3];
+	struct tty_port         tty_port;
 };
 
 #define mdmode			unused[2]
-- 
1.7.10.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux