LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Rob Herring <robh@kernel.org>,
Jiri Slaby <jslaby@suse.cz>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH -next 11/13] serial: earlycon: Refactor earlycon registration
Date: Tue, 24 Feb 2015 11:37:08 -0500 [thread overview]
Message-ID: <1424795830-31223-12-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1424795830-31223-1-git-send-email-peter@hurleysoftware.com>
Separate earlycon matching from registration; add register_earlycon
which initializes and registers the matched earlycon.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/serial/earlycon.c | 42 +++++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 17 deletions(-)
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 025ea01..9fb76b6 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -96,27 +96,13 @@ static int __init parse_options(struct earlycon_device *device, char *options)
return 0;
}
-int __init setup_earlycon(char *buf, const char *match,
- int (*setup)(struct earlycon_device *, const char *))
+
+static int __init
+register_earlycon(char *buf, int (*setup)(struct earlycon_device *, const char *))
{
int err;
- size_t len;
struct uart_port *port = &early_console_dev.port;
- if (!buf || !match || !setup)
- return 0;
-
- len = strlen(match);
- if (strncmp(buf, match, len))
- return 0;
-
- if (buf[len]) {
- if (buf[len] != ',')
- return 0;
- buf += len + 1;
- } else
- buf = NULL;
-
/* On parsing error, pass the options buf to the setup function */
if (buf && !parse_options(&early_console_dev, buf))
buf = NULL;
@@ -136,6 +122,28 @@ int __init setup_earlycon(char *buf, const char *match,
return 0;
}
+int __init setup_earlycon(char *buf, const char *match,
+ int (*setup)(struct earlycon_device *, const char *))
+{
+ size_t len;
+
+ if (!buf || !match || !setup)
+ return 0;
+
+ len = strlen(match);
+ if (strncmp(buf, match, len))
+ return 0;
+
+ if (buf[len]) {
+ if (buf[len] != ',')
+ return 0;
+ buf += len + 1;
+ } else
+ buf = NULL;
+
+ return register_earlycon(buf, setup);
+}
+
int __init of_setup_earlycon(unsigned long addr,
int (*setup)(struct earlycon_device *, const char *))
{
--
2.3.0
next prev parent reply other threads:[~2015-02-24 16:38 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 16:36 [PATCH -next 00/13] Extensible console matching & direct earlycon Peter Hurley
2015-02-24 16:36 ` [PATCH -next 01/13] serial: earlycon: Refactor parse_options into serial core Peter Hurley
2015-02-25 13:03 ` Peter Hurley
2015-02-24 16:36 ` [PATCH -next 02/13] console: Preserve index after console setup() Peter Hurley
2015-02-24 16:37 ` [PATCH -next 03/13] console: Add extensible console matching Peter Hurley
2015-02-28 17:18 ` Peter Hurley
2015-02-24 16:37 ` [PATCH -next 04/13] serial: core: Fix kernel doc for uart_console_write() Peter Hurley
2015-02-24 16:37 ` [PATCH -next 05/13] serial: 8250_early: Remove early_device variable Peter Hurley
2015-02-24 16:37 ` [PATCH -next 06/13] serial: earlycon: Move ->uartclk initialize Peter Hurley
2015-02-24 16:37 ` [PATCH -next 07/13] serial: 8250_early: Assume uart already initialized if no baud option Peter Hurley
2015-02-24 16:37 ` [PATCH -next 08/13] serial: 8250_early: Fix setup() error code Peter Hurley
2015-02-24 16:37 ` [PATCH -next 09/13] serial: earlycon: Ignore parse_options() " Peter Hurley
2015-02-24 16:37 ` [PATCH -next 10/13] serial: earlycon: Allow earlycon params with name only Peter Hurley
2015-02-24 16:37 ` Peter Hurley [this message]
2015-02-24 16:37 ` [PATCH -next 12/13] serial: earlycon: Enable earlycon without command line param Peter Hurley
2015-02-24 16:37 ` [PATCH -next 13/13] serial: 8250_early: Remove setup_early_serial8250_console() Peter Hurley
2015-02-24 19:27 ` [PATCH -next 00/13] Extensible console matching & direct earlycon Rob Herring
2015-02-24 19:53 ` Peter Hurley
2015-02-24 20:20 ` Rob Herring
2015-02-26 14:48 ` Peter Hurley
2015-02-26 14:58 ` Rob Herring
2015-02-26 15:54 ` Peter Hurley
2015-02-26 16:09 ` Rob Herring
2015-03-01 17:40 ` Peter Hurley
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=1424795830-31223-12-git-send-email-peter@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=robh@kernel.org \
--subject='Re: [PATCH -next 11/13] serial: earlycon: Refactor earlycon registration' \
/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
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).