Skip to contentSkip to conversation

pinctrl: change result for unsupported API

PATCH RESEND In review Patrick Delaunay 2 participants 4 messages Nov 19, 2021 – Dec 2, 2021

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/2 pinctrl: change result for unsupported API

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

---

 include/dm/pinctrl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/dm/pinctrl.h +2 -2
index 695e78ad0d..8b869c4fbf 100644
@@ -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
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH RESEND 2/2 dm: add debug message when failed to select the default pinctrl

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.

---

 drivers/core/device.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/core/device.c +12 -4
index efd07176e3..f3c35ad20c 100644
@@ -533,8 +533,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) &&
@@ -586,8 +590,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:
Signature · 1 line
2.25.1
#2 lore raw

Re: [RESEND PATCH 2/2] dm: add debug message when failed to select the default pinctrl

Quoted 8 lines · Patrick Delaunay

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.

Applied to u-boot/next, thanks!

Signature · 1 line
Tom