diff mbox series

[RFC,08/11] drivers/bus: remove back reference to bus objects

Message ID 20220628144643.1213026-9-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series Bus cleanup for 22.11 | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand June 28, 2022, 2:46 p.m. UTC
There is no need for a back reference to a singleton object in the bus
driver objects: each function is contextually aware of which bus object
it should manipulate.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/auxiliary/auxiliary_common.c  |  2 --
 drivers/bus/auxiliary/rte_bus_auxiliary.h |  2 --
 drivers/bus/dpaa/dpaa_bus.c               | 10 +---------
 drivers/bus/dpaa/rte_dpaa_bus.h           |  1 -
 drivers/bus/fslmc/fslmc_bus.c             | 10 +---------
 drivers/bus/fslmc/rte_fslmc.h             |  1 -
 drivers/bus/pci/pci_common.c              |  2 --
 drivers/bus/pci/rte_bus_pci.h             |  1 -
 drivers/bus/vmbus/rte_bus_vmbus.h         |  2 --
 drivers/bus/vmbus/vmbus_common.c          |  2 --
 10 files changed, 2 insertions(+), 31 deletions(-)
diff mbox series

Patch

diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c
index 2cf8fe672d..0b212f2d64 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -259,7 +259,6 @@  void
 rte_auxiliary_register(struct rte_auxiliary_driver *driver)
 {
 	TAILQ_INSERT_TAIL(&auxiliary_bus.driver_list, driver, next);
-	driver->bus = &auxiliary_bus;
 }
 
 /* Unregister a driver */
@@ -267,7 +266,6 @@  void
 rte_auxiliary_unregister(struct rte_auxiliary_driver *driver)
 {
 	TAILQ_REMOVE(&auxiliary_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to auxiliary bus */
diff --git a/drivers/bus/auxiliary/rte_bus_auxiliary.h b/drivers/bus/auxiliary/rte_bus_auxiliary.h
index 93b266daf7..b19696e5e6 100644
--- a/drivers/bus/auxiliary/rte_bus_auxiliary.h
+++ b/drivers/bus/auxiliary/rte_bus_auxiliary.h
@@ -32,7 +32,6 @@  extern "C" {
 
 /* Forward declarations */
 struct rte_auxiliary_driver;
-struct rte_auxiliary_bus;
 struct rte_auxiliary_device;
 
 /**
@@ -125,7 +124,6 @@  struct rte_auxiliary_device {
 struct rte_auxiliary_driver {
 	RTE_TAILQ_ENTRY(rte_auxiliary_driver) next; /**< Next in list. */
 	struct rte_driver driver;             /**< Inherit core driver. */
-	struct rte_auxiliary_bus *bus;        /**< Auxiliary bus reference. */
 	rte_auxiliary_match_t *match;         /**< Device match function. */
 	rte_auxiliary_probe_t *probe;         /**< Device probe function. */
 	rte_auxiliary_remove_t *remove;       /**< Device remove function. */
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e442bc4c33..2c286d5817 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -520,23 +520,15 @@  rte_dpaa_driver_register(struct rte_dpaa_driver *driver)
 	BUS_INIT_FUNC_TRACE();
 
 	TAILQ_INSERT_TAIL(&rte_dpaa_bus.driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = &rte_dpaa_bus;
 }
 
 /* un-register a dpaa bus based dpaa driver */
 void
 rte_dpaa_driver_unregister(struct rte_dpaa_driver *driver)
 {
-	struct rte_dpaa_bus *dpaa_bus;
-
 	BUS_INIT_FUNC_TRACE();
 
-	dpaa_bus = driver->dpaa_bus;
-
-	TAILQ_REMOVE(&dpaa_bus->driver_list, driver, next);
-	/* Update Bus references */
-	driver->dpaa_bus = NULL;
+	TAILQ_REMOVE(&rte_dpaa_bus.driver_list, driver, next);
 }
 
 static int
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index 1f04d9ebd3..5e8f32dfbf 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -119,7 +119,6 @@  typedef int (*rte_dpaa_remove_t)(struct rte_dpaa_device *dpaa_dev);
 struct rte_dpaa_driver {
 	TAILQ_ENTRY(rte_dpaa_driver) next;
 	struct rte_driver driver;
-	struct rte_dpaa_bus *dpaa_bus;
 	enum rte_dpaa_type drv_type;
 	rte_dpaa_probe_t probe;
 	rte_dpaa_remove_t remove;
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index e9edc27e0a..f112d2afeb 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -530,27 +530,19 @@  rte_fslmc_driver_register(struct rte_dpaa2_driver *driver)
 	RTE_VERIFY(driver);
 
 	TAILQ_INSERT_TAIL(&rte_fslmc_bus.driver_list, driver, next);
-	/* Update Bus references */
-	driver->fslmc_bus = &rte_fslmc_bus;
 }
 
 /*un-register a fslmc bus based dpaa2 driver */
 void
 rte_fslmc_driver_unregister(struct rte_dpaa2_driver *driver)
 {
-	struct rte_fslmc_bus *fslmc_bus;
-
-	fslmc_bus = driver->fslmc_bus;
-
 	/* Cleanup the PA->VA Translation table; From wherever this function
 	 * is called from.
 	 */
 	if (rte_eal_iova_mode() == RTE_IOVA_PA)
 		dpaax_iova_table_depopulate();
 
-	TAILQ_REMOVE(&fslmc_bus->driver_list, driver, next);
-	/* Update Bus references */
-	driver->fslmc_bus = NULL;
+	TAILQ_REMOVE(&rte_fslmc_bus.driver_list, driver, next);
 }
 
 /*
diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h
index 8c67bfba55..9c3791635c 100644
--- a/drivers/bus/fslmc/rte_fslmc.h
+++ b/drivers/bus/fslmc/rte_fslmc.h
@@ -146,7 +146,6 @@  typedef int (*rte_dpaa2_remove_t)(struct rte_dpaa2_device *dpaa2_dev);
 struct rte_dpaa2_driver {
 	TAILQ_ENTRY(rte_dpaa2_driver) next; /**< Next in list. */
 	struct rte_driver driver;           /**< Inherit core driver. */
-	struct rte_fslmc_bus *fslmc_bus;    /**< FSLMC bus reference */
 	uint32_t drv_flags;                 /**< Flags for controlling device.*/
 	enum rte_dpaa2_dev_type drv_type;   /**< Driver Type */
 	rte_dpaa2_probe_t probe;
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 37ab879779..0d61d49287 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -443,7 +443,6 @@  void
 rte_pci_register(struct rte_pci_driver *driver)
 {
 	TAILQ_INSERT_TAIL(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = &rte_pci_bus;
 }
 
 /* unregister a driver */
@@ -451,7 +450,6 @@  void
 rte_pci_unregister(struct rte_pci_driver *driver)
 {
 	TAILQ_REMOVE(&rte_pci_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to PCI bus */
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 1c6a8fdd7b..1913bc111c 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -161,7 +161,6 @@  typedef int (pci_dma_unmap_t)(struct rte_pci_device *dev, void *addr,
 struct rte_pci_driver {
 	RTE_TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
 	struct rte_driver driver;          /**< Inherit core driver. */
-	struct rte_pci_bus *bus;           /**< PCI bus reference. */
 	rte_pci_probe_t *probe;            /**< Device probe function. */
 	rte_pci_remove_t *remove;          /**< Device remove function. */
 	pci_dma_map_t *dma_map;		   /**< device dma map function. */
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index 4421326fe8..8d6ba26028 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -34,7 +34,6 @@  extern "C" {
 /* Forward declarations */
 struct rte_vmbus_device;
 struct rte_vmbus_driver;
-struct rte_vmbus_bus;
 struct vmbus_channel;
 struct vmbus_mon_page;
 
@@ -95,7 +94,6 @@  typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
 struct rte_vmbus_driver {
 	RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
 	struct rte_driver driver;
-	struct rte_vmbus_bus *bus;          /**< VM bus reference. */
 	vmbus_probe_t *probe;               /**< Device Probe function. */
 	vmbus_remove_t *remove;             /**< Device Remove function. */
 
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 367727367e..0f2d878126 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -235,7 +235,6 @@  rte_vmbus_register(struct rte_vmbus_driver *driver)
 		"Registered driver %s", driver->driver.name);
 
 	TAILQ_INSERT_TAIL(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = &rte_vmbus_bus;
 }
 
 /* unregister vmbus driver */
@@ -243,7 +242,6 @@  void
 rte_vmbus_unregister(struct rte_vmbus_driver *driver)
 {
 	TAILQ_REMOVE(&rte_vmbus_bus.driver_list, driver, next);
-	driver->bus = NULL;
 }
 
 /* Add a device to VMBUS bus */