Skip to contentSkip to conversation

usb: dwc3: pci: Switch to devm_acpi_dev_add_driver_gpios()

PATCH In review Andy Shevchenko 3 participants 3 messages Mar 22, 2017 – Mar 23, 2017 1 message not in the archive

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

PATCH 1/1 usb: dwc3: pci: Switch to devm_acpi_dev_add_driver_gpios()

Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify error path and fix potentially wrong assignment if ->probe() fails.

While here, add a debug message in case assignment fails to allow user see the cause of a potential issue.

---

Linus, according to preliminary agreement with Felipe it may go through GPIO subsystem instead of pulling from it.

 drivers/usb/dwc3/dwc3-pci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/dwc3/dwc3-pci.c +3 -2
index cce0a220b6b0..a15ec71d0423 100644
@@ -125,8 +125,10 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
 		if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) {
 			struct gpio_desc *gpio;
 
-			acpi_dev_add_driver_gpios(ACPI_COMPANION(&pdev->dev),
+			ret = devm_acpi_dev_add_driver_gpios(&pdev->dev,
 					acpi_dwc3_byt_gpios);
+			if (ret)
+				dev_dbg(&pdev->dev, "failed to add mapping table\n");
 
 			/*
 			 * These GPIOs will turn on the USB2 PHY. Note that we have to
@@ -242,7 +244,6 @@ static void dwc3_pci_remove(struct pci_dev *pci)
 
 	device_init_wakeup(&pci->dev, false);
 	pm_runtime_get(&pci->dev);
-	acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pci->dev));
 	platform_device_unregister(dwc->dwc3);
 }
 
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 7 lines · Andy Shevchenko

Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify error path and fix potentially wrong assignment if ->probe() fails.

While here, add a debug message in case assignment fails to allow user see the cause of a potential issue.

Signature · 1 line
balbi

A message that is not in the archive (sent off-list or not yet received): 20170322140807.34332-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]

#3 lore raw
Quoted 11 lines · Andy Shevchenko

Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify error path and fix potentially wrong assignment if ->probe() fails.

While here, add a debug message in case assignment fails to allow user see the cause of a potential issue.

---

Linus, according to preliminary agreement with Felipe it may go through GPIO subsystem instead of pulling from it.

Patch applied with Felipe's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html