[v4,4/9] driver core: Let dev_of_node() accept a NULL dev
diff mbox series

Message ID 20190412183150.102131-5-sboyd@kernel.org
State New, archived
Headers show
Series
  • Rewrite clk parent handling
Related show

Commit Message

Stephen Boyd April 12, 2019, 6:31 p.m. UTC
We'd like to chain this in places where the 'dev' argument might be
NULL. Let this function take a NULL 'dev' so this can work.

Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Jeffrey Hugo <jhugo@codeaurora.org>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---

Please ack/review so I can take this through clk tree.

 include/linux/device.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg KH April 16, 2019, 1:29 p.m. UTC | #1
On Fri, Apr 12, 2019 at 11:31:45AM -0700, Stephen Boyd wrote:
> We'd like to chain this in places where the 'dev' argument might be
> NULL. Let this function take a NULL 'dev' so this can work.
> 
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: Jeffrey Hugo <jhugo@codeaurora.org>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Rob Herring <robh@kernel.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---
> 
> Please ack/review so I can take this through clk tree.
> 
>  include/linux/device.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/device.h b/include/linux/device.h
> index b425a7ee04ce..0370dd0b3ae7 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -1231,7 +1231,7 @@ static inline void device_lock_assert(struct device *dev)
>  
>  static inline struct device_node *dev_of_node(struct device *dev)
>  {
> -	if (!IS_ENABLED(CONFIG_OF))
> +	if (!IS_ENABLED(CONFIG_OF) || !dev)
>  		return NULL;
>  	return dev->of_node;
>  }

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stephen Boyd April 19, 2019, 10:12 p.m. UTC | #2
Quoting Stephen Boyd (2019-04-12 11:31:45)
> We'd like to chain this in places where the 'dev' argument might be
> NULL. Let this function take a NULL 'dev' so this can work.
> 
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: Jeffrey Hugo <jhugo@codeaurora.org>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Rob Herring <robh@kernel.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---

Applied to clk-next

Patch
diff mbox series

diff --git a/include/linux/device.h b/include/linux/device.h
index b425a7ee04ce..0370dd0b3ae7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1231,7 +1231,7 @@  static inline void device_lock_assert(struct device *dev)
 
 static inline struct device_node *dev_of_node(struct device *dev)
 {
-	if (!IS_ENABLED(CONFIG_OF))
+	if (!IS_ENABLED(CONFIG_OF) || !dev)
 		return NULL;
 	return dev->of_node;
 }