linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "Christian König" <christian.koenig@amd.com>
Cc: Paul Menzel <pmenzel@molgen.mpg.de>,
	Alex Deucher <alexander.deucher@amd.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] moduleparams: Add hex type parameter
Date: Thu, 2 Jul 2020 12:42:37 -0700	[thread overview]
Message-ID: <CAHk-=wimBucBdC+tzFEuFJU5X1UFTVWo+AHMvQTSkCcVnTT-ww@mail.gmail.com> (raw)
In-Reply-To: <7c31d918-c967-5ebb-970e-7f6e913237e8@amd.com>

On Thu, Jul 2, 2020 at 7:42 AM Christian König <christian.koenig@amd.com> wrote:
>
> I'm just not sure how well this is received upstream because it only
> covers u32
>
> On the other hand that is probably also the most used.

Not necessarily true. I'd argue that "unsigned long"  is equally
possible for some bit mask (or other hex-likely) type.

So don't call it just "hex". Call it "hexint" (the hex does imply
"unsigned", I feel - showing hex numbers with a sign sounds insane).

That way, if somebody ends up wanting it for unsigned long values,
we're not stuck.

Another option is to just say that hex values always have bit _sizes_.
So "hex32" and "hex64" would also make sense as names to me.

While at it, should the hex numbers always be padded out to the size?
The example Paul used doesn't have that issue (high bit being set).

Bbut often it may make sense to show a 32-bit hex number as "%#08x"
because it really makes things clearer when you're looking at high
bits, say.

It's really hard to tell the difference between "just bit 27 set" and
"just bit 31" set otherwise, and that's not all that uncommon when the
bitmasks are sparse.

             Linus

  reply	other threads:[~2020-07-02 19:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02 14:01 [PATCH 1/2] moduleparams: Add hex type parameter Paul Menzel
2020-07-02 14:01 ` [PATCH 2/2] drm/amdgpu: Change type of module param `ppfeaturemask` to hex Paul Menzel
2020-07-02 14:42 ` [PATCH 1/2] moduleparams: Add hex type parameter Christian König
2020-07-02 19:42   ` Linus Torvalds [this message]
2020-07-03 13:52     ` Paul Menzel

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='CAHk-=wimBucBdC+tzFEuFJU5X1UFTVWo+AHMvQTSkCcVnTT-ww@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmenzel@molgen.mpg.de \
    /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).