From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0042.outbound.protection.outlook.com [104.47.38.42]) by dpdk.org (Postfix) with ESMTP id 3649958CB for ; Sat, 15 Oct 2016 15:44:54 +0200 (CEST) Received: from DM2PR03CA0032.namprd03.prod.outlook.com (10.141.96.31) by CY1PR03MB1421.namprd03.prod.outlook.com (10.163.17.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Sat, 15 Oct 2016 13:44:53 +0000 Received: from BN1AFFO11FD027.protection.gbl (2a01:111:f400:7c10::119) by DM2PR03CA0032.outlook.office365.com (2a01:111:e400:2428::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.12 via Frontend Transport; Sat, 15 Oct 2016 13:44:53 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD027.mail.protection.outlook.com (10.58.52.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.629.5 via Frontend Transport; Sat, 15 Oct 2016 13:44:51 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u9FDhhgT021870; Sat, 15 Oct 2016 06:44:49 -0700 From: Shreyansh Jain To: CC: , , , Shreyansh Jain , Hemant Agrawal Date: Sat, 15 Oct 2016 19:15:04 +0530 Message-ID: <1476539108-13170-14-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476539108-13170-1-git-send-email-shreyansh.jain@nxp.com> References: <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> <1476539108-13170-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131210126921259163; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(47776003)(97736004)(2906002)(68736007)(104016004)(305945005)(85426001)(86362001)(6666003)(6916009)(2950100002)(87936001)(11100500001)(4326007)(92566002)(189998001)(81156014)(5660300001)(5003940100001)(50986999)(76176999)(106466001)(36756003)(81166006)(626004)(50466002)(229853001)(586003)(48376002)(105606002)(356003)(50226002)(8936002)(110136003)(8666005)(7846002)(2351001)(8676002)(33646002)(19580405001)(19580395003)(77096005)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB1421; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD027; 1:YnDOU24tqfkIHZ+1DfnvoLBiA+lNG5BY0mDjTpu7+zSWRRCdS72Y6kBc5EZirLyzKbnWlLWmut1lqcuxTvV3VSRp3LVmJMc/22fiXfLB3KsenQY5c3n26/rruDDM8ffrw27/JnLPAwOErxo9X2SGYSNUv9lV2oG/fns5tvM/zp8w2M6kQm/MbeRzNYwjnvjmG4V/wThWyUzu8DR3xg6n2XsJVAgXqf4OjDggKVE4mDamK8PWlwlUIg4Oht9R3Gz7Vm9g+Qqq+Lhi5R96plSwUPgrJIXq4fsLL1AosqEQCNlSJhRgtQj50MDUzZ0GmuMg8mGGMgpw8FIesWlNQ2O1+Yd6Y8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mU3X+kqi6wDbcm00S6nGYb7/Kv3GbzcSPBmWnJkbnObTQX7AKm/lvbiOKWt1HsOOOBKTFOJrMmy2ocr3yiSkIaD2KT9EjItidwRL3zGZFsj3iX/W8y6PI7N24wq3lyr4iQZEW5w7T+mFI3uCavJ1Rd7EZx/FoaViG70sfKXJuI16f9wiPGIL/f8lMJNTz/7Pci1nldYb7PggBVxuSeS6EzFJ5QbUl/PqvAxWIDHwEIWSuXTbXAJujDcScO5Age40M6QNXVqa2VOOTLpRXyYAGRMhjs/n8iShwSwnKr X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(8121501046)(13018025)(13017025)(13024025)(13023025)(5005006)(3002001)(10201501046)(6055026); SRVR:CY1PR03MB1421; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR03MB1421; X-Forefront-PRVS: 00963989E5 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB1421; 23:6fdFgnlrgkHDNxJQVpDHN3E/Y9N/LVmWA4bOrHN9B?= =?us-ascii?Q?sAVer8/NSB2BeYflWd66emT/Lt/I/0FtjHyA5Pjp1EqAqWyVh+oBetae0HiC?= =?us-ascii?Q?qcXtIQMxfXfDh/trdmQ+WS+5Xok6O4DPJc8F1OLDaebsVH4vR9xxZPkOErPT?= =?us-ascii?Q?As6vTUq09KuGgFsvFJzPbKdxczEvE6PjgutBAOgEN5HsZr5ASvQUtyDZJfSY?= =?us-ascii?Q?KyBYh2ugKVgI0UTvLtlzFYkKQTOVBi0a94/m9Hu41jhFzfzrJYNuaCyfrQC6?= =?us-ascii?Q?8oY8T4zFeyomZF7H04RicNxwaijAyDvZYYeVcD63iG/4Fuqb9ZEYctw8X9YA?= =?us-ascii?Q?ss8Iz+SL7JYDFn3AFgvgBlTAt/IyE1G13GcT/Ul6GxMxSs/AkJ7Mioe8nkX7?= =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ginalArrivalTime: 15 Oct 2016 13:44:51.9387 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1421 Subject: [dpdk-dev] [PATCH v4 13/17] ether: utilize container_of for pci_drv X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2016 13:44:54 -0000 From: Jan Viktorin It is not necessary to place the rte_pci_driver at the beginning of the rte_eth_dev struct anymore as we use the container_of macro to get the parent pointer. Signed-off-by: Jan Viktorin Signed-off-by: Shreyansh Jain Signed-off-by: Hemant Agrawal --- lib/librte_ether/rte_ethdev.c | 4 ++-- lib/librte_ether/rte_ethdev.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 0d9d9c1..9aea048 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -241,7 +241,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, int diag; - eth_drv = (struct eth_driver *)pci_drv; + eth_drv = container_of(pci_drv, struct eth_driver, pci_drv); rte_eal_pci_device_name(&pci_dev->addr, ethdev_name, sizeof(ethdev_name)); @@ -302,7 +302,7 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev) if (eth_dev == NULL) return -ENODEV; - eth_drv = (const struct eth_driver *)pci_dev->driver; + eth_drv = container_of(pci_dev->driver, struct eth_driver, pci_drv); /* Invoke PMD device uninit function */ if (*eth_drv->eth_dev_uninit) { diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 38641e8..f893fe0 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1850,7 +1850,7 @@ typedef int (*eth_dev_uninit_t)(struct rte_eth_dev *eth_dev); * Each Ethernet driver acts as a PCI driver and is represented by a generic * *eth_driver* structure that holds: * - * - An *rte_pci_driver* structure (which must be the first field). + * - An *rte_pci_driver* structure. * * - The *eth_dev_init* function invoked for each matching PCI device. * -- 2.7.4