lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210824105302.25382-5-kishon@ti.com>
Date:   Tue, 24 Aug 2021 16:23:01 +0530
From:   Kishon Vijay Abraham I <kishon@...com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Mathias Nyman <mathias.nyman@...el.com>,
        Alan Stern <stern@...land.harvard.edu>
CC:     <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <chris.chiu@...onical.com>
Subject: [RFC PATCH 4/5] usb: core: hcd-pci: Let usb_hcd_pci_probe() indicate if RH has to be 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@...com>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ