linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	Tony Lindgren <tony@atomide.com>, Felipe Balbi <balbi@ti.com>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 1/5] tty: serial: 8250 core: provide a function to export uart_8250_port
Date: Wed, 16 Jul 2014 16:44:59 +0200	[thread overview]
Message-ID: <1405521903-5877-2-git-send-email-bigeasy@linutronix.de> (raw)
In-Reply-To: <1405521903-5877-1-git-send-email-bigeasy@linutronix.de>

There is no access to access a struct uart_8250_port for a specific
line. This is only required outside of the 8250/uart callbacks like for
devices' suspend & remove callbacks. For those the 8250-core provides
wrapper like serial8250_unregister_port() which passes the struct
to the proper function based on the line argument.

For runtime suspend I need access to this struct not only to make
serial_out() work but also to properly restore up->ier and up->mcr.

Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/tty/serial/8250/8250.h      |  2 ++
 drivers/tty/serial/8250/8250_core.c | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 1ebf853..34c3cd1 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -110,6 +110,8 @@ static inline void serial_dl_write(struct uart_8250_port *up, int value)
 	up->dl_write(up, value);
 }
 
+struct uart_8250_port *serial8250_get_port(int line);
+
 #if defined(__alpha__) && !defined(CONFIG_PCI)
 /*
  * Digital did something really horribly wrong with the OUT1 and OUT2
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 7a91c6d..5a6af19 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -2755,6 +2755,24 @@ static struct uart_ops serial8250_pops = {
 
 static struct uart_8250_port serial8250_ports[UART_NR];
 
+/**
+ * serial8250_get_port - retrieve struct uart_8250_port
+ * @line: serial line number
+ *
+ * This function retrieves struct uart_8250_port for the specific line.
+ * This struct *must* *not* be used to perform a 8250 or serial core operation
+ * which is not accessible otherwise. Its only purpose is to make the struct
+ * accessible to the runtime-pm callbacks for context suspend/restore.
+ * The lock assumption made here is none because runtime-pm suspend/resume
+ * callbacks should not be invoked if there is any operation performed on the
+ * port.
+ */
+struct uart_8250_port *serial8250_get_port(int line)
+{
+	return &serial8250_ports[line];
+}
+EXPORT_SYMBOL_GPL(serial8250_get_port);
+
 static void (*serial8250_isa_config)(int port, struct uart_port *up,
 	unsigned short *capabilities);
 
-- 
2.0.1


  reply	other threads:[~2014-07-16 14:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16 14:44 [PATCH v4] 8250-core based serial driver for OMAP Sebastian Andrzej Siewior
2014-07-16 14:44 ` Sebastian Andrzej Siewior [this message]
2014-07-16 14:45 ` [PATCH 2/5] tty: serial: 8250 core: allow to overwrite & export serial8250_startup() Sebastian Andrzej Siewior
2014-07-16 14:45 ` [PATCH 3/5] tty: serial: 8250 core: allow to set ->throttle / ->unthrottle callbacks Sebastian Andrzej Siewior
2014-07-16 14:45 ` [PATCH 4/5] tty: serial: 8250 core: add runtime pm Sebastian Andrzej Siewior
2014-07-16 15:16   ` Felipe Balbi
2014-07-16 15:54     ` Sebastian Andrzej Siewior
2014-07-16 16:06       ` Felipe Balbi
2014-07-16 16:40         ` Sebastian Andrzej Siewior
2014-07-16 16:46           ` Felipe Balbi
2014-07-17 15:31         ` Peter Hurley
2014-07-17 15:43           ` Sebastian Andrzej Siewior
2014-07-17 16:02             ` Felipe Balbi
2014-07-17 16:06               ` Sebastian Andrzej Siewior
2014-07-17 16:18                 ` Felipe Balbi
2014-07-18  8:35                   ` Sebastian Andrzej Siewior
2014-07-18 15:31                     ` Felipe Balbi
2014-07-18 15:53                       ` Peter Hurley
2014-07-18 16:02                         ` Felipe Balbi
2014-07-16 14:45 ` [PATCH 5/5] tty: serial: Add 8250-core based omap driver Sebastian Andrzej Siewior
2014-07-17  7:09   ` Tony Lindgren
2014-07-17  7:42     ` Sebastian Andrzej Siewior
2014-07-17  8:12       ` Tony Lindgren
2014-07-17 10:06         ` Sebastian Andrzej Siewior
2014-07-18  6:24           ` Tony Lindgren
2014-07-21  9:35             ` Tony Lindgren
2014-08-13 16:20               ` Sebastian Andrzej Siewior
2014-08-13 16:37                 ` Tony Lindgren
2014-07-17 14:54   ` Felipe Balbi
2014-07-17 15:11     ` Sebastian Andrzej Siewior
2014-07-17 16:04       ` Felipe Balbi

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=1405521903-5877-2-git-send-email-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=tony@atomide.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).