[PATCH] usb: phy: generic: fix the gpios to be optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All the gpios, ie. reset-gpios and vbus-detect-gpio, should be optional
and not prevent the driver from working. Fix the regression in the
behavior introduced by commit "usb: phy: generic: migrate to gpio_desc".

At the same time, declare the interrupt as "one shot" so that it is
masked until the end of the threaded handler. This prevents the irq core
from spitting out an error :
  "Threaded irq requested with handler=NULL and !ONESHOT for irq 63"

Signed-off-by: Robert Jarzmik <robert.jarzmik@xxxxxxx>
---
 drivers/usb/phy/phy-generic.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index 9a826ff..49db411 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -41,7 +41,8 @@
 #include "phy-generic.h"
 
 #define VBUS_IRQ_FLAGS \
-	(IRQF_SHARED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)
+	(IRQF_SHARED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | \
+		IRQF_ONESHOT)
 
 struct platform_device *usb_phy_generic_register(void)
 {
@@ -218,12 +219,12 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
 			clk_rate = 0;
 
 		needs_vcc = of_property_read_bool(node, "vcc-supply");
-		nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset-gpios");
-		err = PTR_ERR(nop->gpiod_reset);
+		nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset");
+		err = PTR_ERR_OR_ZERO(nop->gpiod_reset);
 		if (!err) {
 			nop->gpiod_vbus = devm_gpiod_get_optional(dev,
-							 "vbus-detect-gpio");
-			err = PTR_ERR(nop->gpiod_vbus);
+							 "vbus-detect");
+			err = PTR_ERR_OR_ZERO(nop->gpiod_vbus);
 		}
 	} else if (pdata) {
 		type = pdata->type;
@@ -242,7 +243,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
 	if (err == -EPROBE_DEFER)
 		return -EPROBE_DEFER;
 	if (err) {
-		dev_err(dev, "Error requesting RESET GPIO\n");
+		dev_err(dev, "Error requesting RESET or VBUS GPIO\n");
 		return err;
 	}
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux