summaryrefslogtreecommitdiff
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-11-11 15:10:18 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2021-11-11 15:10:18 -0800
commit5833291ab6de9c3e2374336b51c814e515e8f3a5 (patch)
tree65eaac2536356b0741266926ae70b2924d2565d3 /drivers/pci/pci.c
parentca2ef2d9f2aad7a28d346522bb4c473a0aa05249 (diff)
parente0217c5ba10d7bf640f038b2feae58e630f2f958 (diff)
Merge tag 'pci-v5.16-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fixes from Bjorn Helgaas: "Revert conversion to struct device.driver instead of struct pci_dev.driver. The device.driver is set earlier, and using it caused the PCI core to call driver PM entry points before .probe() and after .remove(), when the driver isn't prepared. This caused NULL pointer dereferences in i2c_designware_pci and probably other driver issues" * tag 'pci-v5.16-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: Revert "PCI: Use to_pci_driver() instead of pci_dev->driver" Revert "PCI: Remove struct pci_dev->driver"
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index f2cd11130737..1579a3724eb4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5135,14 +5135,13 @@ EXPORT_SYMBOL_GPL(pci_dev_unlock);
static void pci_dev_save_and_disable(struct pci_dev *dev)
{
- struct pci_driver *drv = to_pci_driver(dev->dev.driver);
const struct pci_error_handlers *err_handler =
- drv ? drv->err_handler : NULL;
+ dev->driver ? dev->driver->err_handler : NULL;
/*
- * drv->err_handler->reset_prepare() is protected against races
- * with ->remove() by the device lock, which must be held by the
- * caller.
+ * dev->driver->err_handler->reset_prepare() is protected against
+ * races with ->remove() by the device lock, which must be held by
+ * the caller.
*/
if (err_handler && err_handler->reset_prepare)
err_handler->reset_prepare(dev);
@@ -5167,15 +5166,15 @@ static void pci_dev_save_and_disable(struct pci_dev *dev)
static void pci_dev_restore(struct pci_dev *dev)
{
- struct pci_driver *drv = to_pci_driver(dev->dev.driver);
const struct pci_error_handlers *err_handler =
- drv ? drv->err_handler : NULL;
+ dev->driver ? dev->driver->err_handler : NULL;
pci_restore_state(dev);
/*
- * drv->err_handler->reset_done() is protected against races with
- * ->remove() by the device lock, which must be held by the caller.
+ * dev->driver->err_handler->reset_done() is protected against
+ * races with ->remove() by the device lock, which must be held by
+ * the caller.
*/
if (err_handler && err_handler->reset_done)
err_handler->reset_done(dev);