[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aQRj5T5WOY5rOLiy@smile.fi.intel.com>
Date: Fri, 31 Oct 2025 09:23:17 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Feng Tang <feng.tang@...ux.alibaba.com>, linux-kernel@...r.kernel.org,
Petr Mladek <pmladek@...e.com>
Subject: Re: [PATCH v3 3/6] panic: sys_info: Replace struct sys_info_name
with plain array of strings
On Thu, Oct 30, 2025 at 08:06:16PM -0700, Andrew Morton wrote:
> On Thu, 30 Oct 2025 12:44:19 +0100 Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
...
> > -static const struct sys_info_name si_names[] = {
> > - { SYS_INFO_TASKS, "tasks" },
> > - { SYS_INFO_MEM, "mem" },
> > - { SYS_INFO_TIMERS, "timers" },
> > - { SYS_INFO_LOCKS, "locks" },
> > - { SYS_INFO_FTRACE, "ftrace" },
> > - { SYS_INFO_ALL_BT, "all_bt" },
> > - { SYS_INFO_BLOCKED_TASKS, "blocked_tasks" },
> > +static const char * const si_names[] = {
> > + [ilog2(SYS_INFO_TASKS)] = "tasks",
> > + [ilog2(SYS_INFO_MEM)] = "mem",
> > + [ilog2(SYS_INFO_TIMERS)] = "timers",
> > + [ilog2(SYS_INFO_LOCKS)] = "locks",
> > + [ilog2(SYS_INFO_FTRACE)] = "ftrace",
> > + [ilog2(SYS_INFO_PANIC_CONSOLE_REPLAY)] = "",
> > + [ilog2(SYS_INFO_ALL_BT)] = "all_bt",
> > + [ilog2(SYS_INFO_BLOCKED_TASKS)] = "blocked_tasks",
> > };
>
> We have this const_ilog2() which appears to exist to work around a
> sparse shortcoming. But only net/ethtool/common.c uses it - plenty of
> other sites do what you've done.
>
> Which makes me wonder whether const_ilog2() can be removed, switch
> everything over to ilog2().
Good question. I haven't noticed sparse errors, I always use make W=1 C=1 for
my local builds.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists