From patchwork Wed Nov 16 08:55:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 9431105 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 A2A6F6021C for ; Wed, 16 Nov 2016 08:56:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9387F28E91 for ; Wed, 16 Nov 2016 08:56:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8838D28EA8; Wed, 16 Nov 2016 08:56:39 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 4632028E91 for ; Wed, 16 Nov 2016 08:56:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CD8A86E680; Wed, 16 Nov 2016 08:56:34 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 017A26E670 for ; Wed, 16 Nov 2016 08:56:07 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id a20so8783567wme.2 for ; Wed, 16 Nov 2016 00:56:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=inEbytbVocOua0YYi5Z1Dluq4BTqE5ZUr9T6u0muPEM=; b=Z0XmNP7T9Wq/eknormG1n/l8qqsi2eH3YoELvKFvWFCZSMHlP8OiLzGYAp3YtsDDdi lNj7CxkOtsaOgzc7GNdZfKQ02D52VHLq9j0FfOxUwG0IjiDbZe3u5HYXG8lYttKGe0eY qThaWX4nJt5ikAk6DenPbv3iAfbq8lat6jmWaI3KIh9p7yB4I4o3GVd4YleZ4tN6s6i4 fj7nUwbSIG5rfGD6ho82o44Ft3YXivGteJYNtREE5ixYZ9ZfTF6w7xYCMWjCZyemYsSO KcFWI4FAkCmyYQPgTG1wXPBivzvg8y4yj2Nmj7tpDXqAbsdWB58ncDKfH3H8iEFV4wSb 3OUQ== 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:mime-version:content-transfer-encoding; bh=inEbytbVocOua0YYi5Z1Dluq4BTqE5ZUr9T6u0muPEM=; b=ZEb1nrpIp0HGpRP22csuTWy8EffSEvDo9ydOy2Qs5NojjetzSPQo7t/I7lRISC4qWp sbA7BA82V8Lop22RLAYgkbLkllI/PDrMtx4GP5sIvxRn+9TDYixUao4MxK/epv5p/OiZ +GW8vy+isvCx0aMZW/4sOMM6OSj94gE1SyrGENxD/YtsTprDMXU7y8dWOw+EiEyTHVbD HyqOU+L5Po9oB5qZfBrFuyCTjeQ+R0L93K+u90dWY5chzoOlfo0D43M+vViUktfSYpfq SjX/WJ97O9AZqKugbRihAumEKxI4GCY+HepseF6lMJ/VR2km4J/FDE7Weo4sJAM/af9c IqyA== X-Gm-Message-State: ABUngvdmp5Ivp6CamxpxkuF/joH0WKR6Zr3LaRHbM0FiihHP6SWOnTeRmfIX/6W3SEH2Dw== X-Received: by 10.28.165.131 with SMTP id o125mr8061967wme.9.1479286565320; Wed, 16 Nov 2016 00:56:05 -0800 (PST) Received: from t460p.intel ([2a02:c7d:9bd6:b000:f37e:1e07:a7d8:46cd]) by smtp.gmail.com with ESMTPSA id l187sm8885201wml.6.2016.11.16.00.56.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2016 00:56:04 -0800 (PST) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Wed, 16 Nov 2016 08:55:45 +0000 Message-Id: <1479286545-15020-16-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479286545-15020-1-git-send-email-tvrtko.ursulin@linux.intel.com> References: <1479286545-15020-1-git-send-email-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 15/15] drm/i915: Remove __I915__ magic macro 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin And at the same time introduce a static inline helper for more type safety. Signed-off-by: Tvrtko Ursulin Suggested-by: Ville Syrjälä --- drivers/gpu/drm/i915/i915_drv.h | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index a9710f7a5d60..2f3e7139ae55 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2359,18 +2359,13 @@ struct drm_i915_cmd_table { int count; }; -/* Note that the (struct drm_i915_private *) cast is just to shut up gcc. */ -#define __I915__(p) ({ \ - struct drm_i915_private *__p; \ - if (__builtin_types_compatible_p(typeof(*p), struct drm_i915_private)) \ - __p = (struct drm_i915_private *)p; \ - else if (__builtin_types_compatible_p(typeof(*p), struct drm_device)) \ - __p = to_i915((struct drm_device *)p); \ - else \ - BUILD_BUG(); \ - __p; \ -}) -#define INTEL_INFO(p) (&__I915__(p)->info) +static inline const struct intel_device_info * +intel_info(const struct drm_i915_private *dev_priv) +{ + return &dev_priv->info; +} + +#define INTEL_INFO(dev_priv) intel_info((dev_priv)) #define INTEL_GEN(dev_priv) ((dev_priv)->info.gen) #define INTEL_DEVID(dev_priv) ((dev_priv)->info.device_id)