mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-09 16:12:21 +00:00
earlycon: Use common framework for earlycon declarations
Use a single common table of struct earlycon_id for both command line and devicetree. Re-define OF_EARLYCON_DECLARE() macro to instance a unique earlycon declaration (the declaration is only guaranteed to be unique within a compilation unit; separate compilation units must still use unique earlycon names). The semantics of OF_EARLYCON_DECLARE() is different; it declares an earlycon which can matched either on the command line or by devicetree. EARLYCON_DECLARE() is semantically unchanged; it declares an earlycon which is matched by command line only. Remove redundant instances of EARLYCON_DECLARE(). This enables all earlycons to properly initialize struct console with the appropriate name and index, which improves diagnostics and enables direct earlycon-to-console handoff. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8477614d9f
commit
2eaa790989
9 changed files with 23 additions and 41 deletions
|
@ -342,22 +342,26 @@ struct earlycon_device {
|
|||
|
||||
struct earlycon_id {
|
||||
char name[16];
|
||||
char compatible[128];
|
||||
int (*setup)(struct earlycon_device *, const char *options);
|
||||
} __aligned(32);
|
||||
|
||||
extern const struct earlycon_id __earlycon_table[];
|
||||
extern const struct earlycon_id __earlycon_table_end[];
|
||||
|
||||
#define OF_EARLYCON_DECLARE(_name, compat, fn) \
|
||||
static const struct earlycon_id __UNIQUE_ID(__earlycon_##_name) \
|
||||
__used __section(__earlycon_table) \
|
||||
= { .name = __stringify(_name), \
|
||||
.compatible = compat, \
|
||||
.setup = fn }
|
||||
|
||||
#define EARLYCON_DECLARE(_name, fn) OF_EARLYCON_DECLARE(_name, "", fn)
|
||||
|
||||
extern int setup_earlycon(char *buf);
|
||||
extern int of_setup_earlycon(unsigned long addr,
|
||||
int (*setup)(struct earlycon_device *, const char *));
|
||||
|
||||
#define EARLYCON_DECLARE(_name, func) \
|
||||
static const struct earlycon_id __earlycon_##_name \
|
||||
__used __section(__earlycon_table) \
|
||||
= { .name = __stringify(_name), \
|
||||
.setup = func }
|
||||
|
||||
#define OF_EARLYCON_DECLARE(name, compat, fn) \
|
||||
_OF_DECLARE(earlycon, name, compat, fn, void *)
|
||||
|
||||
struct uart_port *uart_get_console(struct uart_port *ports, int nr,
|
||||
struct console *c);
|
||||
int uart_parse_earlycon(char *p, unsigned char *iotype, unsigned long *addr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue