Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1604398 > unrolled thread

[PATCH v2] reset: fix optional reset_control_get stubs to return NULL

Started byPhilipp Zabel <p.zabel@pengutronix.de>
First post2017-03-20 12:20 +0100
Last post2017-03-20 14:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] reset: fix optional reset_control_get stubs to return NULL Philipp Zabel <p.zabel@pengutronix.de> - 2017-03-20 12:20 +0100
    Re: [PATCH v2] reset: fix optional reset_control_get stubs to return  NULL Andrzej Hajda <a.hajda@samsung.com> - 2017-03-20 14:50 +0100

#1604398 — [PATCH v2] reset: fix optional reset_control_get stubs to return NULL

FromPhilipp Zabel <p.zabel@pengutronix.de>
Date2017-03-20 12:20 +0100
Subject[PATCH v2] reset: fix optional reset_control_get stubs to return NULL
Message-ID<tn3vY-3VF-21@gated-at.bofh.it>
When RESET_CONTROLLER is not enabled, the optional reset_control_get
stubs should now also return NULL.

Since it is now valid for reset_control_assert/deassert/reset/status/put
to be called unconditionally, with NULL as an argument for optional
resets, the stubs are not allowed to warn anymore.

Fixes: bb475230b8e5 ("reset: make optional functions really optional")
Reported-by: Andrzej Hajda <a.hajda@samsung.com>
Cc: Ramiro Oliveira <Ramiro.Oliveira@synopsys.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
v2: Dropped WARN_ON(1) from the reset_control_* stubs
---
 include/linux/reset.h | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/include/linux/reset.h b/include/linux/reset.h
index 86b4ed75359e8..96fb139bdd08f 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -31,31 +31,26 @@ static inline int device_reset_optional(struct device *dev)
 
 static inline int reset_control_reset(struct reset_control *rstc)
 {
-	WARN_ON(1);
 	return 0;
 }
 
 static inline int reset_control_assert(struct reset_control *rstc)
 {
-	WARN_ON(1);
 	return 0;
 }
 
 static inline int reset_control_deassert(struct reset_control *rstc)
 {
-	WARN_ON(1);
 	return 0;
 }
 
 static inline int reset_control_status(struct reset_control *rstc)
 {
-	WARN_ON(1);
 	return 0;
 }
 
 static inline void reset_control_put(struct reset_control *rstc)
 {
-	WARN_ON(1);
 }
 
 static inline int __must_check device_reset(struct device *dev)
@@ -74,14 +69,14 @@ static inline struct reset_control *__of_reset_control_get(
 					const char *id, int index, bool shared,
 					bool optional)
 {
-	return ERR_PTR(-ENOTSUPP);
+	return optional ? NULL : ERR_PTR(-ENOTSUPP);
 }
 
 static inline struct reset_control *__devm_reset_control_get(
 					struct device *dev, const char *id,
 					int index, bool shared, bool optional)
 {
-	return ERR_PTR(-ENOTSUPP);
+	return optional ? NULL : ERR_PTR(-ENOTSUPP);
 }
 
 #endif /* CONFIG_RESET_CONTROLLER */
-- 
2.11.0

[toc] | [next] | [standalone]


#1604582 — Re: [PATCH v2] reset: fix optional reset_control_get stubs to return NULL

FromAndrzej Hajda <a.hajda@samsung.com>
Date2017-03-20 14:50 +0100
SubjectRe: [PATCH v2] reset: fix optional reset_control_get stubs to return NULL
Message-ID<tn5R7-5oQ-1@gated-at.bofh.it>
In reply to#1604398
On 20.03.2017 12:17, Philipp Zabel wrote:
> When RESET_CONTROLLER is not enabled, the optional reset_control_get
> stubs should now also return NULL.
>
> Since it is now valid for reset_control_assert/deassert/reset/status/put
> to be called unconditionally, with NULL as an argument for optional
> resets, the stubs are not allowed to warn anymore.
>
> Fixes: bb475230b8e5 ("reset: make optional functions really optional")
> Reported-by: Andrzej Hajda <a.hajda@samsung.com>
> Cc: Ramiro Oliveira <Ramiro.Oliveira@synopsys.com>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

Initially I though about replacing WARN_ON(1) with WARN_ON(rstc), but
maybe it is also OK.    

Tested-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
--
Regards
Andrzej
> ---
> v2: Dropped WARN_ON(1) from the reset_control_* stubs
> ---
>  include/linux/reset.h | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/reset.h b/include/linux/reset.h
> index 86b4ed75359e8..96fb139bdd08f 100644
> --- a/include/linux/reset.h
> +++ b/include/linux/reset.h
> @@ -31,31 +31,26 @@ static inline int device_reset_optional(struct device *dev)
>  
>  static inline int reset_control_reset(struct reset_control *rstc)
>  {
> -	WARN_ON(1);
>  	return 0;
>  }
>  
>  static inline int reset_control_assert(struct reset_control *rstc)
>  {
> -	WARN_ON(1);
>  	return 0;
>  }
>  
>  static inline int reset_control_deassert(struct reset_control *rstc)
>  {
> -	WARN_ON(1);
>  	return 0;
>  }
>  
>  static inline int reset_control_status(struct reset_control *rstc)
>  {
> -	WARN_ON(1);
>  	return 0;
>  }
>  
>  static inline void reset_control_put(struct reset_control *rstc)
>  {
> -	WARN_ON(1);
>  }
>  
>  static inline int __must_check device_reset(struct device *dev)
> @@ -74,14 +69,14 @@ static inline struct reset_control *__of_reset_control_get(
>  					const char *id, int index, bool shared,
>  					bool optional)
>  {
> -	return ERR_PTR(-ENOTSUPP);
> +	return optional ? NULL : ERR_PTR(-ENOTSUPP);
>  }
>  
>  static inline struct reset_control *__devm_reset_control_get(
>  					struct device *dev, const char *id,
>  					int index, bool shared, bool optional)
>  {
> -	return ERR_PTR(-ENOTSUPP);
> +	return optional ? NULL : ERR_PTR(-ENOTSUPP);
>  }
>  
>  #endif /* CONFIG_RESET_CONTROLLER */

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web