[Intel-gfx] [PATCH] drm/i915: add register macro definition style guide

Jani Nikula jani.nikula at intel.com
Tue Aug 8 08:38:18 UTC 2017


On Mon, 07 Aug 2017, Rodrigo Vivi <rodrigo.vivi at gmail.com> wrote:
> good idea.
>
>
> On Mon, Aug 7, 2017 at 9:10 AM, Daniel Vetter <daniel at ffwll.ch> wrote:
>> On Fri, Aug 04, 2017 at 01:38:36PM +0300, Jani Nikula wrote:
>>
>>> + *
>>> + * For bit fields, define a _MASK and a _SHIFT macro. Define bit field contents
>>> + * so that they are already shifted in place, and can be directly OR'd. For
>>> + * convenience, function-like macros may be used to define bit fields, but do
>>> + * note that the macros may be needed to read as well as write the register
>>> + * contents.
>
> I'd mention define as needed if needed...
> to avoid people adding many definition for shifts and masks that will
> never get used...

With mask and shift defined you don't need to always look at the spec.

> also maybe to add that between name and content the real tabs are required
> as much tab as needed to make sure that all bits defines on that bit
> is vertically aligned.

Added.

> Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

Thanks.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list