From patchwork Mon Jan 2 10:25:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foss X-Patchwork-Id: 9493323 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 5B78B62AB2 for ; Mon, 2 Jan 2017 10:26:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5378E205AB for ; Mon, 2 Jan 2017 10:26:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4802426212; Mon, 2 Jan 2017 10:26:16 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham 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 E6B32205AB for ; Mon, 2 Jan 2017 10:26:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1ED626E401; Mon, 2 Jan 2017 10:26:09 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F40A6E403 for ; Mon, 2 Jan 2017 10:26:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: robertfoss) with ESMTPSA id 0C955267271 From: Robert Foss To: intel-gfx@lists.freedesktop.org, Tomeu Vizoso , Robert Bragg , Chris Wilson Date: Mon, 2 Jan 2017 05:25:55 -0500 Message-Id: <20170102102555.9056-3-robert.foss@collabora.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170102102555.9056-1-robert.foss@collabora.com> References: <20170102102555.9056-1-robert.foss@collabora.com> Subject: [Intel-gfx] [PATCH i-g-t v4 2/2] lib/ioctl_wrappers.h: Add to_user_pointer() helper X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Add to_user_pointer() helper function which helps cast pointers properly when being used with ioctls. Signed-off-by: Robert Foss --- lib/ioctl_wrappers.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index 26270975..2ac57f47 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -239,4 +239,15 @@ int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height, uint32_t stride, uint32_t pixel_format, uint64_t modifier, uint32_t flags, uint32_t *buf_id); +/** + * to_user_pointer: + * + * Makes sure that pointer on 32 and 64-bit systems + * are casted properly for being sent through an ioctl. + */ +inline uint64_t to_user_pointer(void *ptr) +{ + return (uint64_t)(uintptr_t) ptr; +} + #endif /* IOCTL_WRAPPERS_H */