Using PLATFORM_DEVID_AUTO leads to an unpredictable name for the platform child-device, which in turn makes it impossible for a phy driver to use phy_create_lookup to register a phy attached to the dwc3 controller, as that requires a constant dev_name. This commit fixes this by using our own id allocator, so that the name will always be dwc3.0 for the first (and most likely only) dwc3 controller enumerated. Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> --- drivers/usb/dwc3/dwc3-pci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 9c65713..8be88df 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -25,6 +25,7 @@ #include <linux/gpio/consumer.h> #include <linux/acpi.h> #include <linux/delay.h> +#include <linux/idr.h> #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI 0xabce @@ -48,6 +49,8 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = { { }, }; +static DEFINE_IDA(dwc3_platform_devid_ida); + static int dwc3_pci_quirks(struct pci_dev *pdev, struct platform_device *dwc3) { if (pdev->vendor == PCI_VENDOR_ID_AMD && @@ -141,7 +144,7 @@ static int dwc3_pci_probe(struct pci_dev *pci, { struct resource res[2]; struct platform_device *dwc3; - int ret; + int pdev_id, ret; struct device *dev = &pci->dev; ret = pcim_enable_device(pci); @@ -152,7 +155,11 @@ static int dwc3_pci_probe(struct pci_dev *pci, pci_set_master(pci); - dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); + pdev_id = ida_simple_get(&dwc3_platform_devid_ida, 0, 0, GFP_KERNEL); + if (pdev_id < 0) + pdev_id = PLATFORM_DEVID_AUTO; + + dwc3 = platform_device_alloc("dwc3", pdev_id); if (!dwc3) { dev_err(dev, "couldn't allocate dwc3 device\n"); return -ENOMEM; -- 2.9.3 -- 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