From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id CF3461B1D7 for ; Wed, 26 Sep 2018 00:08:42 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id A92B6317; Tue, 25 Sep 2018 18:08:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 25 Sep 2018 18:08:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=dTF evr5RPI+tMJdMwbG3AlMiTUQCXe/oc6oC8CInDOs=; b=Y1XMVQbteWbReB6tJGy dccMWPLk/z9ls2O6bThCauHhs4Ckc4aAGQxdztc+fl+Kes8IHnUKSMT2JoTTmxdK +tum6ZfYE+OGAFEJ7e4qYlwmqX1i4vgY5oVRsDsFYenmgQys1nfru2wUUJhnzaII Cc/PeAE1/Zzzxet2dlGRfQ58= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=dTFevr5RPI+tMJdMwbG3AlMiTUQCXe/oc6oC8CInD Os=; b=jpm5xw3W8y4ioihewgk2ET/cZNX32hmDLkgFyuS3DWfX2ZWgR7DGT8l6s rqQuM4AuUZJ36ALiSyDnI/tw4qAiSSvqP82nNVtaqXt48bwIPcwFmgK1g6RiaxZj LkWCHq0zJqOCT+WivSKPVMPpkb4ddWmeijnJGybcR9SJZw21kuxzohDoZ6Ru+iRL KpbJBLRe98g8Bd7oQWGjGu6+EGMeAWxzJecALoRiDg1e7yAX2bOjroAWA9i0zolh jyHcFTJBSgx/0xh7BWrVgVO1HpZ68FF/fC55eVSdAiEfdrA45aYHc6VSJk1pLBV9 BWyGG8t0ZdzM613FCzYXP62uXq5lw== X-ME-Proxy: X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id C4D55102E9; Tue, 25 Sep 2018 18:08:39 -0400 (EDT) From: Thomas Monjalon To: rosen.xu@intel.com, tianfei.zhang@intel.com Cc: dev@dpdk.org Date: Wed, 26 Sep 2018 00:08:28 +0200 Message-Id: <20180925220828.11882-1-thomas@monjalon.net> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] bus/ifpga: remove useless driver cast X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 22:08:43 -0000 The rte_afu_driver is assigned to rte_afu_device.driver during probing. There is no need of accessing the rte_afu_driver via rte_device.driver and type casting to its container. Signed-off-by: Thomas Monjalon --- drivers/bus/ifpga/ifpga_bus.c | 6 ++---- drivers/bus/ifpga/rte_bus_ifpga.h | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index 207aea152..a10f54f7b 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -349,16 +349,14 @@ static int ifpga_remove_driver(struct rte_afu_device *afu_dev) { const char *name; - const struct rte_afu_driver *driver; name = rte_ifpga_device_name(afu_dev); - if (!afu_dev->device.driver) { + if (afu_dev->driver == NULL) { IFPGA_BUS_DEBUG("no driver attach to device %s\n", name); return 1; } - driver = RTE_DRV_TO_AFU_CONST(afu_dev->device.driver); - return driver->remove(afu_dev); + return afu_dev->driver->remove(afu_dev); } static int diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/rte_bus_ifpga.h index 51d5ae0d9..d53c0f483 100644 --- a/drivers/bus/ifpga/rte_bus_ifpga.h +++ b/drivers/bus/ifpga/rte_bus_ifpga.h @@ -83,9 +83,6 @@ struct rte_afu_device { #define RTE_DEV_TO_AFU(ptr) \ container_of(ptr, struct rte_afu_device, device) -#define RTE_DRV_TO_AFU_CONST(ptr) \ - container_of(ptr, const struct rte_afu_driver, driver) - /** * Initialization function for the driver called during FPGA BUS probing. */ -- 2.19.0