[PATCH v7 2/2] scripts: checkpatch: check unused parameters for function-like macro

2024-05-06 Thread Barry Song
, #define test(a) do { } while (0) The test result is as follows. WARNING: Argument 'a' is not used in function-like macro #21: FILE: mm/init-mm.c:20: +#define test(a) do { } while (0) total: 0 errors, 1 warnings, 8 lines checked Signed-off-by: Xining Xu Tested-by: Barry Song

[PATCH v7 1/2] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-05-06 Thread Barry Song
From: Barry Song Recent commit 77292bb8ca69c80 ("crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem") leads to warnings on xtensa and loongarch, In file included from crypto/scompress.c:12: include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone'

[PATCH v7 0/2] codingstyle: avoid unused parameters for a function-like macro

2024-05-06 Thread Barry Song
From: Barry Song -v7: * collect ack of Joe for checkpatch.pl, thanks! * fixed an indentation per Joe -v6: * collect ack of Joe, thanks! * refine docs according to Jonathan, thanks! * add checkpatch doc according to Joe, thanks! v6 link: https://lore.kernel.org/lkml/20240506014606.8638-1

Re: [PATCH RESEND v6 2/2] scripts: checkpatch: check unused parameters for function-like macro

2024-05-06 Thread Barry Song
>> From: Xining Xu >> >> If function-like macros do not utilize a parameter, it might result in a >> build warning. In our coding style guidelines, we advocate for utilizing >> static inline functions to replace such macros. This patch verifies >> compliance with the new rule. > [] >> diff --gi

[PATCH RESEND v6 2/2] scripts: checkpatch: check unused parameters for function-like macro

2024-05-05 Thread Barry Song
, #define test(a) do { } while (0) The test result is as follows. WARNING: Argument 'a' is not used in function-like macro #21: FILE: mm/init-mm.c:20: +#define test(a) do { } while (0) total: 0 errors, 1 warnings, 8 lines checked Signed-off-by: Xining Xu Tested-by: Barry Song

[PATCH RESEND v6 1/2] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-05-05 Thread Barry Song
From: Barry Song Recent commit 77292bb8ca69c80 ("crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem") leads to warnings on xtensa and loongarch, In file included from crypto/scompress.c:12: include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone'

[PATCH RESEND v6 0/2] codingstyle: avoid unused parameters for a function-like macro

2024-05-05 Thread Barry Song
From: Barry Song -v6: * collect ack of Joe, thanks! * refine docs according to Jonathan, thanks! * add checkpatch doc according to Joe, thanks! -v5: * Simplify the code for Patch 2 according to Joe's suggestions. * add s-o-b of Barry according to Jeff Johnson v5 link:

Re: [PATCH v6 2/2] scripts: checkpatch: check unused parameters for function-like macro

2024-04-26 Thread Barry Song
Hi Joe, any further comment for this ? May this patch get your reviewed / acked? On Thu, Apr 4, 2024 at 6:43 AM Barry Song <21cn...@gmail.com> wrote: > > From: Xining Xu > > If function-like macros do not utilize a parameter, it might result in a > build warning. In our co

[PATCH v6 2/2] scripts: checkpatch: check unused parameters for function-like macro

2024-04-03 Thread Barry Song
, #define test(a) do { } while (0) The test result is as follows. WARNING: Argument 'a' is not used in function-like macro #21: FILE: mm/init-mm.c:20: +#define test(a) do { } while (0) total: 0 errors, 1 warnings, 8 lines checked Signed-off-by: Xining Xu Tested-by: Barry Song

[PATCH v6 1/2] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-04-03 Thread Barry Song
From: Barry Song Recent commit 77292bb8ca69c80 ("crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem") leads to warnings on xtensa and loongarch, In file included from crypto/scompress.c:12: include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone'

[PATCH v6 0/2] codingstyle: avoid unused parameters for a function-like macro

2024-04-03 Thread Barry Song
From: Barry Song -v6: * collect ack of Joe, thanks! * refine docs according to Jonathan, thanks! * add checkpatch doc according to Joe, thanks! -v5: * Simplify the code for Patch 2 according to Joe's suggestions. * add s-o-b of Barry according to Jeff Johnson v5 link:

Re: [PATCH v5 1/2] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-04-02 Thread Barry Song
efer to stick with Andrew's channel. > > A nit below > > Barry Song <21cn...@gmail.com> writes: > > > From: Barry Song > > > > Recent commit 77292bb8ca69c80 ("crypto: scomp - remove memcpy if > > sg_nents is 1 and pages are lowmem") le

[PATCH v5 2/2] scripts: checkpatch: check unused parameters for function-like macro

2024-03-31 Thread Barry Song
Xining Xu Tested-by: Barry Song Signed-off-by: Barry Song Cc: Chris Zankel Cc: Huacai Chen Cc: Herbert Xu Cc: Guenter Roeck Cc: Stephen Rothwell Cc: Mark Brown Cc: Andy Whitcroft Cc: Dwaipayan Ray Cc: Joe Perches Cc: Jonathan Corbet Cc: Lukas Bulwahn Cc: Max Filippov Cc: Jeff J

[PATCH v5 1/2] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-03-31 Thread Barry Song
From: Barry Song Recent commit 77292bb8ca69c80 ("crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem") leads to warnings on xtensa and loongarch, In file included from crypto/scompress.c:12: include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone'

[PATCH v5 0/2] codingstyle: avoid unused parameters for a function-like macro

2024-03-31 Thread Barry Song
From: Barry Song -v5: * Simplify the code for Patch 2 according to Joe's suggestions. * add s-o-b of Barry according to Jeff Johnson -v4: * fix Xining's email address, s/ma@outlook.com/mac@outlook.com/g * fix some false positives of checkpatch.pl * downgrade from ERROR

Re: [PATCH v4 2/2] scripts: checkpatch: check unused parameters for function-like macro

2024-03-28 Thread Barry Song
On Fri, Mar 29, 2024 at 5:01 AM Jeff Johnson wrote: > > On 3/27/2024 7:21 PM, Barry Song wrote: > > From: Xining Xu > > > > If function-like macros do not utilize a parameter, it might result in a > > build warning. In our coding style guidelines, we advocate f

Re: [PATCH v4 0/2] codingstyle: avoid unused parameters for a function-like macro

2024-03-27 Thread Barry Song
On Thu, Mar 28, 2024 at 3:21 PM Barry Song <21cn...@gmail.com> wrote: > > From: Barry Song > > -v4: > * fix Xining's email address, s/ma@outlook.com/mac@outlook.com/g Hi Andrew, Apologies for the oversight. Could you please apply these two patches to replac

[PATCH v4 2/2] scripts: checkpatch: check unused parameters for function-like macro

2024-03-27 Thread Barry Song
Xining Xu Tested-by: Barry Song Cc: Chris Zankel Cc: Huacai Chen Cc: Herbert Xu Cc: Guenter Roeck Cc: Stephen Rothwell Cc: Mark Brown Cc: Andy Whitcroft Cc: Dwaipayan Ray Cc: Joe Perches Cc: Jonathan Corbet Cc: Lukas Bulwahn Cc: Max Filippov --- scripts/checkpat

[PATCH v4 1/2] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-03-27 Thread Barry Song
From: Barry Song Recent commit 77292bb8ca69c80 ("crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem") leads to warnings on xtensa and loongarch, In file included from crypto/scompress.c:12: include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone'

[PATCH v4 0/2] codingstyle: avoid unused parameters for a function-like macro

2024-03-27 Thread Barry Song
From: Barry Song -v4: * fix Xining's email address, s/ma@outlook.com/mac@outlook.com/g * fix some false positives of checkpatch.pl * downgrade from ERROR to WARN in checkpatch.pl Thanks for Joe's comments! -v3: https://lore.kernel.org/all/20240322084937.66018-1-21cn...

[PATCH v3 2/2] scripts: checkpatch: Check unused parameters for function-like macro

2024-03-22 Thread Barry Song
Cc: Chris Zankel Cc: Huacai Chen Cc: Herbert Xu Cc: Guenter Roeck Cc: Stephen Rothwell Cc: Mark Brown Signed-off-by: Xining Xu Tested-by: Barry Song --- scripts/checkpatch.pl | 24 1 file changed, 24 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/che

[PATCH v3 1/2] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-03-22 Thread Barry Song
From: Barry Song Recent commit 77292bb8ca69c80 ("crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem") leads to warnings on xtensa and loongarch, In file included from crypto/scompress.c:12: include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone'

[PATCH v3 0/2] codingstyle: avoid unused parameters for a function-like macro

2024-03-22 Thread Barry Song
From: Barry Song A function-like macro could result in build warnings such as "unused variable." This patchset updates the guidance to recommend always using a static inline function instead and also provides checkpatch support for this new rule. Barry Song (1): Documentation: co

Re: [PATCH] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-03-21 Thread Barry Song
On Fri, Mar 22, 2024 at 12:15 AM Mark Brown wrote: > > On Thu, Mar 21, 2024 at 07:48:36AM +1300, Barry Song wrote: > > On Thu, Mar 21, 2024 at 4:49 AM Andrew Morton > > wrote: > > > > Stronger than that please. Just tell people not to use macros in such > >

Re: [PATCH] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-03-21 Thread Barry Song
On Thu, Mar 21, 2024 at 5:40 PM Meiyong Yu wrote: > > > 在 2024/3/21 8:11, Barry Song 写道: > > On Thu, Mar 21, 2024 at 12:39 PM Meiyong Yu wrote: > >> > >>> On Mar 20, 2024, at 08:17, Barry Song <21cn...@gmail.com> wrote: > >>> > >>

Re: [PATCH] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-03-20 Thread Barry Song
On Thu, Mar 21, 2024 at 12:39 PM Meiyong Yu wrote: > > > > On Mar 20, 2024, at 08:17, Barry Song <21cn...@gmail.com> wrote: > > > > From: Barry Song > > > > Recent commit 77292bb8ca69c80 ("crypto: scomp - remove memcpy if > > sg_nents is

Re: [PATCH] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-03-20 Thread Barry Song
On Thu, Mar 21, 2024 at 4:49 AM Andrew Morton wrote: > > On Wed, 20 Mar 2024 16:24:30 +1300 Barry Song <21cn...@gmail.com> wrote: > > > Hi Stephen, > > Thanks for reviewing. > > > > On Wed, Mar 20, 2024 at 2:42 PM Stephen Rothwell > > wrote: > >

[PATCH v2] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-03-19 Thread Barry Song
From: Barry Song Recent commit 77292bb8ca69c80 ("crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem") leads to warnings on xtensa and loongarch, In file included from crypto/scompress.c:12: include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone'

Re: [PATCH] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-03-19 Thread Barry Song
Hi Stephen, Thanks for reviewing. On Wed, Mar 20, 2024 at 2:42 PM Stephen Rothwell wrote: > > Hi Barry, > > On Wed, 20 Mar 2024 13:16:56 +1300 Barry Song <21cn...@gmail.com> wrote: > > > > diff --git a/Documentation/process/coding-style.rst > > b/Documentatio

[PATCH] Documentation: coding-style: ask function-like macros to evaluate parameters

2024-03-19 Thread Barry Song
From: Barry Song Recent commit 77292bb8ca69c80 ("crypto: scomp - remove memcpy if sg_nents is 1 and pages are lowmem") leads to warnings on xtensa and loongarch, In file included from crypto/scompress.c:12: include/crypto/scatterwalk.h: In function 'scatterwalk_pagedone'