Skip to contentSkip to conversation

usb: onboard-hub: Update the bind function based on peer-hub property

PATCH In review Venkatesh Yadav Abbarapu 4 participants 4 messages Dec 4, 2024 – Dec 10, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 usb: onboard-hub: Update the bind function based on peer-hub property

As the "peer-hub" property is optional, don't error out just skip the bind function.

Fixes 57e30b09fc ("usb: onboard-hub: Bail out if peer hub is already probed")

---
Changes in v2:
- Removed the peer_hub variable and used the return value. Changes in v3:
- Removed the else condition.

---
 common/usb_onboard_hub.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
common/usb_onboard_hub.c +6 -1
index 6f28036e09..7fe62b043e 100644
@@ -183,7 +183,12 @@ static int usb_onboard_hub_bind(struct udevice *dev)
 	int ret, off;
 
 	ret = dev_read_phandle_with_args(dev, "peer-hub", NULL, 0, 0, &phandle);
-	if (ret)  {
+	if (ret == -ENOENT) {
+		dev_dbg(dev, "peer-hub property not present\n");
+		return 0;
+	}
+
+	if (ret) {
 		dev_err(dev, "peer-hub not specified\n");
 		return ret;
 	}
Signature · 1 line
2.34.1
Acked-by on v3 1/1
#1 lore raw
Quoted 22 lines · Venkatesh Yadav Abbarapu

As the "peer-hub" property is optional, don't error out just skip the bind function.

Fixes 57e30b09fc ("usb: onboard-hub: Bail out if peer hub is already probed")

---
Changes in v2:
- Removed the peer_hub variable and used the return value. Changes in v3:
- Removed the else condition.

---
  common/usb_onboard_hub.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
common/usb_onboard_hub.c +0 -0
index 6f28036e09..7fe62b043e 100644
@@ -183,7 +183,12 @@ static int usb_onboard_hub_bind(struct udevice *dev)
  	int ret, off;
 
  	ret = dev_read_phandle_with_args(dev, "peer-hub", NULL, 0, 0, &phandle);

common/usb_onboard_hub.c static int usb_onboard_hub_bind(struct udevice *dev) · line 194

Quoted 10 lines
common/usb_onboard_hub.c +6 -1
-	if (ret)  {
+	if (ret == -ENOENT) {
+		dev_dbg(dev, "peer-hub property not present\n");
+		return 0;
+	}
+
+	if (ret) {
  		dev_err(dev, "peer-hub not specified\n");
  		return ret;
  	}

Looks good to me.

Thanks,
Michal

Reviewed-by Tested-by on v3 1/1
#3 lore raw
In reply to Venkatesh Yadav Abbarapu
Quoted 22 lines · Venkatesh Yadav Abbarapu

As the "peer-hub" property is optional, don't error out just skip the bind function.

Fixes 57e30b09fc ("usb: onboard-hub: Bail out if peer hub is already probed")

---
Changes in v2:
- Removed the peer_hub variable and used the return value. Changes in v3:
- Removed the else condition.

---
 common/usb_onboard_hub.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
common/usb_onboard_hub.c +0 -0
index 6f28036e09..7fe62b043e 100644
@@ -183,7 +183,12 @@ static int usb_onboard_hub_bind(struct udevice *dev)
 	int ret, off;
 
 	ret = dev_read_phandle_with_args(dev, "peer-hub", NULL, 0, 0, &phandle);

common/usb_onboard_hub.c static int usb_onboard_hub_bind(struct udevice *dev) · line 194

Quoted 10 lines
common/usb_onboard_hub.c +6 -1
-	if (ret)  {
+	if (ret == -ENOENT) {
+		dev_dbg(dev, "peer-hub property not present\n");
+		return 0;
+	}
+
+	if (ret) {
 		dev_err(dev, "peer-hub not specified\n");
 		return ret;
 	}

Tested on STM32MP157C-DK2 board

Thanks
Patrice