Skip to contentSkip to conversation

usb: ehci-mx5: Use regulator_set_enable_if_allowed

PATCH In review Marek Vasut 3 participants 6 messages Jan 7, 2025 – Jan 8, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 usb: ehci-mx5: Use regulator_set_enable_if_allowed

With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators.

Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled.

Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")

---
Cc: Alice Guo <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Mathieu Othacehe <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
 drivers/usb/host/ehci-mx5.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-mx5.c +3 -3
index d8f521befe1..1392d29bc13 100644
@@ -287,9 +287,9 @@ static int ehci_usb_probe(struct udevice *dev)
 		debug("%s: No vbus supply\n", dev->name);
 
 	if (!ret && priv->vbus_supply) {
-		ret = regulator_set_enable(priv->vbus_supply,
-					   (type == USB_INIT_DEVICE) ?
-					   false : true);
+		ret = regulator_set_enable_if_allowed(priv->vbus_supply,
+						      (type == USB_INIT_DEVICE) ?
+						      false : true);
 		if (ret) {
 			puts("Error enabling VBUS supply\n");
 			return ret;
Signature · 1 line
2.45.2
#1 lore raw

PATCH 2/2 usb: ehci-mx6: Use regulator_set_enable_if_allowed

With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators.

Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled.

Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")

---
Cc: Alice Guo <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Mathieu Othacehe <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
 drivers/usb/host/ehci-mx6.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-mx6.c +3 -3
index a93fa5d5455..a8748cef7ad 100644
@@ -479,9 +479,9 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
 	if (priv->vbus_supply) {
 		int ret;
-		ret = regulator_set_enable(priv->vbus_supply,
-					   (type == USB_INIT_DEVICE) ?
-					   false : true);
+		ret = regulator_set_enable_if_allowed(priv->vbus_supply,
+						      (type == USB_INIT_DEVICE) ?
+						      false : true);
 		if (ret && ret != -ENOSYS) {
 			printf("Error enabling VBUS supply (ret=%i)\n", ret);
 			return ret;
Signature · 1 line
2.45.2
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] usb: ehci-mx6: Use regulator_set_enable_if_allowed

Quoted 11 lines · Marek Vasut

With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators.

Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled.

Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")

Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] usb: ehci-mx6: Use regulator_set_enable_if_allowed

In reply to Marek Vasut

Hi Marek,

Thank you for the patch.

Quoted 10 lines · Marek Vasut

With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators.

Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled.

Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")

Quoted 31 lines

---
Cc: Alice Guo <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Mathieu Othacehe <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
 drivers/usb/host/ehci-mx6.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-mx6.c +3 -3
index a93fa5d5455..a8748cef7ad 100644
@@ -479,9 +479,9 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
 	if (priv->vbus_supply) {
 		int ret;
-		ret = regulator_set_enable(priv->vbus_supply,
-					   (type == USB_INIT_DEVICE) ?
-					   false : true);
+		ret = regulator_set_enable_if_allowed(priv->vbus_supply,
+						      (type == USB_INIT_DEVICE) ?
+						      false : true);
 		if (ret && ret != -ENOSYS) {
 			printf("Error enabling VBUS supply (ret=%i)\n", ret);
 			return ret;
Signature · 1 line
2.45.2
Reviewed-by on v1 1/2
#4 lore raw
In reply to Marek Vasut
Quoted 11 lines · Marek Vasut

With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators.

Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled.

Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")

Reviewed-by on v1 1/2
#5 lore raw
In reply to Marek Vasut

Hi Marek,

Thank you for the patch.

Quoted 10 lines · Marek Vasut

With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators.

Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled.

Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")

Quoted 31 lines

---
Cc: Alice Guo <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Mathieu Othacehe <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
 drivers/usb/host/ehci-mx5.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-mx5.c +3 -3
index d8f521befe1..1392d29bc13 100644
@@ -287,9 +287,9 @@ static int ehci_usb_probe(struct udevice *dev)
 		debug("%s: No vbus supply\n", dev->name);
 
 	if (!ret && priv->vbus_supply) {
-		ret = regulator_set_enable(priv->vbus_supply,
-					   (type == USB_INIT_DEVICE) ?
-					   false : true);
+		ret = regulator_set_enable_if_allowed(priv->vbus_supply,
+						      (type == USB_INIT_DEVICE) ?
+						      false : true);
 		if (ret) {
 			puts("Error enabling VBUS supply\n");
 			return ret;
Signature · 1 line
2.45.2