From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id B0E754CC3 for ; Wed, 26 Sep 2018 02:25:40 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2018 17:25:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,304,1534834800"; d="scan'208";a="89352989" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 25 Sep 2018 17:25:30 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 25 Sep 2018 17:25:30 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 25 Sep 2018 17:25:30 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.183]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.37]) with mapi id 14.03.0319.002; Wed, 26 Sep 2018 08:25:28 +0800 From: "Xu, Rosen" To: Thomas Monjalon , "Zhang, Tianfei" CC: "dev@dpdk.org" Thread-Topic: [PATCH] bus/ifpga: remove useless driver cast Thread-Index: AQHUVRxesHl+1nQBg0SDEm525I9W5aUBs5Pg Date: Wed, 26 Sep 2018 00:25:28 +0000 Message-ID: <0E78D399C70DA940A335608C6ED296D73A28D790@SHSMSX104.ccr.corp.intel.com> References: <20180925220828.11882-1-thomas@monjalon.net> In-Reply-To: <20180925220828.11882-1-thomas@monjalon.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjY4YzgyMjctYWQ1Mi00M2FkLWE1YjAtYzNmZDFkNGVkZWU2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiM2s3OHRtbm1BTkFlSGVuWTdzYnhkNU93NUxLT2p4VEcybE5IYXBxT2hNXC84bjBzVlZ4bHdKSHV4RlpSZlE2Nk8ifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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: Wed, 26 Sep 2018 00:25:41 -0000 > -----Original Message----- > From: Thomas Monjalon [mailto:thomas@monjalon.net] > Sent: Wednesday, September 26, 2018 6:08 > To: Xu, Rosen ; Zhang, Tianfei > > Cc: dev@dpdk.org > Subject: [PATCH] bus/ifpga: remove useless driver cast >=20 > 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 an= d > type casting to its container. >=20 > 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(-) >=20 > 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; >=20 > name =3D rte_ifpga_device_name(afu_dev); > - if (!afu_dev->device.driver) { > + if (afu_dev->driver =3D=3D NULL) { > IFPGA_BUS_DEBUG("no driver attach to device %s\n", name); > return 1; > } >=20 > - driver =3D RTE_DRV_TO_AFU_CONST(afu_dev->device.driver); > - return driver->remove(afu_dev); > + return afu_dev->driver->remove(afu_dev); > } >=20 > 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) >=20 > -#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 Acked-by: Rosen Xu