[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871pvrpp4b.fsf@prevas.dk>
Date: Fri, 21 Feb 2025 11:29:40 +0100
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Aditya Garg <gargaditya08@...e.com>
Cc: "pmladek@...e.com" <pmladek@...e.com>, "rostedt@...dmis.org"
<rostedt@...dmis.org>, "andriy.shevchenko@...ux.intel.com"
<andriy.shevchenko@...ux.intel.com>, "senozhatsky@...omium.org"
<senozhatsky@...omium.org>, "corbet@....net" <corbet@....net>,
"maarten.lankhorst@...ux.intel.com" <maarten.lankhorst@...ux.intel.com>,
"mripard@...nel.org" <mripard@...nel.org>, "tzimmermann@...e.de"
<tzimmermann@...e.de>, "airlied@...il.com" <airlied@...il.com>,
"simona@...ll.ch" <simona@...ll.ch>, "akpm@...ux-foundation.org"
<akpm@...ux-foundation.org>, "apw@...onical.com" <apw@...onical.com>,
"joe@...ches.com" <joe@...ches.com>, "dwaipayanray1@...il.com"
<dwaipayanray1@...il.com>, "lukas.bulwahn@...il.com"
<lukas.bulwahn@...il.com>, "sumit.semwal@...aro.org"
<sumit.semwal@...aro.org>, "christian.koenig@....com"
<christian.koenig@....com>, "kekrby@...il.com" <kekrby@...il.com>,
"admin@...eit.net" <admin@...eit.net>, Orlando Chamberlain
<orlandoch.dev@...il.com>, "evepolonium@...il.com"
<evepolonium@...il.com>, "linux-doc@...r.kernel.org"
<linux-doc@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "dri-devel@...ts.freedesktop.org"
<dri-devel@...ts.freedesktop.org>, "linux-media@...r.kernel.org"
<linux-media@...r.kernel.org>, "linaro-mm-sig@...ts.linaro.org"
<linaro-mm-sig@...ts.linaro.org>, Hector Martin <marcan@...can.st>,
"linux@...linux.org.uk" <linux@...linux.org.uk>, "asahi@...ts.linux.dev"
<asahi@...ts.linux.dev>, Sven Peter <sven@...npeter.dev>, Janne Grunau
<j@...nau.net>
Subject: Re: [PATCH v2 2/3] lib/vsprintf: Add support for generic FOURCCs by
extending %p4cc
On Thu, Feb 20 2025, Aditya Garg <gargaditya08@...e.com> wrote:
> v2 -> Add this patch
> Documentation/core-api/printk-formats.rst | 32 +++++++++++++++++++
> lib/test_printf.c | 39 +++++++++++++++++++----
> lib/vsprintf.c | 38 ++++++++++++++++++----
Yay! Thanks for remembering to include test cases.
>
> diff --git a/lib/test_printf.c b/lib/test_printf.c
> index 59dbe4f9a..ee860327e 100644
> --- a/lib/test_printf.c
> +++ b/lib/test_printf.c
> @@ -776,21 +776,46 @@ static void __init fwnode_pointer(void)
> software_node_unregister_node_group(group);
> }
>
> +struct fourcc_struct {
> + u32 code;
> + const char *str;
> +};
> +
> +static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
> + const char *fmt)
> +{
> + size_t i;
> +
> + for (i = 0; i < n; i++)
> + test(fc[i].str, fmt, &fc[i].code);
> +}
> +
> static void __init fourcc_pointer(void)
> {
> - struct {
> - u32 code;
> - char *str;
> - } const try[] = {
> + struct fourcc_struct const try_cc[] = {
I know it matches the code it replaces, but kernel style seems to be
"const struct foo" rather than "struct foo const" (at around 130:1) -
just as you use in the new helper function.
Also, please consider changing the array, and the newly added instances,
to be static instead of automatic (our le32_to_cpu should be usable also
for static initializers).
This will conflict with the conversion-to-kunit which is in flight, but
the conflict should be trivial to resolve.
Rasmus
Powered by blists - more mailing lists