From: Jani Nikula <jani.nikula@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [RFC 0/4] drm/i915/registers: use standard bits.h and bitfield.h macros
Date: Thu, 27 Sep 2018 14:44:09 +0300 [thread overview]
Message-ID: <87h8ibrwqe.fsf@intel.com> (raw)
In-Reply-To: <87mus3rxpy.fsf@intel.com>
On Thu, 27 Sep 2018, Jani Nikula <jani.nikula@intel.com> wrote:
> On Thu, 27 Sep 2018, Michal Wajdeczko <michal.wajdeczko@intel.com> wrote:
>> On Thu, 27 Sep 2018 11:40:19 +0200, Jani Nikula <jani.nikula@intel.com>
>> wrote:
>>
>>> This is an RFC to get input on how people feel about moving towards
>>> using <linux/bits.h> and <linux/bitfield.h> macros for register field
>>> definitions and manipulation:
>>>
>>> * BIT()
>>> * GENMASK()
>>
>> BIT/GENMASK macros assumes 'unsigned long' type (64b) while our registers
>> (and some of our temporary variables) are 'unsigned int' (32b).
>
> I don't see a problem with that as long as we stick to unsigned types.
Okay, there's a problem with mixing (1 << n) with GENMASK, as the former
is signed. Using BIT() and GENMASK() together works better.
Another slight annoyance is printf formats, which are currently written
for unsigned ints, and passing GENMASK or BIT to prints will make them
require unsigned longs. I don't think we use that a whole lot, but it's
a consideration.
If all else fails, we can write our own wrappers for u32, though it's a
bit meh.
BR,
Jani.
>
>> It was reported [1] that use of plain BIT(0) may cause compilation issues.
>
> That mixes signed and unsigned types.
>
>
> BR,
> Jani.
>
>>
>> Michal
>>
>> [1]
>> https://lists.freedesktop.org/archives/intel-gfx/2018-September/176704.html
>>
>>> * FIELD_GET()
>>> * FIELD_PREP()
>>
>>
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-09-27 11:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-27 9:40 [RFC 0/4] drm/i915/registers: use standard bits.h and bitfield.h macros Jani Nikula
2018-09-27 9:40 ` [RFC 1/4] drm/i915/registers: prefer GENMASK() over hand rolled masks Jani Nikula
2018-09-28 8:34 ` Mika Kuoppala
2018-09-27 9:40 ` [RFC 2/4] drm/i915/registers: prefer BIT() for single bits Jani Nikula
2018-09-27 9:40 ` [RFC 3/4] drm/i915/registers: deprecate _SHIFT in favor of FIELD_GET() and _MASK Jani Nikula
2018-09-27 9:40 ` [RFC 4/4] drm/i915/registers: define field values using FIELD_PREP() Jani Nikula
2018-09-27 10:35 ` Chris Wilson
2018-09-27 11:53 ` Jani Nikula
2018-09-27 12:44 ` Jani Nikula
2018-09-27 12:02 ` Joonas Lahtinen
2018-09-27 9:44 ` [RFC 0/4] drm/i915/registers: use standard bits.h and bitfield.h macros Jani Nikula
2018-09-27 11:09 ` Michal Wajdeczko
2018-09-27 11:22 ` Jani Nikula
2018-09-27 11:44 ` Jani Nikula [this message]
2018-09-27 14:20 ` ✗ Fi.CI.BAT: failure for " Patchwork
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=87h8ibrwqe.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).