From: Rob Herring <robherring2@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de,
devicetree@vger.kernel.org, grant.likely@linaro.org
Subject: Re: [PATCH 1/2] OF: Add helper for matching against linux,stdout-path
Date: Mon, 05 Aug 2013 07:59:01 -0500 [thread overview]
Message-ID: <51FFA195.6080903@gmail.com> (raw)
In-Reply-To: <1375706445-15375-2-git-send-email-s.hauer@pengutronix.de>
On 08/05/2013 07:40 AM, Sascha Hauer wrote:
> devicetrees may have a linux,stdout-path property in the chosen
> node describing the console device. This adds a helper function
> to match a device against this property so a driver can call
> add_preferred_console for a matching device.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Rob Herring <rob.herring@calxeda.com>
There are no existing users that could take advantage of this?
Rob
> ---
> drivers/of/base.c | 26 ++++++++++++++++++++++++++
> include/linux/of.h | 7 +++++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 5c54279..1c3c79c 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -32,6 +32,7 @@ struct device_node *of_allnodes;
> EXPORT_SYMBOL(of_allnodes);
> struct device_node *of_chosen;
> struct device_node *of_aliases;
> +static struct device_node *of_stdout;
>
> DEFINE_MUTEX(of_aliases_mutex);
>
> @@ -1595,6 +1596,15 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
> of_chosen = of_find_node_by_path("/chosen");
> if (of_chosen == NULL)
> of_chosen = of_find_node_by_path("/chosen@0");
> +
> + if (of_chosen) {
> + const char *name;
> +
> + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> + if (name)
> + of_stdout = of_find_node_by_path(name);
> + }
> +
> of_aliases = of_find_node_by_path("/aliases");
> if (!of_aliases)
> return;
> @@ -1703,3 +1713,19 @@ 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
> + *
> + * 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)
> +{
> + if (!of_stdout)
> + return false;
> +
> + return of_stdout == dn;
> +}
> +EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 1fd08ca..429e168 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -343,6 +343,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);
> +
> #else /* CONFIG_OF */
>
> static inline const char* of_node_full_name(struct device_node *np)
> @@ -505,6 +507,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)
> +{
> + 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) \
>
WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] OF: Add helper for matching against linux, stdout-path
Date: Mon, 05 Aug 2013 07:59:01 -0500 [thread overview]
Message-ID: <51FFA195.6080903@gmail.com> (raw)
In-Reply-To: <1375706445-15375-2-git-send-email-s.hauer@pengutronix.de>
On 08/05/2013 07:40 AM, Sascha Hauer wrote:
> devicetrees may have a linux,stdout-path property in the chosen
> node describing the console device. This adds a helper function
> to match a device against this property so a driver can call
> add_preferred_console for a matching device.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Rob Herring <rob.herring@calxeda.com>
There are no existing users that could take advantage of this?
Rob
> ---
> drivers/of/base.c | 26 ++++++++++++++++++++++++++
> include/linux/of.h | 7 +++++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 5c54279..1c3c79c 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -32,6 +32,7 @@ struct device_node *of_allnodes;
> EXPORT_SYMBOL(of_allnodes);
> struct device_node *of_chosen;
> struct device_node *of_aliases;
> +static struct device_node *of_stdout;
>
> DEFINE_MUTEX(of_aliases_mutex);
>
> @@ -1595,6 +1596,15 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
> of_chosen = of_find_node_by_path("/chosen");
> if (of_chosen == NULL)
> of_chosen = of_find_node_by_path("/chosen at 0");
> +
> + if (of_chosen) {
> + const char *name;
> +
> + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> + if (name)
> + of_stdout = of_find_node_by_path(name);
> + }
> +
> of_aliases = of_find_node_by_path("/aliases");
> if (!of_aliases)
> return;
> @@ -1703,3 +1713,19 @@ 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
> + *
> + * 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)
> +{
> + if (!of_stdout)
> + return false;
> +
> + return of_stdout == dn;
> +}
> +EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 1fd08ca..429e168 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -343,6 +343,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);
> +
> #else /* CONFIG_OF */
>
> static inline const char* of_node_full_name(struct device_node *np)
> @@ -505,6 +507,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)
> +{
> + 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) \
>
next prev parent reply other threads:[~2013-08-05 12:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-05 12:40 [PATCH v6] linux,stdout-path helper Sascha Hauer
2013-08-05 12:40 ` Sascha Hauer
2013-08-05 12:40 ` [PATCH 1/2] OF: Add helper for matching against linux,stdout-path Sascha Hauer
2013-08-05 12:40 ` Sascha Hauer
2013-08-05 12:59 ` Rob Herring [this message]
2013-08-05 12:59 ` [PATCH 1/2] OF: Add helper for matching against linux, stdout-path Rob Herring
2013-08-05 13:16 ` [PATCH 1/2] OF: Add helper for matching against linux,stdout-path Sascha Hauer
2013-08-05 13:16 ` Sascha Hauer
2013-08-05 12:40 ` [PATCH 2/2] serial: i.MX: evaluate linux,stdout-path property Sascha Hauer
2013-08-05 12:40 ` Sascha Hauer
2013-08-12 6:04 ` [PATCH v6] linux,stdout-path helper Sascha Hauer
2013-08-12 6:04 ` Sascha Hauer
2013-08-12 6:04 ` Sascha Hauer
2013-08-12 18:22 ` Greg Kroah-Hartman
2013-08-12 18:22 ` Greg Kroah-Hartman
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=51FFA195.6080903@gmail.com \
--to=robherring2@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
/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.