From patchwork Sun Sep 25 06:50:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 9349507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 703F3601C2 for ; Sun, 25 Sep 2016 06:50:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F5E528D0E for ; Sun, 25 Sep 2016 06:50:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 546C028D18; Sun, 25 Sep 2016 06:50:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8C4228D0E for ; Sun, 25 Sep 2016 06:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936434AbcIYGuZ (ORCPT ); Sun, 25 Sep 2016 02:50:25 -0400 Received: from mail.kernel.org ([198.145.29.136]:40738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934317AbcIYGuY (ORCPT ); Sun, 25 Sep 2016 02:50:24 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1ADD20376; Sun, 25 Sep 2016 06:50:22 +0000 (UTC) Received: from localhost (unknown [193.47.165.251]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E2C1202E9; Sun, 25 Sep 2016 06:50:21 +0000 (UTC) From: Leon Romanovsky To: dledford@redhat.com, linux-rdma@vger.kernel.org Cc: jgunthorpe@obsidianresearch.com, yishaih@mellanox.com Subject: [PATCH rdma-core 3/5] utils: Remove container_of and offset local declarations Date: Sun, 25 Sep 2016 09:50:05 +0300 Message-Id: <1474786207-2149-4-git-send-email-leon@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474786207-2149-1-git-send-email-leon@kernel.org> References: <1474786207-2149-1-git-send-email-leon@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Leon Romanovsky Acked-by: Sean Hefty --- ibacm/linux/osd.h | 3 --- libmlx5/src/list.h | 19 ------------------- librdmacm/src/cma.h | 6 ------ 3 files changed, 28 deletions(-) diff --git a/ibacm/linux/osd.h b/ibacm/linux/osd.h index ec18f7b..1a738e0 100644 --- a/ibacm/linux/osd.h +++ b/ibacm/linux/osd.h @@ -55,9 +55,6 @@ #define LIB_DESTRUCTOR __attribute__((destructor)) #define CDECL_FUNC -#define container_of(ptr, type, field) \ - ((type *) ((void *) ptr - offsetof(type, field))) - #if __BYTE_ORDER == __LITTLE_ENDIAN #define htonll(x) bswap_64(x) #else diff --git a/libmlx5/src/list.h b/libmlx5/src/list.h index cd7d25b..4f96482 100644 --- a/libmlx5/src/list.h +++ b/libmlx5/src/list.h @@ -201,25 +201,6 @@ static inline void list_splice_init(struct list_head *list, } } -#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - -/** - * container_of - cast a member of a structure out to the containing structure - * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#ifndef container_of -#define container_of(ptr, type, member) ({ \ - const typeof(((type *)0)->member)*__mptr = (ptr); \ - (type *)((char *)__mptr - offsetof(type, member)); }) -#endif - - /** * list_entry - get the struct for this entry * @ptr: the &struct list_head pointer. diff --git a/librdmacm/src/cma.h b/librdmacm/src/cma.h index d640688..83d98b0 100644 --- a/librdmacm/src/cma.h +++ b/librdmacm/src/cma.h @@ -70,12 +70,6 @@ static inline uint64_t htonll(uint64_t x) { return x; } static inline uint64_t ntohll(uint64_t x) { return x; } #endif -#ifndef container_of -#define container_of(ptr, type, field) \ - ((type *) ((void *)ptr - offsetof(type, field))) -#endif - - /* * Fast synchronization for low contention locking. */