From patchwork Thu May 3 13:36:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 10380367 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 EBF5660541 for ; Fri, 4 May 2018 12:10:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CABFF29367 for ; Fri, 4 May 2018 12:10:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB981293F8; Fri, 4 May 2018 12:10:35 +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=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 57A9829367 for ; Fri, 4 May 2018 12:10:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 63FCE890AD; Fri, 4 May 2018 12:10:34 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A3E76E5E1; Thu, 3 May 2018 13:37:24 +0000 (UTC) Received: from localhost (unknown [193.47.165.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8288821749; Thu, 3 May 2018 13:37:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525354644; bh=kjSTdfZNDqlGC0x1QMJRiBWFCq7jrnkpE+5Gec8HHKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u4VWg3fEhg0Kha16uSSbvbDq8W11/HVv83+6/PwgLJjPcNbTRnUbYXqGpaekNcdff IJNekK/sVjqhKRacfAFIhI5EtxsBdUkYHZHjkdfFK3nqE8b7RG9T9ceAyrZvbmixzT V1iVidvgHI7NrL1Apn2zJ3qpP1L+6o39al50gS+0= From: Leon Romanovsky To: Doug Ledford , Jason Gunthorpe Date: Thu, 3 May 2018 16:36:55 +0300 Message-Id: <20180503133715.15276-2-leon@kernel.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180503133715.15276-1-leon@kernel.org> References: <20180503133715.15276-1-leon@kernel.org> X-Mailman-Approved-At: Fri, 04 May 2018 12:10:32 +0000 Subject: [Intel-gfx] [PATCH rdma-next 01/21] drm/i915: Move u64-to-ptr helpers to general header X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , RDMA mailing list , Yishai Hadas , Matan Barak , Leon Romanovsky , dri-devel@lists.freedesktop.org, Rodrigo Vivi , intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Leon Romanovsky The macro u64_to_ptr() and function ptr_to_u64() are useful enough to be part of general header, so move them there and allow RDMA subsystem reuse them. Signed-off-by: Leon Romanovsky --- drivers/gpu/drm/i915/i915_utils.h | 12 ++---------- include/linux/kernel.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 10 deletions(-) -- 2.14.3 diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h index 51dbfe5bb418..de3bfda7bf96 100644 --- a/drivers/gpu/drm/i915/i915_utils.h +++ b/drivers/gpu/drm/i915/i915_utils.h @@ -25,6 +25,8 @@ #ifndef __I915_UTILS_H #define __I915_UTILS_H +#include + #undef WARN_ON /* Many gcc seem to no see through this and fall over :( */ #if 0 @@ -102,16 +104,6 @@ __T; \ }) -static inline u64 ptr_to_u64(const void *ptr) -{ - return (uintptr_t)ptr; -} - -#define u64_to_ptr(T, x) ({ \ - typecheck(u64, x); \ - (T *)(uintptr_t)(x); \ -}) - #define __mask_next_bit(mask) ({ \ int __idx = ffs(mask) - 1; \ mask &= ~BIT(__idx); \ diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 6a1eb0b0aad9..a738393c9694 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -70,6 +70,18 @@ */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +static inline u64 ptr_to_u64(const void *ptr) +{ + return (uintptr_t)ptr; +} + +#define u64_to_ptr(T, x) ( \ +{ \ + typecheck(u64, x); \ + (T *)(uintptr_t)(x); \ +} \ +) + #define u64_to_user_ptr(x) ( \ { \ typecheck(u64, x); \