All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Subject: [PATCH 7/9] staging/sb105x: use tty_port
Date: Tue, 19 Mar 2013 10:51:28 +0100	[thread overview]
Message-ID: <1363686690-27090-8-git-send-email-siglesias@igalia.com> (raw)
In-Reply-To: <1363686690-27090-1-git-send-email-siglesias@igalia.com>

Use struct tty_port wherever is needed, fixing compilation errors.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
---
 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


  parent reply	other threads:[~2013-03-19  9:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-19  9:51 [PATCH 0/9] staging/sb105x: minor fixes Samuel Iglesias Gonsalvez
2013-03-19  9:51 ` [PATCH 1/9] staging/sb105x: coding style fixes Samuel Iglesias Gonsalvez
2013-03-19  9:51 ` [PATCH 2/9] staging/sb105x: rename _INLINE_ to inline Samuel Iglesias Gonsalvez
2013-03-19  9:51 ` [PATCH 3/9] staging/sb105x: delete debug printks Samuel Iglesias Gonsalvez
2013-03-19  9:51 ` [PATCH 4/9] staging/sb105x: change some printk to corresponding dev_* Samuel Iglesias Gonsalvez
2013-03-19  9:51 ` [PATCH 5/9] staging/sb105x: change some printk to corresponding pr_* Samuel Iglesias Gonsalvez
2013-03-19  9:51 ` [PATCH 6/9] staging/sb105x: coding style issues Samuel Iglesias Gonsalvez
2013-03-19  9:51 ` Samuel Iglesias Gonsalvez [this message]
2013-03-19  9:51 ` [PATCH 8/9] staging/sb105x: remove BROKEN tag from Kconfig Samuel Iglesias Gonsalvez
2013-03-19  9:51 ` [PATCH 9/9] staging/sb105x: add TODO file Samuel Iglesias Gonsalvez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363686690-27090-8-git-send-email-siglesias@igalia.com \
    --to=siglesias@igalia.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.