From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0071.outbound.protection.outlook.com [104.47.40.71]) by dpdk.org (Postfix) with ESMTP id 917F25584 for ; Wed, 31 Aug 2016 13:01:56 +0200 (CEST) Received: from BN6PR03CA0072.namprd03.prod.outlook.com (10.173.137.34) by BN6PR03MB2433.namprd03.prod.outlook.com (10.168.223.11) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.13; Wed, 31 Aug 2016 11:01:53 +0000 Received: from BL2FFO11OLC012.protection.gbl (2a01:111:f400:7c09::142) by BN6PR03CA0072.outlook.office365.com (2603:10b6:404:4c::34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9 via Frontend Transport; Wed, 31 Aug 2016 11:01: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 BL2FFO11OLC012.mail.protection.outlook.com (10.173.160.159) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Wed, 31 Aug 2016 11:01:54 +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 u7VB0lab010481; Wed, 31 Aug 2016 04:01:52 -0700 From: Shreyansh Jain To: CC: Shreyansh Jain , Jan Viktorin , Hemant Agrawal Date: Wed, 31 Aug 2016 16:30:31 +0530 Message-ID: <1472641235-23626-11-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472641235-23626-1-git-send-email-shreyansh.jain@nxp.com> References: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com> <1472641235-23626-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131171149147114099; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(92566002)(68736007)(33646002)(2950100001)(47776003)(8676002)(36756003)(19580395003)(11100500001)(50986999)(626004)(81156014)(76176999)(189998001)(586003)(5003940100001)(85426001)(77096005)(5660300001)(50226002)(50466002)(8936002)(229853001)(305945005)(86362001)(7846002)(19580405001)(106466001)(97736004)(48376002)(2351001)(110136002)(105606002)(87936001)(81166006)(8666005)(2906002)(104016004)(356003)(4326007)(7059030)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2433; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC012; 1:z57ln0kkRfpEbybp25+7uhGLsSSi6XC5PqAaT7R6kxSCX8SxZzxmwx3Y3DxpqtvhOO3liXirO3Ceu0RE7K5W/NB4/6ATjY0Mp7JGuxoD1cEJGa7fJqra5Syr7/fvRyz8pqKqedX4IiDKozVBWQ3MLlBbiEEBQh3k9IwkRGM7m2vM3sYKD9a3t0WD5qtkTCRI5dPx7K4q21hrkBVg8dujjvNWC7KUX62aCByBAjhl/fFQQGGYQnJiKzMyiOxB7zSjVxUtkGk5O7ezwBS8st7WLB4WyxQIsFixxOpvbog3qrHPkX5qv6hBrts2EOONBz9wAwlbRM25S9sIFWAEN7Kxa4C1/VYYmIgcaHdfgwGznc7Pl4Dd2wV6ghsDtrwDcAB/el5VkJjHEvOAnN6bV32wKKS3MkQZkhpsD8ONCzTj/8fhhjYGm6Qow9JKS84kK/Top6mqYdqV/Xsu1uyOwRNSTrefkgcihdjKU8jc5NLcECFlQ5DRGiLdNqjS6c6ONSxD6ZcCu5Ze+sDL/oc29wvtEKeJB+GnzzT2MOaOIunR1TQtP+RCTG2RXwA9zgbQ7hrYpKPoKSDmFzqxFcsV43AVvhEMhKc4B4tjdsl1KbGg7ykPQ79gv9EsWGWai44/E1G1wBsYFLNDyJ0BVJ5/Jh27QjlxCxlgbESYYheI/O+PTkQSLq0ytN9ktmyqEAj/UQQ4/+/fra941Azy6Q3pgS463BFHNAV2Cv6WST9Ntbvst4I= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: c397232a-bf5e-4742-8a73-08d3d18e3828 X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2433; 2:VcWv/0zuiOn70WU1E6kthB9t3vEgfQlk0MOgUK5yuNnJQX7mecpINOk1C2FUxFfPA7bm7YdLfagrZUKWnpTw9HjjpY7v6EsXX2ycPsGY6oQhLvjbDDfoSiStWKS74/FAl7sduo40QLHeNPYLvQ6BpnRpwP4jw0cBYTfGYkDV/pWm10VVrOphcS1fWgSPxdFA; 3:zh+uRIf1uQ97PLpPwMn2z07is3dLTLX8bR1PFK681MRkS4NJX9QApdIb3HnNWe0L2280HVrCCzIGwxEpNECiE+CiHAGj90eiOxLODoUeacOVWqSHSaTsmdJvSWqaN/wSP+TUMBQLdmQ8/FbRJeA9gfaRcKLV+J2errUXFqAZBUnRzVw4iB7PNmoEk2jnZAuVjO/cA1Nb3s5qs9zkHV/JwzLP9hpKJNom0k/m0cTLpj4=; 25:uM1DKON7mq4kak5xw3rWlnfHlSiHb43vkIRnT2qCCdyPydmEUD9eI+tzR/7GxdEKwp5ABOnBob+mBBoCsYYf1B2oWccxvZTLuluogp4Sls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YaZGr+CK/UXl8VZoLgW4Cr2J/oLj3/CvY/bW95M3lRDAAd1ZnA6arjkdJ40wtD0tpOL6T5UIIciJCQvt12103VCT867SJzoBIIaNrd7K2pQudexY9ktQRJLiVUWg8DqrOY08= 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)(13017025)(13015025)(13018025)(13023025)(13024025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BN6PR03MB2433; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2433; X-Forefront-PRVS: 00514A2FE6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2433; 23:FMHrQ+zaaflWP7Z0c8H0QGIacRMOnOJqy5KkeOguW?= =?us-ascii?Q?kpV/2rOJ12GoO0tHsCcVd1cPS5nnNemOcpoqVz7vDKu1w9BbdeOsOtCz74Tz?= =?us-ascii?Q?fbGNvjBY8x6TKCuMRIglmAb6jGzvrmwC0QpXaN4ccN6DxN0IbBLXsOIMGMPL?= =?us-ascii?Q?sQA/ZdDCDAB1ZXqgLJSiqzhLejSF6j6MPR36BOqEfOD73Zgdu4mhWxewSIiX?= =?us-ascii?Q?lXqvluD97Sy6Eh8xSDzb+VN6D2qE6bFk7RrdlHBc96CSoABe0pXB3WCjeyjY?= =?us-ascii?Q?ZRmJM1i62+7arDnR31r3mkEP968TTDV7pbA93lUK9ymS6iaoMEXuNe6rT187?= =?us-ascii?Q?h1JM82t9/hGV+1F7qp1MHCOsttniZQ4hweyieKBg+tG4riR6MARzDMCFl9l8?= =?us-ascii?Q?D40YP7lELvoRdI/tvt0e+CuawcqtyE2VOldDmg8veudu6pb2+Oo5qY516HEB?= =?us-ascii?Q?NKBRB81dqD4vR2RsVZnoS5R/yi74SOJdEgEyAwgswz29cdKybhmHtM06K8df?= =?us-ascii?Q?mjoPEVtSEe3IIYROg4vqLG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gTafzooKXQfP9VGg/5fhd+ErUn5LwYqAfO5kDUakG3sDcE+3v1MDAy2kIi/1DCKCdYS8PfG+j5827Uxu5k7aWoD5nucBBLEN41K7EvEGkZqaWEaVkaZLjCR0KTXk03AZpORA1cDVOY/iu6nj0RipUyyX7d5V4AAvE97d6HhddZVjqM=; 5:VEbxc5TpRqvU/PRk/GhSo6v0PeYVWLS391ACJGo7hOWsQwx+5yEEXOYcHjV50i3SXEJTQ5Q6vPW8MapU7aRdpkRxX67SX+QTD/9ktOKZlP4umvo/tR9ro4nLBKr5WB8dVP/ky6KWK6vBNmGlEcMd34WTOyrTJAycPC2B681HssE=; 24:Dwj04MTjnEvVIVRJA06E5gib0TTvTTC4WBYCog7rlpwDARMmbOf7vXE8EC2MhBtjPpwmzCBrOi2t2trp1NFbv4YwZx1GIqGKPeZKv+nma+s=; 7:ucNvLFgAYeNi8wfsJaJyhvVqOYpP2V3yXNoIneTmoD0niPRCFSE0eJThEG4EPWBZ4WO4Obvjl6H6tz2nqpR+7A98f9+ZfNF+FRElGMuH9h2E7F+3z2BxF4egQ55ozUuJIGqND9YkpXU7IZUzDLFdoRlylcqtam2rfx9eDa2aLXO+De17wWxmbxYf5K4i9hTT++elHcAgFSBwMM91x/CFHeTmo0lIQWE/RE0iNY2CtqFBFVjXGfvTlqLtQEKx8Lv6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2016 11:01:54.5398 (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: BN6PR03MB2433 Subject: [dpdk-dev] [PATCH v2 10/14] 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: Wed, 31 Aug 2016 11:02:00 -0000 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 d54ec9e..b10d985 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -242,7 +242,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)); @@ -303,7 +303,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 2a697ec..8320dc4 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1842,7 +1842,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