[Intel-gfx] [PATCH] drm/i915: prefer INTEL_GEN(dev_priv) to INTEL_INFO(dev)->gen

Dave Gordon david.s.gordon at intel.com
Fri Sep 9 22:43:11 UTC 2016


On 09/09/16 22:58, Chris Wilson wrote:
> On Fri, Sep 09, 2016 at 10:37:46PM +0100, Dave Gordon wrote:
>> More Coccinellery ...
>>
>> Wherever we find "INTEL_INFO(dev)->gen", and have a suitable
>> "dev_priv" in scope, replace it with "INTEL_GEN(dev_priv)",
>> which is the preferred wasy to access this device property.
>>
>> This patch covers all the files that contained only relatively
>> few instances, and where no manual fixup was required. A few
>> more complex instances may be updated in a later patch.
>>
>> @dev_priv_param@
>> function FUNC;
>> idexpression struct drm_device *DEV;
>
> Oh. That's how you catch those.
>
>> identifier DEV_PRIV;
>> @@
>> FUNC(..., struct drm_i915_private *DEV_PRIV, ...)
>> {
>>     <...
>> -   INTEL_INFO(DEV)->gen
>> +   INTEL_GEN(DEV_PRIV)
>>     ...>
>> }
>>
>> @dev_priv_local@
>> idexpression struct drm_device *DEV;
>> identifier DEV_PRIV;
>> expression E;
>> @@
>> {
>>     ...
>> (
>>     struct drm_i915_private *DEV_PRIV;
>> |
>>     struct drm_i915_private *DEV_PRIV = E;
>> )
>>     <...
>> -   INTEL_INFO(DEV)->gen
>> +   INTEL_GEN(DEV_PRIV)
>>     ...>
>> }
>
> Looks good, will have to wait until just after another merge point so
> that we can apply to dinq (as well as applies to nightly).
>
> Nothing appeared out-of-place running this against intel_display.c, just
> a residual unused struct drm_dev.
>
> Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
> -Chris

Thanks, the other things I was thinking of fixing in the remaining files 
were generally things like

   if (INTEL_INFO(dev)->gen < 5 || IS_G33(dev))

where the Cocci script spotted the first half but left a reference to 
'dev' in the IS_X() call, which might be worth changing at the same time 
in these specific cases. Of course I've got a Coccinelle script to 
convert all the IS_X() macros too but that does produce rather too much 
churn for one patch!

.Dave.


More information about the Intel-gfx mailing list