From patchwork Thu Mar 17 17:30:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 8613501 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4ECC2C0553 for ; Thu, 17 Mar 2016 17:30:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64692202F0 for ; Thu, 17 Mar 2016 17:30:55 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 31714202F2 for ; Thu, 17 Mar 2016 17:30:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 63DE66EACA; Thu, 17 Mar 2016 17:30:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw0-f195.google.com (mail-yw0-f195.google.com [209.85.161.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BA0C6EACC for ; Thu, 17 Mar 2016 17:30:37 +0000 (UTC) Received: by mail-yw0-f195.google.com with SMTP id m126so7015212ywd.2 for ; Thu, 17 Mar 2016 10:30:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/pqDm26EzqPFjs8OuyHy45zi242/ACpUmxu5evQVhnY=; b=QfOU5KQeX/X6n/2EyIaoV/lMkxQ6BYfHPHJJ2kss2K3ztu+7uNfcW8p8n6jGSwcBYv 9ND3+fjz+787UYgoXEcJ9lLPNmfghcOALO3PEPIsmkdq5O6PPblCmNulwRxjW9szjnFC JY/5OPa3+AJ6OzmusAt9qqSE5PZ3KZjeT+WODxdcjM7Zm2B/yvzExxWnQeTQ3FEopFJ2 8k8ifGSc4YORxwKJR4wP+BdC+ftWBzstUZJly/FG5HeSLLgrdvBrZk55radglP5LMide HNTlunvJOBc8+t8XM/ePVIA4k4dCAJsRuA7yAaI/ok3Uu2POF4sOrqKWEmxBAq9peHBB cEUA== X-Gm-Message-State: AD7BkJLSEH3c5QXlsDGd9blkBUl1xVjc2vVuXlv67j3l0rPlRUet2jgPy8nhmTJiAHUE6A== X-Received: by 10.129.103.66 with SMTP id b63mr5174599ywc.127.1458235835242; Thu, 17 Mar 2016 10:30:35 -0700 (PDT) Received: from jade.localdomain ([177.194.47.65]) by smtp.gmail.com with ESMTPSA id r8sm5737970ywb.20.2016.03.17.10.30.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Mar 2016 10:30:34 -0700 (PDT) From: Gustavo Padovan To: Greg Kroah-Hartman Subject: [PATCH v9 2/3] kernel.h: add to_user_ptr() Date: Thu, 17 Mar 2016 14:30:16 -0300 Message-Id: <1458235817-28375-2-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1458235817-28375-1-git-send-email-gustavo@padovan.org> References: <1458235817-28375-1-git-send-email-gustavo@padovan.org> Cc: devel@driverdev.osuosl.org, Daniel Stone , Daniel Vetter , Riley Andrews , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Daniel Vetter , akpm@linux-foundation.org, Gustavo Padovan , John Harrison X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan This function had copies in 3 different files. Unify them in kernel.h. Cc: Andrew Morton Cc: David Airlie Cc: Daniel Vetter Cc: Rob Clark Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 5 ----- drivers/gpu/drm/i915/i915_drv.h | 5 ----- drivers/gpu/drm/msm/msm_gem_submit.c | 5 ----- include/linux/kernel.h | 5 +++++ 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index 1aba01a..b1fafb6 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -28,11 +28,6 @@ #define BO_LOCKED 0x4000 #define BO_PINNED 0x2000 -static inline void __user *to_user_ptr(u64 address) -{ - return (void __user *)(uintptr_t)address; -} - static struct etnaviv_gem_submit *submit_create(struct drm_device *dev, struct etnaviv_gpu *gpu, size_t nr) { diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b0847b9..c446895 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -3564,11 +3564,6 @@ static inline i915_reg_t i915_vgacntrl_reg(struct drm_device *dev) return VGACNTRL; } -static inline void __user *to_user_ptr(u64 address) -{ - return (void __user *)(uintptr_t)address; -} - static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m) { unsigned long j = msecs_to_jiffies(m); diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index 6d7cd3f..e9c8b96 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -28,11 +28,6 @@ #define BO_LOCKED 0x4000 #define BO_PINNED 0x2000 -static inline void __user *to_user_ptr(u64 address) -{ - return (void __user *)(uintptr_t)address; -} - static struct msm_gem_submit *submit_create(struct drm_device *dev, struct msm_gpu *gpu, int nr) { diff --git a/include/linux/kernel.h b/include/linux/kernel.h index f31638c..c0a6001 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -53,6 +53,11 @@ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +static inline void __user *to_user_ptr(u64 address) +{ + return (void __user *)(uintptr_t)address; +} + /* * This looks more complex than it should be. But we need to * get the type for the ~ right in round_down (it needs to be