From: Zhi Wang Date: Thu, 16 Jun 2016 12:06:58 +0000 (-0400) Subject: drm/i915: Use offsetof() to calculate the offset of members in PVINFO page X-Git-Tag: v4.9.8~1110^2~42^2~455 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2a5d1e7162889ad28a2bd96fb556540866f599c;p=platform%2Fkernel%2Flinux-rpi3.git drm/i915: Use offsetof() to calculate the offset of members in PVINFO page To get the offset of the members in PVINFO page, offsetof() looks much better than the tricky approach in current code. v7: - Move "offsetof()" modification into a dedicated patch. (Joonas) Suggested-by: Joonas Lahtinen Reviewed-by: Joonas Lahtinen Cc: Joonas Lahtinen Signed-off-by: Zhi Wang Link: http://patchwork.freedesktop.org/patch/msgid/1466078825-6662-3-git-send-email-zhi.a.wang@intel.com Signed-off-by: Chris Wilson --- diff --git a/drivers/gpu/drm/i915/i915_pvinfo.h b/drivers/gpu/drm/i915/i915_pvinfo.h index e61144d..c0cb297 100644 --- a/drivers/gpu/drm/i915/i915_pvinfo.h +++ b/drivers/gpu/drm/i915/i915_pvinfo.h @@ -104,7 +104,7 @@ struct vgt_if { } __packed; #define vgtif_reg(x) \ - _MMIO((VGT_PVINFO_PAGE + (long)&((struct vgt_if *)NULL)->x)) + _MMIO((VGT_PVINFO_PAGE + offsetof(struct vgt_if, x))) /* vGPU display status to be used by the host side */ #define VGT_DRV_DISPLAY_NOT_READY 0