Linux Documentation
 help / color / mirror / Atom feed
From: "Sven Peter" <sven@svenpeter.dev>
To: "Aditya Garg" <gargaditya08@live.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>
Cc: "Aun-Ali Zaidi" <admin@kodeit.net>,
	"Maxime Ripard" <mripard@kernel.org>,
	"airlied@redhat.com" <airlied@redhat.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Petr Mladek" <pmladek@suse.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Sergey Senozhatsky" <senozhatsky@chromium.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"apw@canonical.com" <apw@canonical.com>,
	"joe@perches.com" <joe@perches.com>,
	"dwaipayanray1@gmail.com" <dwaipayanray1@gmail.com>,
	"lukas.bulwahn@gmail.com" <lukas.bulwahn@gmail.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"Hector Martin" <marcan@marcan.st>,
	"asahi@lists.linux.dev" <asahi@lists.linux.dev>
Subject: Re: [PATCH 1/2] lib/vsprintf: Add support for generic FourCCs by extending %p4cc
Date: Wed, 12 Mar 2025 16:34:06 +0100	[thread overview]
Message-ID: <ff3a9c58-5c7a-4c48-8a9e-cc828a43baed@app.fastmail.com> (raw)
In-Reply-To: <PN3PR01MB959715C19BCEA54426D24934B8D02@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>

Hi,


On Wed, Mar 12, 2025, at 13:03, Aditya Garg wrote:
>> On 12 Mar 2025, at 5:29 PM, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> 
>> Hi
>> 
>>> Am 12.03.25 um 12:49 schrieb Aditya Garg:
>>> 
>>>>> On 12 Mar 2025, at 5:16 PM, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>>> 
>>>> Hi
>>>> 
>>>>> Am 12.03.25 um 10:05 schrieb Aditya Garg:
>>>>> From: Hector Martin <marcan@marcan.st>
>>>>> 
>>>>> %p4cc is designed for DRM/V4L2 FourCCs with their specific quirks, but
>>>>> it's useful to be able to print generic 4-character codes formatted as
>>>>> an integer. Extend it to add format specifiers for printing generic
>>>>> 32-bit FourCCs with various endian semantics:
>>>>> 
>>>>> %p4ch    Host byte order
>>>>> %p4cn    Network byte order
>>>>> %p4cl    Little-endian
>>>>> %p4cb    Big-endian
>>>> That looks like someone trying to be too clever for their own good. Just my 2 cts.
>>> I don't understand what you are trying to say. Anyways, I thought it's obvious, but Petr's Ack is still left and thus cannot be merged into DRM for now unless he says so in this thread.
>> 
>> I'm trying to say that the author of this patch found the %p4cc functionality and over-generalized the feature. Source code should express the idea of what it's doing in clear terms. %p4ch somehow doesn't do that for me. Printing 4 bytes in various orders without context seems arbitrary and confusing.
>> 
>> (I don't really have a say here. I'm just asking to reconsider this change.)
>
> Ah I see. I'll checkout the macros you sent. The Asahi Linux SMC 
> drivers would need these as well, so I'll probably first wait for the 
> vsprintf maintainers and also Asahi Linux maintainers for their views.

I don't have a strong opinion either way: for SMC I just need to print
FourCC keys for debugging / information in a few places.

I'm preparing the SMC driver for upstreaming again (after a two year delay :-()
and was just going to use macros to print the SMC FourCC keys similar to
DRM_MODE_FMT/DRM_MODE_ARG for now to keep the series smaller and revisit
the topic later.

Right now I have these in my local tree (only compile tested so far):

#define SMC_KEY_FMT "%c%c%c%c (0x%08x)"
#define SMC_KEY_ARG(k) (k)>>24, (k)>>16, (k)>>8, (k), (k)

which are then used like this:

	dev_info(dev,
		"Initialized (%d keys " SMC_KEY_FMT " .. " SMC_KEY_FMT ")\n",
		 smc->key_count, SMC_KEY_ARG(smc->first_key),
		 SMC_KEY_ARG(smc->last_key));

Best,

Sven

  parent reply	other threads:[~2025-03-12 15:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12  9:04 [PATCH 0/2] Use proper printk format in appletbdrm Aditya Garg
2025-03-12  9:05 ` [PATCH 1/2] lib/vsprintf: Add support for generic FourCCs by extending %p4cc Aditya Garg
2025-03-12 11:46   ` Thomas Zimmermann
2025-03-12 11:49     ` Aditya Garg
2025-03-12 11:58       ` Thomas Zimmermann
2025-03-12 12:03         ` Aditya Garg
2025-03-12 12:07           ` Aditya Garg
2025-03-12 15:34           ` Sven Peter [this message]
2025-03-12 19:14             ` Aditya Garg
2025-03-12 19:28               ` Andy Shevchenko
2025-03-12 19:35                 ` Aditya Garg
2025-03-12 19:51                   ` Andy Shevchenko
2025-03-13  7:26                 ` Aditya Garg
2025-03-13  8:48                   ` Andy Shevchenko
2025-03-13  8:53                     ` Aditya Garg
2025-03-13  8:56                       ` Andy Shevchenko
2025-03-13  9:13                         ` Aditya Garg
2025-03-13 10:48                           ` Petr Mladek
2025-03-13 11:06                             ` Aditya Garg
2025-03-13 13:24                               ` Andy Shevchenko
2025-03-13 17:40                             ` Kees Cook
2025-03-13 17:42                               ` Aditya Garg
2025-03-14  0:05                                 ` Kees Cook
2025-03-12  9:06 ` [PATCH 2/2] drm/appletbdm: use %p4cl instead of %p4cc Aditya Garg
2025-03-12 11:51   ` Thomas Zimmermann
2025-03-12 14:51     ` andriy.shevchenko

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=ff3a9c58-5c7a-4c48-8a9e-cc828a43baed@app.fastmail.com \
    --to=sven@svenpeter.dev \
    --cc=admin@kodeit.net \
    --cc=airlied@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=apw@canonical.com \
    --cc=asahi@lists.linux.dev \
    --cc=corbet@lwn.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=dwaipayanray1@gmail.com \
    --cc=gargaditya08@live.com \
    --cc=joe@perches.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=lukas.bulwahn@gmail.com \
    --cc=marcan@marcan.st \
    --cc=mripard@kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=simona@ffwll.ch \
    --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