* [PATCH v5] linux,stdout-path helper
@ 2012-11-21 15:53 Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
2013-07-23 14:17 ` [PATCH v5] linux,stdout-path helper Sascha Hauer
0 siblings, 2 replies; 13+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21 15:53 UTC (permalink / raw)
To: linux-arm-kernel
The following adds a helper for matching the linux,stdout-path property
in the chosen node and makes use of it in the i.MX serial and Atmel serial driver.
changes since v4:
- add option support and check stdout-path too
changes since v3:
- move code from separate files to drivers/of/base.c and include/linux/of.h
changes since v2:
- move helper to OF core and make it independent of serial devices
changes since v1:
- move it out of the i.MX serial driver and make it generic for serial
devices.
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss at lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] OF: Add helper for matching against linux,stdout-path
2012-11-21 15:53 [PATCH v5] linux,stdout-path helper Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-21 15:57 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 2/4] serial: i.MX: Make console support non optional Jean-Christophe PLAGNIOL-VILLARD
` (4 more replies)
2013-07-23 14:17 ` [PATCH v5] linux,stdout-path helper Sascha Hauer
1 sibling, 5 replies; 13+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21 15:57 UTC (permalink / raw)
To: linux-arm-kernel
From: Sascha Hauer <s.hauer@pengutronix.de>
devicetrees may have a linux,stdout-path or stdout-path property
in the chosen node describing the console device. This adds a helper
function to match a device against this property and retrieve the options
so a driver can call add_preferred_console for a matching device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-serial at vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: kernel at pengutronix.de
Cc: Alan Cox <alan@linux.intel.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
drivers/of/base.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
include/linux/of.h | 7 +++++++
2 files changed, 53 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index f2f63c8..72c49ce 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1470,3 +1470,49 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
return curv;
}
EXPORT_SYMBOL_GPL(of_prop_next_string);
+
+/**
+ * of_device_is_stdout_path - check if a device node matches the
+ * linux,stdout-path property
+ * @np: Pointer to the given device_node
+ * @option: parsed option
+ *
+ * Check if this device node matches the linux,stdout-path property
+ * in the chosen node. return true if yes, false otherwise.
+ */
+int of_device_is_stdout_path(struct device_node *dn, char **option)
+{
+ const char *name;
+ struct device_node *dn_stdout;
+ bool is_stdout = 0;
+ const char *tmp;
+ const char *tmp_option;
+
+ name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+ if (name == NULL)
+ name = of_get_property(of_chosen, "stdout-path", NULL);
+
+ if (name == NULL)
+ return 0;
+
+ tmp_option = strchr(name, ':');
+
+ tmp = kstrndup(name, strlen(name) - strlen(tmp_option), GFP_KERNEL);
+ if (!tmp)
+ return 0;
+
+ dn_stdout = of_find_node_by_path(tmp);
+
+ if (dn_stdout && dn_stdout == dn) {
+ is_stdout = 1;
+ tmp_option++;
+ *option = kstrdup(tmp_option, GFP_KERNEL);
+ }
+
+ of_node_put(dn_stdout);
+
+ kfree(tmp);
+
+ return is_stdout;
+}
+EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
diff --git a/include/linux/of.h b/include/linux/of.h
index 681a6c8..6a82e3f 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -323,6 +323,8 @@ const char *of_prop_next_string(struct property *prop, const char *cur);
s; \
s = of_prop_next_string(prop, s))
+int of_device_is_stdout_path(struct device_node *dn, char **option);
+
#else /* CONFIG_OF */
static inline const char* of_node_full_name(struct device_node *np)
@@ -450,6 +452,11 @@ static inline int of_machine_is_compatible(const char *compat)
return 0;
}
+static inline int of_device_is_stdout_path(struct device_node *dn, char **option)
+{
+ return 0;
+}
+
#define of_match_ptr(_ptr) NULL
#define of_match_node(_matches, _node) NULL
#define of_property_for_each_u32(np, propname, prop, p, u) \
--
1.7.10.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/4] serial: i.MX: Make console support non optional
2012-11-21 15:57 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-21 15:57 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 3/4] serial: i.MX: evaluate linux,stdout-path property Jean-Christophe PLAGNIOL-VILLARD
` (3 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21 15:57 UTC (permalink / raw)
To: linux-arm-kernel
From: Sascha Hauer <s.hauer@pengutronix.de>
Traditionally console support is optional for serial drivers. This
makes it non optional for the i.MX driver since it's not worth
asking questions for a feature virtually every user of this driver
wants to have.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-serial at vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: kernel at pengutronix.de
Cc: Alan Cox <alan@linux.intel.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
drivers/tty/serial/Kconfig | 16 +---------------
drivers/tty/serial/imx.c | 8 +-------
2 files changed, 2 insertions(+), 22 deletions(-)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index b176801..10e5eec 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -541,26 +541,12 @@ config SERIAL_IMX
bool "IMX serial port support"
depends on ARCH_MXC
select SERIAL_CORE
+ select SERIAL_CORE_CONSOLE
select RATIONAL
help
If you have a machine based on a Motorola IMX CPU you
can enable its onboard serial port by enabling this option.
-config SERIAL_IMX_CONSOLE
- bool "Console on IMX serial port"
- depends on SERIAL_IMX
- select SERIAL_CORE_CONSOLE
- help
- If you have enabled the serial port on the Motorola IMX
- CPU you can make it the console by answering Y to this option.
-
- Even if you say Y here, the currently visible virtual console
- (/dev/tty0) will still be used as the system console by default, but
- you can alter that using a kernel command line option such as
- "console=ttySA0". (Try "man bootparam" or see the documentation of
- your boot loader (lilo or loadlin) about how to pass options to the
- kernel at boot time.)
-
config SERIAL_UARTLITE
tristate "Xilinx uartlite serial port support"
depends on PPC32 || MICROBLAZE || MFD_TIMBERDALE
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 5981912..07a8ca1 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1192,7 +1192,6 @@ static struct uart_ops imx_pops = {
static struct imx_port *imx_ports[UART_NR];
-#ifdef CONFIG_SERIAL_IMX_CONSOLE
static void imx_console_putchar(struct uart_port *port, int ch)
{
struct imx_port *sport = (struct imx_port *)port;
@@ -1348,11 +1347,6 @@ static struct console imx_console = {
.data = &imx_reg,
};
-#define IMX_CONSOLE &imx_console
-#else
-#define IMX_CONSOLE NULL
-#endif
-
static struct uart_driver imx_reg = {
.owner = THIS_MODULE,
.driver_name = DRIVER_NAME,
@@ -1360,7 +1354,7 @@ static struct uart_driver imx_reg = {
.major = SERIAL_IMX_MAJOR,
.minor = MINOR_START,
.nr = ARRAY_SIZE(imx_ports),
- .cons = IMX_CONSOLE,
+ .cons = &imx_console,
};
static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/4] serial: i.MX: evaluate linux,stdout-path property
2012-11-21 15:57 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 2/4] serial: i.MX: Make console support non optional Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-21 15:57 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 4/4] tty: Atmel serial: add linux,stdout-path support Jean-Christophe PLAGNIOL-VILLARD
` (2 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21 15:57 UTC (permalink / raw)
To: linux-arm-kernel
From: Sascha Hauer <s.hauer@pengutronix.de>
devicetrees may have the linux,stdout-path property to specify the
console. This patch adds support to the i.MX serial driver for this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-serial at vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: kernel at pengutronix.de
Cc: Alan Cox <alan@linux.intel.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
drivers/tty/serial/imx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 07a8ca1..28a3193 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1398,6 +1398,7 @@ static int serial_imx_probe_dt(struct imx_port *sport,
struct device_node *np = pdev->dev.of_node;
const struct of_device_id *of_id =
of_match_device(imx_uart_dt_ids, &pdev->dev);
+ char *option = NULL;
int ret;
if (!np)
@@ -1419,6 +1420,9 @@ static int serial_imx_probe_dt(struct imx_port *sport,
sport->devdata = of_id->data;
+ if (of_device_is_stdout_path(np, &option))
+ add_preferred_console(imx_reg.cons->name, sport->port.line, option);
+
return 0;
}
#else
--
1.7.10.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/4] tty: Atmel serial: add linux,stdout-path support
2012-11-21 15:57 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 2/4] serial: i.MX: Make console support non optional Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 3/4] serial: i.MX: evaluate linux,stdout-path property Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-21 15:57 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 17:26 ` [PATCH 1/4] OF: Add helper for matching against linux, stdout-path Sascha Hauer
2012-11-21 18:03 ` Grant Likely
4 siblings, 0 replies; 13+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21 15:57 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-serial at vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: kernel at pengutronix.de
Cc: Alan Cox <alan@linux.intel.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
drivers/tty/serial/atmel_serial.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 5608b6b..f62a3c3 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1427,6 +1427,7 @@ static struct uart_ops atmel_pops = {
static void __devinit atmel_of_init_port(struct atmel_uart_port *atmel_port,
struct device_node *np)
{
+ char *option = NULL;
u32 rs485_delay[2];
/* DMA/PDC usage specification */
@@ -1453,6 +1454,10 @@ static void __devinit atmel_of_init_port(struct atmel_uart_port *atmel_port,
if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL))
rs485conf->flags |= SER_RS485_ENABLED;
+ } else if (of_device_is_stdout_path(np, &option)) {
+ pr_info("add preferred console %s%d option=%s\n",
+ ATMEL_DEVICENAME, atmel_port->uart.line, option);
+ add_preferred_console(ATMEL_DEVICENAME, atmel_port->uart.line, option);
}
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 1/4] OF: Add helper for matching against linux, stdout-path
2012-11-21 15:57 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
` (2 preceding siblings ...)
2012-11-21 15:57 ` [PATCH 4/4] tty: Atmel serial: add linux,stdout-path support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-21 17:26 ` Sascha Hauer
2012-11-22 5:33 ` Lothar Waßmann
2012-11-21 18:03 ` Grant Likely
4 siblings, 1 reply; 13+ messages in thread
From: Sascha Hauer @ 2012-11-21 17:26 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Nov 21, 2012 at 04:57:05PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
>
> devicetrees may have a linux,stdout-path or stdout-path property
> in the chosen node describing the console device. This adds a helper
> function to match a device against this property and retrieve the options
> so a driver can call add_preferred_console for a matching device.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: linux-serial at vger.kernel.org
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: kernel at pengutronix.de
> Cc: Alan Cox <alan@linux.intel.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/of/base.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> include/linux/of.h | 7 +++++++
> 2 files changed, 53 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index f2f63c8..72c49ce 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1470,3 +1470,49 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
> return curv;
> }
> EXPORT_SYMBOL_GPL(of_prop_next_string);
> +
> +/**
> + * of_device_is_stdout_path - check if a device node matches the
> + * linux,stdout-path property
> + * @np: Pointer to the given device_node
> + * @option: parsed option
> + *
> + * Check if this device node matches the linux,stdout-path property
> + * in the chosen node. return true if yes, false otherwise.
> + */
> +int of_device_is_stdout_path(struct device_node *dn, char **option)
> +{
> + const char *name;
> + struct device_node *dn_stdout;
> + bool is_stdout = 0;
> + const char *tmp;
> + const char *tmp_option;
> +
> + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> + if (name == NULL)
> + name = of_get_property(of_chosen, "stdout-path", NULL);
> +
> + if (name == NULL)
> + return 0;
> +
> + tmp_option = strchr(name, ':');
> +
> + tmp = kstrndup(name, strlen(name) - strlen(tmp_option), GFP_KERNEL);
tmp_option may be NULL.
> + if (!tmp)
> + return 0;
> +
> + dn_stdout = of_find_node_by_path(tmp);
> +
> + if (dn_stdout && dn_stdout == dn) {
> + is_stdout = 1;
> + tmp_option++;
> + *option = kstrdup(tmp_option, GFP_KERNEL);
> + }
> +
> + of_node_put(dn_stdout);
dn_stdout may be NULL aswell.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] OF: Add helper for matching against linux, stdout-path
2012-11-21 15:57 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
` (3 preceding siblings ...)
2012-11-21 17:26 ` [PATCH 1/4] OF: Add helper for matching against linux, stdout-path Sascha Hauer
@ 2012-11-21 18:03 ` Grant Likely
2012-11-22 5:41 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
4 siblings, 1 reply; 13+ messages in thread
From: Grant Likely @ 2012-11-21 18:03 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Nov 21, 2012 at 3:57 PM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
>
> devicetrees may have a linux,stdout-path or stdout-path property
> in the chosen node describing the console device. This adds a helper
> function to match a device against this property and retrieve the options
> so a driver can call add_preferred_console for a matching device.
NIce. Looks like the right behaviour, but is a little inefficient.
Since the stdout property doesn't change this code could be called
once right after the tree is unflattened and then cache the pointer to
the node and arguments. Can you add the code to of_alias_scan()?
g.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: linux-serial at vger.kernel.org
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: kernel at pengutronix.de
> Cc: Alan Cox <alan@linux.intel.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/of/base.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> include/linux/of.h | 7 +++++++
> 2 files changed, 53 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index f2f63c8..72c49ce 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1470,3 +1470,49 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
> return curv;
> }
> EXPORT_SYMBOL_GPL(of_prop_next_string);
> +
> +/**
> + * of_device_is_stdout_path - check if a device node matches the
> + * linux,stdout-path property
> + * @np: Pointer to the given device_node
> + * @option: parsed option
> + *
> + * Check if this device node matches the linux,stdout-path property
> + * in the chosen node. return true if yes, false otherwise.
> + */
> +int of_device_is_stdout_path(struct device_node *dn, char **option)
> +{
> + const char *name;
> + struct device_node *dn_stdout;
> + bool is_stdout = 0;
> + const char *tmp;
> + const char *tmp_option;
> +
> + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> + if (name == NULL)
> + name = of_get_property(of_chosen, "stdout-path", NULL);
> +
> + if (name == NULL)
> + return 0;
> +
> + tmp_option = strchr(name, ':');
> +
> + tmp = kstrndup(name, strlen(name) - strlen(tmp_option), GFP_KERNEL);
> + if (!tmp)
> + return 0;
> +
> + dn_stdout = of_find_node_by_path(tmp);
> +
> + if (dn_stdout && dn_stdout == dn) {
> + is_stdout = 1;
> + tmp_option++;
> + *option = kstrdup(tmp_option, GFP_KERNEL);
> + }
> +
> + of_node_put(dn_stdout);
> +
> + kfree(tmp);
> +
> + return is_stdout;
> +}
> +EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 681a6c8..6a82e3f 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -323,6 +323,8 @@ const char *of_prop_next_string(struct property *prop, const char *cur);
> s; \
> s = of_prop_next_string(prop, s))
>
> +int of_device_is_stdout_path(struct device_node *dn, char **option);
> +
> #else /* CONFIG_OF */
>
> static inline const char* of_node_full_name(struct device_node *np)
> @@ -450,6 +452,11 @@ static inline int of_machine_is_compatible(const char *compat)
> return 0;
> }
>
> +static inline int of_device_is_stdout_path(struct device_node *dn, char **option)
> +{
> + return 0;
> +}
> +
> #define of_match_ptr(_ptr) NULL
> #define of_match_node(_matches, _node) NULL
> #define of_property_for_each_u32(np, propname, prop, p, u) \
> --
> 1.7.10.4
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] OF: Add helper for matching against linux, stdout-path
2012-11-21 17:26 ` [PATCH 1/4] OF: Add helper for matching against linux, stdout-path Sascha Hauer
@ 2012-11-22 5:33 ` Lothar Waßmann
0 siblings, 0 replies; 13+ messages in thread
From: Lothar Waßmann @ 2012-11-22 5:33 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
Sascha Hauer writes:
> On Wed, Nov 21, 2012 at 04:57:05PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> >
> > devicetrees may have a linux,stdout-path or stdout-path property
> > in the chosen node describing the console device. This adds a helper
> > function to match a device against this property and retrieve the options
> > so a driver can call add_preferred_console for a matching device.
> >
[...]
> > + if (!tmp)
> > + return 0;
> > +
> > + dn_stdout = of_find_node_by_path(tmp);
> > +
> > + if (dn_stdout && dn_stdout == dn) {
> > + is_stdout = 1;
> > + tmp_option++;
> > + *option = kstrdup(tmp_option, GFP_KERNEL);
> > + }
> > +
> > + of_node_put(dn_stdout);
>
> dn_stdout may be NULL aswell.
>
which is handled gracefully by of_node_put()...
Lothar Wa?mann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] OF: Add helper for matching against linux,stdout-path
2012-11-21 18:03 ` Grant Likely
@ 2012-11-22 5:41 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-22 15:31 ` [PATCH 1/4] OF: Add helper for matching against linux, stdout-path Grant Likely
0 siblings, 1 reply; 13+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-22 5:41 UTC (permalink / raw)
To: linux-arm-kernel
On 18:03 Wed 21 Nov , Grant Likely wrote:
> On Wed, Nov 21, 2012 at 3:57 PM, Jean-Christophe PLAGNIOL-VILLARD
> <plagnioj@jcrosoft.com> wrote:
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> >
> > devicetrees may have a linux,stdout-path or stdout-path property
> > in the chosen node describing the console device. This adds a helper
> > function to match a device against this property and retrieve the options
> > so a driver can call add_preferred_console for a matching device.
>
> NIce. Looks like the right behaviour, but is a little inefficient.
> Since the stdout property doesn't change this code could be called
> once right after the tree is unflattened and then cache the pointer to
> the node anarguments. Can you add the code to of_alias_scan()?
do we assume that we can have only one stdout-path?
I think we could have more serial, framebuffer console
Best Regards,
J.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] OF: Add helper for matching against linux, stdout-path
2012-11-22 5:41 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-22 15:31 ` Grant Likely
2012-11-22 19:35 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 13+ messages in thread
From: Grant Likely @ 2012-11-22 15:31 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, 22 Nov 2012 06:41:38 +0100, Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:
> On 18:03 Wed 21 Nov , Grant Likely wrote:
> > On Wed, Nov 21, 2012 at 3:57 PM, Jean-Christophe PLAGNIOL-VILLARD
> > <plagnioj@jcrosoft.com> wrote:
> > > From: Sascha Hauer <s.hauer@pengutronix.de>
> > >
> > > devicetrees may have a linux,stdout-path or stdout-path property
> > > in the chosen node describing the console device. This adds a helper
> > > function to match a device against this property and retrieve the options
> > > so a driver can call add_preferred_console for a matching device.
> >
> > NIce. Looks like the right behaviour, but is a little inefficient.
> > Since the stdout property doesn't change this code could be called
> > once right after the tree is unflattened and then cache the pointer to
> > the node anarguments. Can you add the code to of_alias_scan()?
> do we assume that we can have only one stdout-path?
>
> I think we could have more serial, framebuffer console
Nope. stdout-path as currently defined is only one device. Someone would
need to propose an extension for multiple stdout's before I'd bother
trying to support that.
g.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] OF: Add helper for matching against linux,stdout-path
2012-11-22 15:31 ` [PATCH 1/4] OF: Add helper for matching against linux, stdout-path Grant Likely
@ 2012-11-22 19:35 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-22 21:21 ` [PATCH 1/4] OF: Add helper for matching against linux, stdout-path Grant Likely
0 siblings, 1 reply; 13+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-22 19:35 UTC (permalink / raw)
To: linux-arm-kernel
On 15:31 Thu 22 Nov , Grant Likely wrote:
> On Thu, 22 Nov 2012 06:41:38 +0100, Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:
> > On 18:03 Wed 21 Nov , Grant Likely wrote:
> > > On Wed, Nov 21, 2012 at 3:57 PM, Jean-Christophe PLAGNIOL-VILLARD
> > > <plagnioj@jcrosoft.com> wrote:
> > > > From: Sascha Hauer <s.hauer@pengutronix.de>
> > > >
> > > > devicetrees may have a linux,stdout-path or stdout-path property
> > > > in the chosen node describing the console device. This adds a helper
> > > > function to match a device against this property and retrieve the options
> > > > so a driver can call add_preferred_console for a matching device.
> > >
> > > NIce. Looks like the right behaviour, but is a little inefficient.
> > > Since the stdout property doesn't change this code could be called
> > > once right after the tree is unflattened and then cache the pointer to
> > > the node anarguments. Can you add the code to of_alias_scan()?
> > do we assume that we can have only one stdout-path?
> >
> > I think we could have more serial, framebuffer console
>
> Nope. stdout-path as currently defined is only one device. Someone would
> need to propose an extension for multiple stdout's before I'd bother
> trying to support that.
ok for this version I do not put it but I need it
I want to have 2 console uart and framebuffer
Personnaly I'd just allow multiple instance of stdout-path
what do you prefer
Best Regards,
J.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] OF: Add helper for matching against linux, stdout-path
2012-11-22 19:35 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-22 21:21 ` Grant Likely
0 siblings, 0 replies; 13+ messages in thread
From: Grant Likely @ 2012-11-22 21:21 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Nov 22, 2012 at 7:35 PM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
> On 15:31 Thu 22 Nov , Grant Likely wrote:
>> On Thu, 22 Nov 2012 06:41:38 +0100, Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:
>> > On 18:03 Wed 21 Nov , Grant Likely wrote:
>> > > On Wed, Nov 21, 2012 at 3:57 PM, Jean-Christophe PLAGNIOL-VILLARD
>> > > <plagnioj@jcrosoft.com> wrote:
>> > > > From: Sascha Hauer <s.hauer@pengutronix.de>
>> > > >
>> > > > devicetrees may have a linux,stdout-path or stdout-path property
>> > > > in the chosen node describing the console device. This adds a helper
>> > > > function to match a device against this property and retrieve the options
>> > > > so a driver can call add_preferred_console for a matching device.
>> > >
>> > > NIce. Looks like the right behaviour, but is a little inefficient.
>> > > Since the stdout property doesn't change this code could be called
>> > > once right after the tree is unflattened and then cache the pointer to
>> > > the node anarguments. Can you add the code to of_alias_scan()?
>> > do we assume that we can have only one stdout-path?
>> >
>> > I think we could have more serial, framebuffer console
>>
>> Nope. stdout-path as currently defined is only one device. Someone would
>> need to propose an extension for multiple stdout's before I'd bother
>> trying to support that.
> ok for this version I do not put it but I need it
>
> I want to have 2 console uart and framebuffer
>
> Personnaly I'd just allow multiple instance of stdout-path
Propose a binding extension.
g.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v5] linux,stdout-path helper
2012-11-21 15:53 [PATCH v5] linux,stdout-path helper Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
@ 2013-07-23 14:17 ` Sascha Hauer
1 sibling, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2013-07-23 14:17 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Nov 21, 2012 at 04:53:12PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> The following adds a helper for matching the linux,stdout-path property
> in the chosen node and makes use of it in the i.MX serial and Atmel serial driver.
Seems this got stuck. Jean-Christophe, will you update this series? I
could really make use of this.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-07-23 14:17 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-21 15:53 [PATCH v5] linux,stdout-path helper Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 2/4] serial: i.MX: Make console support non optional Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 3/4] serial: i.MX: evaluate linux,stdout-path property Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 15:57 ` [PATCH 4/4] tty: Atmel serial: add linux,stdout-path support Jean-Christophe PLAGNIOL-VILLARD
2012-11-21 17:26 ` [PATCH 1/4] OF: Add helper for matching against linux, stdout-path Sascha Hauer
2012-11-22 5:33 ` Lothar Waßmann
2012-11-21 18:03 ` Grant Likely
2012-11-22 5:41 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
2012-11-22 15:31 ` [PATCH 1/4] OF: Add helper for matching against linux, stdout-path Grant Likely
2012-11-22 19:35 ` [PATCH 1/4] OF: Add helper for matching against linux,stdout-path Jean-Christophe PLAGNIOL-VILLARD
2012-11-22 21:21 ` [PATCH 1/4] OF: Add helper for matching against linux, stdout-path Grant Likely
2013-07-23 14:17 ` [PATCH v5] linux,stdout-path helper Sascha Hauer
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).