From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH 15/15] drm/i915: Remove __I915__ magic macro
Date: Wed, 16 Nov 2016 08:55:45 +0000 [thread overview]
Message-ID: <1479286545-15020-16-git-send-email-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <1479286545-15020-1-git-send-email-tvrtko.ursulin@linux.intel.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
And at the same time introduce a static inline helper for
more type safety.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
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)
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-11-16 8:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-16 8:55 [PATCH 00/15] Remove __I915__ magic macro Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 01/15] drm/i915: dev_priv and a small cascade of cleanups in i915_gem.c Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 02/15] drm/i915: Use dev_priv in INTEL_INFO in i915_gem_execbuffer.c Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 03/15] drm/i915: Use dev_priv in INTEL_INFO in i915_gem_fence_reg.c Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 04/15] drm/i915: dev_priv cleanup in i915_gem_gtt.c Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 05/15] drm/i915: dev_priv cleanup in i915_gem_stolen.c Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 06/15] drm/i915: dev_priv cleanup in i915_gem_tiling.c Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 07/15] drm/i915: dev_priv cleanup in i915_gpu_error.c Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 08/15] drm/i915: dev_priv cleanup in i915_irq.c Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 09/15] drm/i915: dev_priv cleanup in i915_suspend.c Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 10/15] drm/i915: Assorted INTEL_INFO(dev) cleanups Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 11/15] drm/i915: dev_priv cleanup in intel_dp.c Tvrtko Ursulin
2016-11-17 14:21 ` Maarten Lankhorst
2016-11-16 8:55 ` [PATCH 12/15] drm/i915: dev_priv cleanup in intel_pm.c Tvrtko Ursulin
2016-11-16 8:55 ` [PATCH 13/15] drm/i915: dev_priv cleanup in intel_display.c Tvrtko Ursulin
2016-11-16 12:32 ` [PATCH v2 " Tvrtko Ursulin
2016-11-17 14:20 ` Maarten Lankhorst
2016-11-16 8:55 ` [PATCH 14/15] drm/i915: Fix for_each_pipe argument in vlv_display_power_well_init Tvrtko Ursulin
2016-11-16 8:55 ` Tvrtko Ursulin [this message]
2016-11-16 9:05 ` [PATCH 00/15] Remove __I915__ magic macro Chris Wilson
2016-11-16 9:11 ` Chris Wilson
2016-11-16 9:52 ` Jani Nikula
2016-11-16 9:16 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-11-16 9:56 ` Tvrtko Ursulin
2016-11-17 14:06 ` Tvrtko Ursulin
2016-11-16 14:16 ` ✗ Fi.CI.BAT: warning for Remove __I915__ magic macro (rev2) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479286545-15020-16-git-send-email-tvrtko.ursulin@linux.intel.com \
--to=tursulin@ursulin.net \
--cc=Intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).