From: Jonathan Cameron <jic23@kernel.org>
To: Joe Perches <joe@perches.com>
Cc: Marcelo Schmitt <marcelo.schmitt@analog.com>,
apw@canonical.com, dwaipayanray1@gmail.com,
lukas.bulwahn@gmail.com, paul.cercueil@analog.com,
Michael.Hennerich@analog.com, lars@metafoo.de,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, dan.carpenter@linaro.org,
dlechner@baylibre.com, marcelo.schmitt1@gmail.com,
Andrew Morton <akpm@linux-foundation.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 01/15] scripts: checkpatch: Add __aligned to the list of attribute notes
Date: Sun, 17 Dec 2023 14:51:32 +0000 [thread overview]
Message-ID: <20231217145132.6aac2d42@jic23-huawei> (raw)
In-Reply-To: <59d9ac4e1f7475f51672222af1fc90d7ec23b5da.camel@perches.com>
On Sat, 16 Dec 2023 10:07:24 -0800
Joe Perches <joe@perches.com> wrote:
> On Sat, 2023-12-16 at 14:45 -0300, Marcelo Schmitt wrote:
> > Checkpatch presumes attributes marked with __aligned(alignment) are part
> > of a function declaration and throws a warning stating that those
> > compiler attributes should have an identifier name which is not correct.
> > Add __aligned compiler attributes to the list of attribute notes
> > so they don't cause warnings anymore.
> >
> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> > ---
> > Any expression that evaluates to an integer that is a power of 2 can be
> > within __aligned parenthesis.
> > I can't see how we could use a regex to check code meets such constraint (if possible).
>
> You can't because if a #define is used for the alignment
> value it is not necessarily available to a patch fragment
> or even a file if the #define is in an #include.
>
> > Some additional exotic uses of __aligned are:
> > drivers/net/wireless/quantenna/qtnfmac/bus.h:72: char bus_priv[] __aligned(sizeof(void *));
> > include/linux/netdevice.h:225:} __aligned(4 * sizeof(unsigned long));
>
> Right, then there are random uses like:
>
> drivers/firmware/qcom/qcom_qseecom_uefisecapp.c: size_t __aligned; \
> drivers/firmware/qcom/qcom_qseecom_uefisecapp.c: *__offset = __aligned; \
>
> so there's always some false positive/negative issue
> with checkpatch.
>
> Anyway:
>
> Acked-by: Joe Perches <joe@perches.com>
Given this should cut down on false postives I've picked this one up now.
Applied to the togreg branch of iio.git and pushed out briefly as testing to
see what blows up.
I'll see if I can pick up some more parts of this series to avoid us going round
again with quite so many patches.
Jonathan
>
> >
> > The regex
> > __aligned\s*\(.*\)
> > seems to match all use cases.
> >
> > We might not catch invalid arguments to __aligned, but it looks like making
> > checkpath confidently report those wouldn't be feasible anyway.
> >
> > The patch that would trigger the mentioned warning in now
> > patch number 13 (iio: adc: Add support for AD7091R-8).
> >
> > scripts/checkpatch.pl | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 25fdb7fda112..d56c98146da3 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -512,6 +512,7 @@ our $Attribute = qr{
> > __ro_after_init|
> > __kprobes|
> > $InitAttribute|
> > + __aligned\s*\(.*\)|
> > ____cacheline_aligned|
> > ____cacheline_aligned_in_smp|
> > ____cacheline_internodealigned_in_smp|
>
>
next prev parent reply other threads:[~2023-12-17 14:51 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-16 17:44 [PATCH v4 00/15] Add support for AD7091R-2/-4/-8 Marcelo Schmitt
2023-12-16 17:45 ` [PATCH v4 01/15] scripts: checkpatch: Add __aligned to the list of attribute notes Marcelo Schmitt
2023-12-16 18:07 ` Joe Perches
2023-12-17 14:51 ` Jonathan Cameron [this message]
2023-12-16 17:46 ` [PATCH v4 02/15] iio: adc: ad7091r: Pass iio_dev to event handler Marcelo Schmitt
2023-12-17 14:53 ` Jonathan Cameron
2023-12-16 17:46 ` [PATCH v4 03/15] iio: adc: ad7091r: Set alert bit in config register Marcelo Schmitt
2023-12-17 14:55 ` Jonathan Cameron
2023-12-18 17:22 ` Marcelo Schmitt
2023-12-16 17:47 ` [PATCH v4 04/15] iio: adc: ad7091r: Align arguments to function call parenthesis Marcelo Schmitt
2023-12-17 14:57 ` Jonathan Cameron
2023-12-16 17:47 ` [PATCH v4 05/15] iio: adc: ad7091r: Move generic AD7091R code to base driver and header file Marcelo Schmitt
2023-12-17 14:59 ` Jonathan Cameron
2023-12-16 17:47 ` [PATCH v4 06/15] iio: adc: ad7091r: Move chip init data to container struct Marcelo Schmitt
2023-12-17 13:04 ` [PATCH v4 6/15] " kernel test robot
2023-12-17 14:48 ` Jonathan Cameron
2023-12-16 17:48 ` [PATCH v4 07/15] iio: adc: ad7091r: Remove unneeded probe parameters Marcelo Schmitt
2023-12-16 17:48 ` [PATCH v4 08/15] iio: adc: ad7091r: Set device mode through chip_info callback Marcelo Schmitt
2023-12-16 17:49 ` [PATCH v4 09/15] iio: adc: ad7091r: Enable internal vref if external vref is not supplied Marcelo Schmitt
2023-12-17 15:41 ` Jonathan Cameron
2023-12-18 17:35 ` Marcelo Schmitt
2023-12-20 14:04 ` Jonathan Cameron
2023-12-18 0:36 ` David Lechner
2023-12-18 17:42 ` Marcelo Schmitt
2023-12-16 17:49 ` [PATCH v4 10/15] iio: adc: ad7091r: Add chip_info callback to get conversion result channel Marcelo Schmitt
2023-12-16 17:49 ` [PATCH v4 11/15] iio: adc: Split AD7091R-5 config symbol Marcelo Schmitt
2023-12-16 17:50 ` [PATCH v4 12/15] dt-bindings: iio: Add AD7091R-8 Marcelo Schmitt
2023-12-16 23:55 ` Conor Dooley
2023-12-16 17:50 ` [PATCH v4 13/15] iio: adc: Add support for AD7091R-8 Marcelo Schmitt
2023-12-17 15:46 ` Jonathan Cameron
2023-12-16 17:51 ` [PATCH v4 14/15] MAINTAINERS: Add MAINTAINERS entry for AD7091R Marcelo Schmitt
2023-12-16 17:51 ` [PATCH v4 15/15] iio: adc: ad7091r: Allow users to configure device events Marcelo Schmitt
2023-12-17 15:54 ` Jonathan Cameron
2023-12-17 23:58 ` David Lechner
2023-12-18 0:10 ` David Lechner
2023-12-18 0:30 ` 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=20231217145132.6aac2d42@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=conor+dt@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=dwaipayanray1@gmail.com \
--cc=joe@perches.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=marcelo.schmitt1@gmail.com \
--cc=marcelo.schmitt@analog.com \
--cc=paul.cercueil@analog.com \
--cc=robh+dt@kernel.org \
/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