linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Pekka Paalanen <ppaalanen@gmail.com>,
	Algea Cao <algea.cao@rock-chips.com>
Cc: mripard@kernel.org, tzimmermann@suse.de,
	linux-kernel@vger.kernel.org, airlied@linux.ie,
	dri-devel@lists.freedesktop.org,
	maarten.lankhorst@linux.intel.com, daniel@ffwll.ch,
	linux-rockchip@lists.infradead.org
Subject: Re: Printing bitfields in the kernel (Re: [PATCH] drm: Parse Colorimetry data block from EDID)
Date: Thu, 27 Aug 2020 21:58:22 -0700	[thread overview]
Message-ID: <1fd895d12c756478ebfb92de1252b772b6fd417a.camel@perches.com> (raw)
In-Reply-To: <20200827103456.57edaf59@eldfell>

On Thu, 2020-08-27 at 10:34 +0300, Pekka Paalanen wrote:
> On Wed, 26 Aug 2020 22:23:28 +0800
> Algea Cao <algea.cao@rock-chips.com> wrote:
> 
> > CEA 861.3 spec adds colorimetry data block for HDMI.
> > Parsing the block to get the colorimetry data from
> > panel.

If flags are int, I could imagine another %p<foo> extension
where %*p<foo> is used like:

	printk("flags: %*p<foo>n", flags, bitstrings)

where flags is:

	BIT(0)
	BIT(1)
	...
	BIT(last)

and

	char *bitstrings[] = {
		"bit 0 description",
		"bit 1 description",
		...
		"last bit description"
	};

Or define YA struct with 2 entries as the struct members
and use that.

struct foo {
	unsigned long flags,
	char ** descriptions,
};

	struct foo bar = {.flags = <flags> .descriptions = bitstrings};

	printk("flags: %p<foo>\n, &bar);



  reply	other threads:[~2020-08-28  4:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 14:23 [PATCH] drm: Parse Colorimetry data block from EDID Algea Cao
2020-08-27  7:34 ` Printing bitfields in the kernel (Re: [PATCH] drm: Parse Colorimetry data block from EDID) Pekka Paalanen
2020-08-28  4:58   ` Joe Perches [this message]
2020-08-27 10:57 ` [PATCH] drm: Parse Colorimetry data block from EDID Ville Syrjälä
2020-08-28  1:07   ` crj
2020-08-31 19:53     ` Ville Syrjälä
2020-09-01  7:30       ` crj
2020-09-01 13:17         ` Daniel Vetter

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=1fd895d12c756478ebfb92de1252b772b6fd417a.camel@perches.com \
    --to=joe@perches.com \
    --cc=airlied@linux.ie \
    --cc=algea.cao@rock-chips.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ppaalanen@gmail.com \
    --cc=tzimmermann@suse.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).