* [PATCH 1/2] device: Add dev_of_node() accessor
@ 2015-02-16 3:59 Benjamin Herrenschmidt
2015-02-18 1:03 ` Rob Herring
0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2015-02-16 3:59 UTC (permalink / raw)
To: Rob Herring
Cc: Grant Likely, Olof Johansson,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Arnd Bergmann
Suggested by Arnd Bergmann, this gives a practical accessor for
the of_node field of struct device while instructing the compiler
that it will be NULL if CONFIG_OF is not set.
Signed-off-by: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
---
This is what we discussed back in November and I had forgotten
to finish :)
include/linux/device.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/device.h b/include/linux/device.h
index fb50673..08128288 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -916,6 +916,13 @@ static inline void device_lock_assert(struct device *dev)
lockdep_assert_held(&dev->mutex);
}
+static inline struct device_node *dev_of_node(struct device *dev)
+{
+ if (!IS_ENABLED(CONFIG_OF))
+ return NULL;
+ return dev->of_node;
+}
+
void driver_init(void);
/*
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] device: Add dev_of_node() accessor
2015-02-16 3:59 [PATCH 1/2] device: Add dev_of_node() accessor Benjamin Herrenschmidt
@ 2015-02-18 1:03 ` Rob Herring
0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2015-02-18 1:03 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Greg Kroah-Hartman
Cc: Grant Likely, Olof Johansson, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Arnd Bergmann
+Greg KH
On Sun, Feb 15, 2015 at 9:59 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> Suggested by Arnd Bergmann, this gives a practical accessor for
> the of_node field of struct device while instructing the compiler
> that it will be NULL if CONFIG_OF is not set.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
I'll let Greg take this with the other patch:
Acked-by: Rob Herring <robh@kernel.org>
>
> This is what we discussed back in November and I had forgotten
> to finish :)
>
> include/linux/device.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/include/linux/device.h b/include/linux/device.h
> index fb50673..08128288 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -916,6 +916,13 @@ static inline void device_lock_assert(struct device *dev)
> lockdep_assert_held(&dev->mutex);
> }
>
> +static inline struct device_node *dev_of_node(struct device *dev)
> +{
> + if (!IS_ENABLED(CONFIG_OF))
> + return NULL;
> + return dev->of_node;
> +}
> +
> void driver_init(void);
>
> /*
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-18 1:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-16 3:59 [PATCH 1/2] device: Add dev_of_node() accessor Benjamin Herrenschmidt
2015-02-18 1:03 ` Rob Herring
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).