Skip to content

Commit

Permalink
usb: core: hcd-pci: Let usb_hcd_pci_probe() indicate if RH has to be …
Browse files Browse the repository at this point in the history
…registered

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@ti.com>
  • Loading branch information
kishon authored and intel-lab-lkp committed Aug 24, 2021
1 parent c36f136 commit fd3b9b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 6 additions & 5 deletions drivers/usb/core/hcd-pci.c
Expand Up @@ -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
*
Expand All @@ -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;
Expand Down Expand Up @@ -262,15 +263,15 @@ 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);
up_write(&companions_rwsem);
} 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
Expand All @@ -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 */
Expand Down
8 changes: 5 additions & 3 deletions include/linux/usb/hcd.h
Expand Up @@ -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
Expand Down

0 comments on commit fd3b9b5

Please sign in to comment.