* [PATCH] kernel-doc: add support for ____cacheline_aligned attribute
@ 2020-09-10 18:54 Jonathan Cameron
2020-09-16 18:36 ` Jonathan Corbet
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Cameron @ 2020-09-10 18:54 UTC (permalink / raw)
To: Jonathan Corbet; +Cc: linux-doc, linux-iio, Jonathan Cameron, Lee Jones
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subroutine dump_struct uses type attributes to check if the struct
syntax is valid. Then, it removes all attributes before using it for
output. `____cacheline_aligned` is an attribute that is
not included in both steps. Add it, since it is used by kernel structs.
Based on previous patch to add ____cacheline_aligned_in_smp.
Motivated by patches to reorder this attribute to before the
variable name. Whilst we could do that in all cases, that would
be a massive change and it is more common in the kernel to place
this particular attribute after the variable name. A quick grep
suggests approximately 400 instances of which 341 have this
attribute just before a semicolon and hence after the variable name.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lee Jones <lee.jones@linaro.org>
---
Note I haven't figured out what this is actually doing and hence the
patch is done by copying the changes made for ____cacheline_aligned_in_smp.
It seems to work. :)
scripts/kernel-doc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index d1b445665ad6..cc55e1c2a8a4 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1083,7 +1083,7 @@ sub dump_struct($$) {
my $x = shift;
my $file = shift;
- if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}(\s*(__packed|__aligned|____cacheline_aligned_in_smp|__attribute__\s*\(\([a-z0-9,_\s\(\)]*\)\)))*/) {
+ if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}(\s*(__packed|__aligned|____cacheline_aligned_in_smp|____cacheline_aligned|__attribute__\s*\(\([a-z0-9,_\s\(\)]*\)\)))*/) {
my $decl_type = $1;
$declaration_name = $2;
my $members = $3;
@@ -1099,6 +1099,7 @@ sub dump_struct($$) {
$members =~ s/\s*__packed\s*/ /gos;
$members =~ s/\s*CRYPTO_MINALIGN_ATTR/ /gos;
$members =~ s/\s*____cacheline_aligned_in_smp/ /gos;
+ $members =~ s/\s*____cacheline_aligned/ /gos;
# replace DECLARE_BITMAP
$members =~ s/__ETHTOOL_DECLARE_LINK_MODE_MASK\s*\(([^\)]+)\)/DECLARE_BITMAP($1, __ETHTOOL_LINK_MODE_MASK_NBITS)/gos;
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kernel-doc: add support for ____cacheline_aligned attribute
2020-09-10 18:54 [PATCH] kernel-doc: add support for ____cacheline_aligned attribute Jonathan Cameron
@ 2020-09-16 18:36 ` Jonathan Corbet
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Corbet @ 2020-09-16 18:36 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-doc, linux-iio, Jonathan Cameron, Lee Jones
On Thu, 10 Sep 2020 19:54:15 +0100
Jonathan Cameron <jic23@kernel.org> wrote:
> Subroutine dump_struct uses type attributes to check if the struct
> syntax is valid. Then, it removes all attributes before using it for
> output. `____cacheline_aligned` is an attribute that is
> not included in both steps. Add it, since it is used by kernel structs.
>
> Based on previous patch to add ____cacheline_aligned_in_smp.
> Motivated by patches to reorder this attribute to before the
> variable name. Whilst we could do that in all cases, that would
> be a massive change and it is more common in the kernel to place
> this particular attribute after the variable name. A quick grep
> suggests approximately 400 instances of which 341 have this
> attribute just before a semicolon and hence after the variable name.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> ---
>
> Note I haven't figured out what this is actually doing and hence the
> patch is done by copying the changes made for ____cacheline_aligned_in_smp.
> It seems to work. :)
The little secret is that *nobody* really understands what all the regexes
in kernel-doc do :) Anyway, it does indeed seem to work; applied, thanks.
jon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-16 18:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 18:54 [PATCH] kernel-doc: add support for ____cacheline_aligned attribute Jonathan Cameron
2020-09-16 18:36 ` Jonathan Corbet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).