Commit 211f658b authored by Hans de Goede's avatar Hans de Goede Committed by Felipe Balbi

usb: dwc3: pci: Use devm functions to get the phy GPIOs

Even though we only use them once, it is better to not put/release
the GPIOs immediately after use, so that others cannot claim them.

Use devm functions to get the phy GPIOs, so that they will be
automatically released when were unbound from the device and
remove the gpio_put calls.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 7740d04d
...@@ -177,20 +177,20 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc) ...@@ -177,20 +177,20 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
* put the gpio descriptors again here because the phy driver * put the gpio descriptors again here because the phy driver
* might want to grab them, too. * might want to grab them, too.
*/ */
gpio = gpiod_get_optional(&pdev->dev, "cs", GPIOD_OUT_LOW); gpio = devm_gpiod_get_optional(&pdev->dev, "cs",
GPIOD_OUT_LOW);
if (IS_ERR(gpio)) if (IS_ERR(gpio))
return PTR_ERR(gpio); return PTR_ERR(gpio);
gpiod_set_value_cansleep(gpio, 1); gpiod_set_value_cansleep(gpio, 1);
gpiod_put(gpio);
gpio = gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); gpio = devm_gpiod_get_optional(&pdev->dev, "reset",
GPIOD_OUT_LOW);
if (IS_ERR(gpio)) if (IS_ERR(gpio))
return PTR_ERR(gpio); return PTR_ERR(gpio);
if (gpio) { if (gpio) {
gpiod_set_value_cansleep(gpio, 1); gpiod_set_value_cansleep(gpio, 1);
gpiod_put(gpio);
usleep_range(10000, 11000); usleep_range(10000, 11000);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment