Skip to contentSkip to conversation

dm: pinctrl: Skip not associated gpio phandle and rise an error message

PATCH New Michael Trimarchi 3 participants 6 messages Sep 15, 2019 – Sep 27, 2019 Pin control

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm: pinctrl: Skip not associated gpio phandle and rise an error message

Skip not associated gpio phandle let register the other gpios and the error message add some information to debug the problem using a decompiled version of the dts

dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb

---
 drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-uclass.c +10 -4
index 5b1cd29d86..87b0c3e35b 100644
@@ -91,12 +91,18 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
 		phandle = fdt32_to_cpu(*list++);
 		ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
 						      &config);
-		if (ret)
-			return ret;
+		if (ret) {
+			dev_err(dev, "%s: uclass_get_device_by_phandle_id: err=%d\n",
+				__func__, ret);
+			continue;
+		}
 
 		ret = pinctrl_config_one(config);
-		if (ret)
-			return ret;
+		if (ret) {
+			dev_err(dev, "%s: pinctrl_config_one: err=%d\n",
+				__func__, ret);
+			continue;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 dm: pinctrl: Skip not associated gpio phandle and rise an error message

Hi Michael,

Quoted 17 lines · Michael Trimarchi

Skip not associated gpio phandle let register the other gpios and the error message add some information to debug the problem using a decompiled version of the dts

dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb

---
 drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-uclass.c +0 -0
index 5b1cd29d86..87b0c3e35b 100644

drivers/pinctrl/pinctrl-uclass.c static int pinctrl_select_state_full(struct udevice *dev, const char *statename) · line 97

Quoted 9 lines
drivers/pinctrl/pinctrl-uclass.c +4 -2
@@ -91,12 +91,18 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
                phandle = fdt32_to_cpu(*list++);
                ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
                                                      &config);
-               if (ret)
-                       return ret;
+               if (ret) {
+                       dev_err(dev, "%s: uclass_get_device_by_phandle_id: err=%d\n",
+                               __func__, ret);
+                       continue;

If is is an error, why continue?

Perhaps a warning or a log_debug() instead?

Quoted 14 lines
drivers/pinctrl/pinctrl-uclass.c +6 -3
+               }
 
                ret = pinctrl_config_one(config);
-               if (ret)
-                       return ret;
+               if (ret) {
+                       dev_err(dev, "%s: pinctrl_config_one: err=%d\n",
+                               __func__, ret);
+                       continue;
+               }
        }
 
        return 0;
--
Quoted 2 lines

2.17.1

Regards,
Simon

#2 lore raw

PATCH 1/1 dm: pinctrl: Skip not associated gpio phandle and rise an error message

Hi

Quoted 17 lines · Simon Glass

Hi Michael,

Quoted 12 lines · Michael Trimarchi

Skip not associated gpio phandle let register the other gpios and the error message add some information to debug the problem using a decompiled version of the dts

dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb

---
 drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
Quoted 16 lines
Quoted 5 lines
drivers/pinctrl/pinctrl-uclass.c +0 -0
index 5b1cd29d86..87b0c3e35b 100644

drivers/pinctrl/pinctrl-uclass.c static int pinctrl_select_state_full(struct udevice *dev, const char *statename) · line 97

Quoted 9 lines
drivers/pinctrl/pinctrl-uclass.c +4 -2
@@ -91,12 +91,18 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
                phandle = fdt32_to_cpu(*list++);
                ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
                                                      &config);
-               if (ret)
-                       return ret;
+               if (ret) {
+                       dev_err(dev, "%s: uclass_get_device_by_phandle_id: err=%d\n",
+                               __func__, ret);
+                       continue;

If is is an error, why continue?

It's not a fatal error, it helps to people to fix their board-uboot.dtsi file

Quoted 2 lines

Perhaps a warning or a log_debug() instead?

Ok I will change

Michael

Quoted 20 lines
Quoted 15 lines
drivers/pinctrl/pinctrl-uclass.c +6 -3
+               }
 
                ret = pinctrl_config_one(config);
-               if (ret)
-                       return ret;
+               if (ret) {
+                       dev_err(dev, "%s: pinctrl_config_one: err=%d\n",
+                               __func__, ret);
+                       continue;
+               }
        }
 
        return 0;
--
Quoted 2 lines

2.17.1

Regards,
Simon

Signature · 4 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
#3 lore raw

PATCH v2 1/1 dm: pinctrl: Skip not associated gpio phandle and rise a warning message

In reply to Simon Glass

Skip not associated gpio phandle let register the other gpios on a group. We need anyway to send out a warning to the user to fix their uboot-board.dtsi. Thhe handle id can be found inside the decompiled dtb

dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb

---
V1 -> V2:
- move dev_err to dev_warn
- adjust the commit message

---
 drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-uclass.c +10 -4
index 5b1cd29d86..7d98fbc4ec 100644
@@ -91,12 +91,18 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
 		phandle = fdt32_to_cpu(*list++);
 		ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
 						      &config);
-		if (ret)
-			return ret;
+		if (ret) {
+			dev_warn(dev, "%s: uclass_get_device_by_phandle_id: err=%d\n",
+				__func__, ret);
+			continue;
+		}
 
 		ret = pinctrl_config_one(config);
-		if (ret)
-			return ret;
+		if (ret) {
+			dev_warn(dev, "%s: pinctrl_config_one: err=%d\n",
+				__func__, ret);
+			continue;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.17.1
#4 lore raw

PATCH v2 1/1 dm: pinctrl: Skip not associated gpio phandle and rise a warning message

Quoted 7 lines · Michael Trimarchi

Skip not associated gpio phandle let register the other gpios on a group. We need anyway to send out a warning to the user to fix their uboot-board.dtsi. Thhe handle id can be found inside the decompiled dtb

dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb

Quoted 8 lines

---
V1 -> V2:
- move dev_err to dev_warn
- adjust the commit message

---
 drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
#5 lore raw

PATCH v2 1/1 dm: pinctrl: Skip not associated gpio phandle and rise a warning message

Quoted 7 lines · Michael Trimarchi

Skip not associated gpio phandle let register the other gpios on a group. We need anyway to send out a warning to the user to fix their uboot-board.dtsi. Thhe handle id can be found inside the decompiled dtb

dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb

Quoted 8 lines

---
V1 -> V2:
- move dev_err to dev_warn
- adjust the commit message

---
 drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Applied to u-boot-dm/next, thanks!