Commit 16bd44e5 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Bjorn Helgaas

cxl: Use to_pci_driver() instead of pci_dev->driver

Struct pci_driver contains a struct device_driver, so for PCI devices, it's
easy to convert a device_driver * to a pci_driver * with to_pci_driver().
The device_driver * is in struct device, so we don't need to also keep
track of the pci_driver * in struct pci_dev.

Replace pdev->driver with to_pci_driver().  This is a step toward removing
pci_dev->driver.

[bhelgaas: split to separate patch]
Link: https://lore.kernel.org/r/20211004125935.2300113-11-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 4e59b754
...@@ -27,7 +27,7 @@ static void pci_error_handlers(struct cxl_afu *afu, ...@@ -27,7 +27,7 @@ static void pci_error_handlers(struct cxl_afu *afu,
return; return;
list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) { list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) {
afu_drv = afu_dev->driver; afu_drv = to_pci_driver(afu_dev->dev.driver);
if (!afu_drv) if (!afu_drv)
continue; continue;
......
...@@ -1807,7 +1807,7 @@ static pci_ers_result_t cxl_vphb_error_detected(struct cxl_afu *afu, ...@@ -1807,7 +1807,7 @@ static pci_ers_result_t cxl_vphb_error_detected(struct cxl_afu *afu,
return result; return result;
list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) { list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) {
afu_drv = afu_dev->driver; afu_drv = to_pci_driver(afu_dev->dev.driver);
if (!afu_drv) if (!afu_drv)
continue; continue;
...@@ -2034,7 +2034,7 @@ static pci_ers_result_t cxl_pci_slot_reset(struct pci_dev *pdev) ...@@ -2034,7 +2034,7 @@ static pci_ers_result_t cxl_pci_slot_reset(struct pci_dev *pdev)
* shouldn't start new work until we call * shouldn't start new work until we call
* their resume function. * their resume function.
*/ */
afu_drv = afu_dev->driver; afu_drv = to_pci_driver(afu_dev->dev.driver);
if (!afu_drv) if (!afu_drv)
continue; continue;
...@@ -2083,7 +2083,7 @@ static void cxl_pci_resume(struct pci_dev *pdev) ...@@ -2083,7 +2083,7 @@ static void cxl_pci_resume(struct pci_dev *pdev)
continue; continue;
list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) { list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) {
afu_drv = afu_dev->driver; afu_drv = to_pci_driver(afu_dev->dev.driver);
if (!afu_drv) if (!afu_drv)
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment