From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Colin King (gmail)" <colin.i.king@gmail.com>,
"Dan Carpenter" <error27@gmail.com>,
"Duje Mihanović" <duje@dujemihanovic.xyz>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] iio: adc: make read-only const array config static
Date: Mon, 20 Jul 2026 02:44:43 +0100 [thread overview]
Message-ID: <20260720024430.2d1359a4@jic23-huawei> (raw)
In-Reply-To: <aleRBRrht2PPuHWl@ashevche-desk.local>
On Wed, 15 Jul 2026 16:54:13 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Wed, Jul 15, 2026 at 02:34:50PM +0100, Colin King (gmail) wrote:
> > On 15/07/2026 14:32, Andy Shevchenko wrote:
> > > On Wed, Jul 15, 2026 at 01:22:32PM +0300, Dan Carpenter wrote:
> > > > On Tue, Jul 14, 2026 at 08:08:10PM +0300, Andy Shevchenko wrote:
> > > > > On Tue, Jul 14, 2026 at 05:50:12PM +0100, Colin Ian King wrote:
>
> ...
>
> > > > > In all patches like this it's always a bikeshedding possible of moving static
> > > > > data outside of a function. I have no strong opinion in these cases (when the
> > > > > data solely used by a single function), but in general it might give different
> > > > > readability experience (it's harder to notice static data in the local function
> > > > > definition block). So I leave this exercise to the maintainers of the respective
> > > > > pieces of the code.
> > > >
> > > > It's an interesting point...
> > > >
> > > > At one point Smatch didn't track static variables and it used to
> > > > generate occasional false positives. And it's like you say, those
> > > > little "static" qualifiers are hard to spot in a wall of declaration
> > > > text. I've never considered moving the declarations out of the
> > > > function scope but it might be a good idea?
> > >
> > > Maybe, as I said, I have no strong opinion here. I am all ears to hear
> > > what others think.
> >
> > For small arrays it's a moot point if this type of change is useful, so
>
> Yep, it actually becomes a trade-off between generated code and existing data.
> With a small difference that static const may be located in ROM (important for
> the embedded devices with minimum available memory).
>
> > I'm OK if it's not accepted. I appreciate the feedback.
>
> Me too.
I prefer not to think too much about the trade offs and just assume it
is 'mostly' worth doing so add static everywhere like this unless it's a hot path.
Anyhow, I've picked this one up.
Jonathan
>
> > > > But in this case since this data is const, the static vs not-static
> > > > doesn't affect flow analysis or readability.
> > >
> > > It doesn't affect flow analysis, but we also have David's point about
> > > amount of data to be static may affect the code generation.
>
> ...
>
> > > The main point I have is that stumbling over the 'static' in the definition
> > > block might rise some additional questions and slow down the understanding of
> > > the code (by reading).
>
>
next prev parent reply other threads:[~2026-07-20 1:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 16:50 Colin Ian King
2026-07-14 17:08 ` Andy Shevchenko
2026-07-15 10:07 ` David Laight
2026-07-15 10:22 ` Dan Carpenter
2026-07-15 13:32 ` Andy Shevchenko
2026-07-15 13:34 ` Colin King (gmail)
2026-07-15 13:54 ` Andy Shevchenko
2026-07-20 1:44 ` Jonathan Cameron [this message]
2026-07-14 17:40 ` David Lechner
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=20260720024430.2d1359a4@jic23-huawei \
--to=jonathan.cameron@oss.qualcomm.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=colin.i.king@gmail.com \
--cc=dlechner@baylibre.com \
--cc=duje@dujemihanovic.xyz \
--cc=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.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
Powered by JetHome