diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-01 13:39:55 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-05 13:03:21 -0400 |
commit | 2c1792a10b10e41dcf34c97304fb8f75e52e7112 (patch) | |
tree | e1173623fc7a2fbc05e98798d06bd6ca692475b5 | |
parent | b3ae96a8ea1cbd0970459b6efd7ea7550fe033c6 (diff) |
drm/i915: Tidy the macro casting by using an inline function
Some of our macros we trying to convert from an drm_device to a
drm_i915_private and then use the pointer inline. This is not only
cumbersome but prone to error. Replacing it with a typesafe function
should help catch those errors in future.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
[danvet: Squash in fixup to correctly order static vs. inline
qualifiers, static comes first. Also fix up another offender.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index ace691b23072..0b7583cafa3f 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1223,6 +1223,11 @@ typedef struct drm_i915_private { | |||
1223 | struct i915_ums_state ums; | 1223 | struct i915_ums_state ums; |
1224 | } drm_i915_private_t; | 1224 | } drm_i915_private_t; |
1225 | 1225 | ||
1226 | static inline struct drm_i915_private *to_i915(const struct drm_device *dev) | ||
1227 | { | ||
1228 | return dev->dev_private; | ||
1229 | } | ||
1230 | |||
1226 | /* Iterate over initialised rings */ | 1231 | /* Iterate over initialised rings */ |
1227 | #define for_each_ring(ring__, dev_priv__, i__) \ | 1232 | #define for_each_ring(ring__, dev_priv__, i__) \ |
1228 | for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \ | 1233 | for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \ |
@@ -1484,7 +1489,7 @@ struct drm_i915_file_private { | |||
1484 | struct i915_ctx_hang_stats hang_stats; | 1489 | struct i915_ctx_hang_stats hang_stats; |
1485 | }; | 1490 | }; |
1486 | 1491 | ||
1487 | #define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info) | 1492 | #define INTEL_INFO(dev) (to_i915(dev)->info) |
1488 | 1493 | ||
1489 | #define IS_I830(dev) ((dev)->pci_device == 0x3577) | 1494 | #define IS_I830(dev) ((dev)->pci_device == 0x3577) |
1490 | #define IS_845G(dev) ((dev)->pci_device == 0x2562) | 1495 | #define IS_845G(dev) ((dev)->pci_device == 0x2562) |
@@ -1578,7 +1583,7 @@ struct drm_i915_file_private { | |||
1578 | #define INTEL_PCH_LPT_DEVICE_ID_TYPE 0x8c00 | 1583 | #define INTEL_PCH_LPT_DEVICE_ID_TYPE 0x8c00 |
1579 | #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE 0x9c00 | 1584 | #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE 0x9c00 |
1580 | 1585 | ||
1581 | #define INTEL_PCH_TYPE(dev) (((struct drm_i915_private *)(dev)->dev_private)->pch_type) | 1586 | #define INTEL_PCH_TYPE(dev) (to_i915(dev)->pch_type) |
1582 | #define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT) | 1587 | #define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT) |
1583 | #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT) | 1588 | #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT) |
1584 | #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) | 1589 | #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) |
@@ -1975,7 +1980,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, | |||
1975 | void i915_gem_object_release_stolen(struct drm_i915_gem_object *obj); | 1980 | void i915_gem_object_release_stolen(struct drm_i915_gem_object *obj); |
1976 | 1981 | ||
1977 | /* i915_gem_tiling.c */ | 1982 | /* i915_gem_tiling.c */ |
1978 | inline static bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj) | 1983 | static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj) |
1979 | { | 1984 | { |
1980 | drm_i915_private_t *dev_priv = obj->base.dev->dev_private; | 1985 | drm_i915_private_t *dev_priv = obj->base.dev->dev_private; |
1981 | 1986 | ||