public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Dave Gordon <david.s.gordon@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/6] drm/i915: Rename the magic polymorphic macro __I915__
Date: Wed, 20 Apr 2016 15:27:56 +0100	[thread overview]
Message-ID: <571791EC.3010504@intel.com> (raw)
In-Reply-To: <1460742365-3646-2-git-send-email-chris@chris-wilson.co.uk>

On 15/04/16 18:46, Chris Wilson wrote:
> To open up the future of using a generic to_i915() convenience macro,
> rename the existing __I915__ superconvenience macro.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/i915_drv.h | 22 +++++++++++-----------
>   1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 78231cc5f40b..6569ebfe8cf1 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2004,14 +2004,14 @@ struct drm_i915_private {
>   	 */
>   };
>
> -static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
> +static inline struct drm_i915_private *__to_i915(const struct drm_device *dev)
>   {
>   	return dev->dev_private;
>   }

Could we call this drm_to_i915() ? I like the pattern of XXX_to_i915() 
for XXX in { dev, drm, guc, obj, req, ... }

.Dave.

> -static inline struct drm_i915_private *dev_to_i915(struct device *dev)
> +static inline struct drm_i915_private *dev_to_i915(const struct device *dev)
>   {
> -	return to_i915(dev_get_drvdata(dev));
> +	return __to_i915(dev_get_drvdata(dev));
>   }
>
>   static inline struct drm_i915_private *guc_to_i915(struct intel_guc *guc)
> @@ -2492,20 +2492,20 @@ struct drm_i915_cmd_table {
>   };
>
>   /* Note that the (struct drm_i915_private *) cast is just to shut up gcc. */
> -#define __I915__(p) ({ \
> +#define to_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); \
> +		__p = __to_i915((struct drm_device *)p); \
>   	else \
>   		BUILD_BUG(); \
>   	__p; \
>   })
> -#define INTEL_INFO(p) 	(&__I915__(p)->info)
> +#define INTEL_INFO(p) 	(&to_i915(p)->info)
>   #define INTEL_GEN(p)	(INTEL_INFO(p)->gen)
>   #define INTEL_DEVID(p)	(INTEL_INFO(p)->device_id)
> -#define INTEL_REVID(p)	(__I915__(p)->dev->pdev->revision)
> +#define INTEL_REVID(p)	(to_i915(p)->dev->pdev->revision)
>
>   #define REVID_FOREVER		0xff
>   /*
> @@ -2630,7 +2630,7 @@ struct drm_i915_cmd_table {
>   #define HAS_VEBOX(dev)		(INTEL_INFO(dev)->ring_mask & VEBOX_RING)
>   #define HAS_LLC(dev)		(INTEL_INFO(dev)->has_llc)
>   #define HAS_SNOOP(dev)		(INTEL_INFO(dev)->has_snoop)
> -#define HAS_EDRAM(dev)		(__I915__(dev)->edram_cap & EDRAM_ENABLED)
> +#define HAS_EDRAM(dev)		(to_i915(dev)->edram_cap & EDRAM_ENABLED)
>   #define HAS_WT(dev)		((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \
>   				 HAS_EDRAM(dev))
>   #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
> @@ -2714,11 +2714,11 @@ struct drm_i915_cmd_table {
>   #define INTEL_PCH_P3X_DEVICE_ID_TYPE		0x7000
>   #define INTEL_PCH_QEMU_DEVICE_ID_TYPE		0x2900 /* qemu q35 has 2918 */
>
> -#define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
> +#define INTEL_PCH_TYPE(dev) (to_i915(dev)->pch_type)
>   #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)
>   #define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT)
> -#define HAS_PCH_LPT_LP(dev) (__I915__(dev)->pch_id == INTEL_PCH_LPT_LP_DEVICE_ID_TYPE)
> -#define HAS_PCH_LPT_H(dev) (__I915__(dev)->pch_id == INTEL_PCH_LPT_DEVICE_ID_TYPE)
> +#define HAS_PCH_LPT_LP(dev) (to_i915(dev)->pch_id == INTEL_PCH_LPT_LP_DEVICE_ID_TYPE)
> +#define HAS_PCH_LPT_H(dev) (to_i915(dev)->pch_id == INTEL_PCH_LPT_DEVICE_ID_TYPE)
>   #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)
>   #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
>   #define HAS_PCH_NOP(dev) (INTEL_PCH_TYPE(dev) == PCH_NOP)
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-04-20 14:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15 17:45 Polymorphic to_i915() Chris Wilson
2016-04-15 17:46 ` [PATCH 1/6] drm/i915: Rename the magic polymorphic macro __I915__ Chris Wilson
2016-04-20 14:27   ` Dave Gordon [this message]
2016-04-15 17:46 ` [PATCH 2/6] drm/i915: Allow passing any known pointer to for_each_engine() Chris Wilson
2016-04-15 17:46 ` [PATCH 3/6] drm/i915: Extend magic to_i915() to work with drm_i915_gem_object Chris Wilson
2016-04-15 17:46 ` [PATCH 4/6] drm/i915: Use to_i915() instead of guc_to_i915() Chris Wilson
2016-04-15 17:46 ` [PATCH 5/6] drm/i915: Teach to_i915() how to extract drm_i915_private from requests Chris Wilson
2016-04-15 17:46 ` [PATCH 6/6] drm/i915: Teach to_i915() how to extract drm_i915_private from engines Chris Wilson
2016-04-18  9:18 ` Polymorphic to_i915() Jani Nikula
2016-04-18 11:11   ` Dave Gordon
2016-04-18 11:49     ` Jani Nikula
2016-04-18 12:09       ` Chris Wilson
2016-04-20 12:57   ` Daniel Vetter
2016-04-20 14:29     ` Dave Gordon
2016-04-20 15:26     ` Mika Kuoppala
  -- strict thread matches above, loose matches on Subject: below --
2016-03-18 21:16 [PATCH 1/6] drm/i915: Rename the magic polymorphic macro __I915__ Chris Wilson

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=571791EC.3010504@intel.com \
    --to=david.s.gordon@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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