No functional change. Add __usb_hcd_pci_probe() which takes "register_hub" flag that indicates if roothub (RH) has to be registered or not. This is in preparation for allowing xhci-pci to register roothub after the shared hcd is created. The interface for usb_hcd_pci_probe() is not modified to make sure there are minimal code changes. Signed-off-by: Kishon Vijay Abraham I <kishon@xxxxxx> --- drivers/usb/core/hcd-pci.c | 11 ++++++----- include/linux/usb/hcd.h | 8 +++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index d630cccd2e6e..65c1f9aee4d1 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -160,6 +160,7 @@ static void ehci_wait_for_companions(struct pci_dev *pdev, struct usb_hcd *hcd, * @dev: USB Host Controller being probed * @id: pci hotplug id connecting controller to HCD framework * @driver: USB HC driver handle + * @register_hub: Flag to indicate of roothub has to be registered or not * * Context: task context, might sleep * @@ -171,8 +172,8 @@ static void ehci_wait_for_companions(struct pci_dev *pdev, struct usb_hcd *hcd, * * Return: 0 if successful. */ -int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id, - const struct hc_driver *driver) +int __usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id, + const struct hc_driver *driver, bool register_hub) { struct usb_hcd *hcd; int retval; @@ -262,7 +263,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id, down_write(&companions_rwsem); dev_set_drvdata(&dev->dev, hcd); for_each_companion(dev, hcd, ehci_pre_add); - retval = usb_add_hcd(hcd, hcd_irq, IRQF_SHARED); + retval = __usb_add_hcd(hcd, hcd_irq, IRQF_SHARED, register_hub); if (retval != 0) dev_set_drvdata(&dev->dev, NULL); for_each_companion(dev, hcd, ehci_post_add); @@ -270,7 +271,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id, } else { down_read(&companions_rwsem); dev_set_drvdata(&dev->dev, hcd); - retval = usb_add_hcd(hcd, hcd_irq, IRQF_SHARED); + retval = __usb_add_hcd(hcd, hcd_irq, IRQF_SHARED, register_hub); if (retval != 0) dev_set_drvdata(&dev->dev, NULL); else @@ -296,7 +297,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id, dev_err(&dev->dev, "init %s fail, %d\n", pci_name(dev), retval); return retval; } -EXPORT_SYMBOL_GPL(usb_hcd_pci_probe); +EXPORT_SYMBOL_GPL(__usb_hcd_pci_probe); /* may be called without controller electrically present */ diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 2c99cfe20531..49c1a8d56b2c 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -493,14 +493,16 @@ static inline int ehset_single_step_set_feature(struct usb_hcd *hcd, int port) #ifdef CONFIG_USB_PCI struct pci_dev; struct pci_device_id; -extern int usb_hcd_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id, - const struct hc_driver *driver); +extern int __usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id, + const struct hc_driver *driver, bool register_hub); extern void usb_hcd_pci_remove(struct pci_dev *dev); extern void usb_hcd_pci_shutdown(struct pci_dev *dev); extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev); +#define usb_hcd_pci_probe(dev, id, driver) \ + __usb_hcd_pci_probe(dev, id, driver, true) + #ifdef CONFIG_PM extern const struct dev_pm_ops usb_hcd_pci_pm_ops; #endif -- 2.17.1