From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: Nick Spooner <nicholas.spooner@seagate.com>,
hansg@kernel.org, mchehab@kernel.org,
sakari.ailus@linux.intel.com, andy@kernel.org,
gregkh@linuxfoundation.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH v2] staging: media: atomisp: Use str_on_off() to fix Coccinelle warning
Date: Fri, 24 Apr 2026 11:44:03 +0300 [thread overview]
Message-ID: <aestU-4THcXaSqKf@ashevche-desk.local> (raw)
In-Reply-To: <20260423224113.643cddc5@pumpkin>
On Thu, Apr 23, 2026 at 10:41:13PM +0100, David Laight wrote:
> On Thu, 23 Apr 2026 13:47:27 -0600
> Nick Spooner <nicholas.spooner@seagate.com> wrote:
...
> > dev_dbg(subdev->dev, "Setting power state to %s\n",
> > - on ? "on" : "off");
> > + str_on_off(on));
>
> While someone went to the trouble of adding the 'helper' and the Coccinelle
> warning; I'm not really convinced it actually improves the code.
> It doesn't even do &"off\0on"[on_off * 4] - which might be an excuse
> for a helper.
The point of the helper mainly not about the code optimisation, it's all about
making unified tokens when printing stuff (same for dates, times, escaped
strings, et cetera). Btw, the code like `&"off\0on"[on_off * 4]` is unreadable
trick. And I dunno if compiler/linker will be able to pack these string literals
as currently done in case several of str_FOO_BAR() [with the same FOO_BAR] are
in the same compilation unit.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-04-24 8:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 19:47 [PATCH v2] staging: media: atomisp: Use str_on_off() to fix Coccinelle warning Nick Spooner
2026-04-23 21:03 ` Sakari Ailus
2026-04-23 21:41 ` David Laight
2026-04-24 8:44 ` Andy Shevchenko [this message]
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=aestU-4THcXaSqKf@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=david.laight.linux@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=nicholas.spooner@seagate.com \
--cc=sakari.ailus@linux.intel.com \
/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