All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] pinctrl: change result for unsupported API
@ 2021-07-30 10:12 Patrick Delaunay
  2021-07-30 10:12 ` [PATCH 2/2] dm: add debug message when failed to select the default pinctrl Patrick Delaunay
  2021-07-31 16:59 ` [PATCH 1/2] pinctrl: change result for unsupported API Simon Glass
  0 siblings, 2 replies; 4+ messages in thread
From: Patrick Delaunay @ 2021-07-30 10:12 UTC (permalink / raw)
  To: u-boot; +Cc: Patrick Delaunay, Simon Glass, U-Boot STM32

Use the return value ENOSYS for unsupported API
- pinctrl_generic_set_state
- pinctrl_select_state

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 include/dm/pinctrl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/dm/pinctrl.h b/include/dm/pinctrl.h
index 695e78ad0d..8b869c4fbf 100644
--- a/include/dm/pinctrl.h
+++ b/include/dm/pinctrl.h
@@ -495,7 +495,7 @@ int pinctrl_generic_set_state(struct udevice *pctldev, struct udevice *config);
 static inline int pinctrl_generic_set_state(struct udevice *pctldev,
 					    struct udevice *config)
 {
-	return -EINVAL;
+	return -ENOSYS;
 }
 #endif
 
@@ -512,7 +512,7 @@ int pinctrl_select_state(struct udevice *dev, const char *statename);
 static inline int pinctrl_select_state(struct udevice *dev,
 				       const char *statename)
 {
-	return -EINVAL;
+	return -ENOSYS;
 }
 #endif
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] dm: add debug message when failed to select the default pinctrl
  2021-07-30 10:12 [PATCH 1/2] pinctrl: change result for unsupported API Patrick Delaunay
@ 2021-07-30 10:12 ` Patrick Delaunay
  2021-07-31 16:59   ` Simon Glass
  2021-07-31 16:59 ` [PATCH 1/2] pinctrl: change result for unsupported API Simon Glass
  1 sibling, 1 reply; 4+ messages in thread
From: Patrick Delaunay @ 2021-07-30 10:12 UTC (permalink / raw)
  To: u-boot; +Cc: Patrick Delaunay, Simon Glass, U-Boot STM32

Add a message on probe in driver model core when the default
pinctrl selection failed.

This message is displayed only when the pinctrl API is
implemented, i.e. when result is not ENOSYS.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 drivers/core/device.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 29668f6fb3..6710c847e1 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -532,8 +532,12 @@ int device_probe(struct udevice *dev)
 	 * is set just above. However, the PCI bus' probe() method and
 	 * associated uclass methods have not yet been called.
 	 */
-	if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
-		pinctrl_select_state(dev, "default");
+	if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL) {
+		ret = pinctrl_select_state(dev, "default");
+		if (ret && ret != -ENOSYS)
+			log_debug("Device '%s' failed to configure default pinctrl: %d (%s)\n",
+				  dev->name, ret, errno_str(ret));
+	}
 
 	if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
 	    (device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) &&
@@ -578,8 +582,12 @@ int device_probe(struct udevice *dev)
 	if (ret)
 		goto fail_uclass;
 
-	if (dev->parent && device_get_uclass_id(dev) == UCLASS_PINCTRL)
-		pinctrl_select_state(dev, "default");
+	if (dev->parent && device_get_uclass_id(dev) == UCLASS_PINCTRL) {
+		ret = pinctrl_select_state(dev, "default");
+		if (ret && ret != -ENOSYS)
+			log_debug("Device '%s' failed to configure default pinctrl: %d (%s)\n",
+				  dev->name, ret, errno_str(ret));
+	}
 
 	return 0;
 fail_uclass:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] pinctrl: change result for unsupported API
  2021-07-30 10:12 [PATCH 1/2] pinctrl: change result for unsupported API Patrick Delaunay
  2021-07-30 10:12 ` [PATCH 2/2] dm: add debug message when failed to select the default pinctrl Patrick Delaunay
@ 2021-07-31 16:59 ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-07-31 16:59 UTC (permalink / raw)
  To: Patrick Delaunay; +Cc: U-Boot Mailing List, U-Boot STM32

On Fri, 30 Jul 2021 at 04:12, Patrick Delaunay
<patrick.delaunay@foss.st.com> wrote:
>
> Use the return value ENOSYS for unsupported API
> - pinctrl_generic_set_state
> - pinctrl_select_state
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>  include/dm/pinctrl.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] dm: add debug message when failed to select the default pinctrl
  2021-07-30 10:12 ` [PATCH 2/2] dm: add debug message when failed to select the default pinctrl Patrick Delaunay
@ 2021-07-31 16:59   ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-07-31 16:59 UTC (permalink / raw)
  To: Patrick Delaunay; +Cc: U-Boot Mailing List, U-Boot STM32

On Fri, 30 Jul 2021 at 04:12, Patrick Delaunay
<patrick.delaunay@foss.st.com> wrote:
>
> Add a message on probe in driver model core when the default
> pinctrl selection failed.
>
> This message is displayed only when the pinctrl API is
> implemented, i.e. when result is not ENOSYS.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>  drivers/core/device.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-31 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 10:12 [PATCH 1/2] pinctrl: change result for unsupported API Patrick Delaunay
2021-07-30 10:12 ` [PATCH 2/2] dm: add debug message when failed to select the default pinctrl Patrick Delaunay
2021-07-31 16:59   ` Simon Glass
2021-07-31 16:59 ` [PATCH 1/2] pinctrl: change result for unsupported API Simon Glass

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.