From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0EB62A00C5; Sat, 9 Jul 2022 10:28:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF92742825; Sat, 9 Jul 2022 10:28:06 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 80C1240A81 for ; Sat, 9 Jul 2022 10:28:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657355285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rhc0/8qLqXVlJzGx8L8kRxEbyN8tbI6zEnyjV5G3BYs=; b=GVyIbOTGJoNEO4kjxm9C8b8pKn3dplztAQtYQ4tzL6QsTZDekjH6FJIgbi6l+f9a8UU/Q6 sHuVaVBUG2kqs319gUclqdP6tfmw62CrLNtdHQPS5p92kUshpwRPqM/+Xu2DNS6JxUfStS U6NjWCST96ktw0xU9z7NHZZ4/541Wvc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-306-V02oP4-mNx6bOTu1kPBUpg-1; Sat, 09 Jul 2022 04:27:55 -0400 X-MC-Unique: V02oP4-mNx6bOTu1kPBUpg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7971E101AA45; Sat, 9 Jul 2022 08:27:55 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A7532026D2D; Sat, 9 Jul 2022 08:27:53 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Parav Pandit , Xueming Li , Hemant Agrawal , Sachin Saxena , Stephen Hemminger , Long Li Subject: [RFC v2 v2 10/29] drivers/bus: remove back reference to bus objects Date: Sat, 9 Jul 2022 10:26:25 +0200 Message-Id: <20220709082644.664675-11-david.marchand@redhat.com> In-Reply-To: <20220709082644.664675-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220709082644.664675-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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 --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 */ -- 2.36.1