bus/pci: enhance driver pointer documentation

Message ID 20220301105354.13323-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series bus/pci: enhance driver pointer documentation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

David Marchand March 1, 2022, 10:53 a.m. UTC
  Setting driver pointer before mapping required for write combining
support since commit 4a928ef9f611 ("bus/pci: enable write combining
during mapping").

Move comments that got separated after different changes.
Also change the condition relying on dev->driver itself.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/pci/pci_common.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
  

Comments

Thomas Monjalon March 7, 2022, 4:51 p.m. UTC | #1
01/03/2022 11:53, David Marchand:
> Setting driver pointer before mapping required for write combining
> support since commit 4a928ef9f611 ("bus/pci: enable write combining
> during mapping").
> 
> Move comments that got separated after different changes.
> Also change the condition relying on dev->driver itself.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.
  

Patch

diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index def372b67e..37ab879779 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -207,11 +207,6 @@  rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 	RTE_LOG(DEBUG, EAL, "  probe driver: %x:%x %s\n", dev->id.vendor_id,
 		dev->id.device_id, dr->driver.name);
 
-	/*
-	 * reference driver structure
-	 * This needs to be before rte_pci_map_device(), as it enables to use
-	 * driver flags for adjusting configuration.
-	 */
 	if (!already_probed) {
 		enum rte_iova_mode dev_iova_mode;
 		enum rte_iova_mode iova_mode;
@@ -247,9 +242,13 @@  rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 			return -ENOMEM;
 		}
 
+		/*
+		 * Reference driver structure.
+		 * This needs to be before rte_pci_map_device(), as it enables
+		 * to use driver flags for adjusting configuration.
+		 */
 		dev->driver = dr;
-
-		if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
+		if (dev->driver->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
 			ret = rte_pci_map_device(dev);
 			if (ret != 0) {
 				dev->driver = NULL;