All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] usb: dwc3: pci: Switch to devm_acpi_dev_add_driver_gpios()
@ 2017-03-22 14:08 Andy Shevchenko
  2017-03-22 14:35 ` Felipe Balbi
       [not found] ` <20170322140807.34332-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2017-03-22 14:08 UTC (permalink / raw)
  To: Felipe Balbi, linux-usb, Linus Walleij, linux-gpio; +Cc: 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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---

 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(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index cce0a220b6b0..a15ec71d0423 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -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);
 }
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] usb: dwc3: pci: Switch to devm_acpi_dev_add_driver_gpios()
  2017-03-22 14:08 [PATCH v1] usb: dwc3: pci: Switch to devm_acpi_dev_add_driver_gpios() Andy Shevchenko
@ 2017-03-22 14:35 ` Felipe Balbi
       [not found] ` <20170322140807.34332-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2017-03-22 14:35 UTC (permalink / raw)
  To: linux-usb, Linus Walleij, linux-gpio; +Cc: Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]


Hi,

Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
> 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.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] usb: dwc3: pci: Switch to devm_acpi_dev_add_driver_gpios()
       [not found] ` <20170322140807.34332-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2017-03-23 12:40   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2017-03-23 12:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Felipe Balbi, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA

On Wed, Mar 22, 2017 at 3:08 PM, Andy Shevchenko
<andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:

> 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.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
>
>  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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-23 12:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-22 14:08 [PATCH v1] usb: dwc3: pci: Switch to devm_acpi_dev_add_driver_gpios() Andy Shevchenko
2017-03-22 14:35 ` Felipe Balbi
     [not found] ` <20170322140807.34332-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-03-23 12:40   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.