linux/Documentation/process
Barry Song 6813216bbd Documentation: coding-style: ask function-like macros to evaluate parameters
Patch series "codingstyle: avoid unused parameters for a function-like
macro", v7.

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.


This patch (of 2):

Recent commit 77292bb8ca ("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':
   include/crypto/scatterwalk.h:76:30: warning: variable 'page' set but not used [-Wunused-but-set-variable]
      76 |                 struct page *page;
         |                              ^~~~
   crypto/scompress.c: In function 'scomp_acomp_comp_decomp':
>> crypto/scompress.c:174:38: warning: unused variable 'dst_page' [-Wunused-variable]
     174 |                         struct page *dst_page = sg_page(req->dst);
         |

The reason is that flush_dcache_page() is implemented as a noop
macro on these platforms as below,

 #define flush_dcache_page(page) do { } while (0)

The driver code, for itself, seems be quite innocent and placing
maybe_unused seems pointless,

 struct page *dst_page = sg_page(req->dst);

 for (i = 0; i < nr_pages; i++)
 	flush_dcache_page(dst_page + i);

And it should be independent of architectural implementation
differences.

Let's provide guidance on coding style for requesting parameter
evaluation or proposing the migration to a static inline
function.

Link: https://lkml.kernel.org/r/20240507032757.146386-1-21cnbao@gmail.com
Link: https://lkml.kernel.org/r/20240507032757.146386-2-21cnbao@gmail.com
Signed-off-by: Barry Song <v-songbaohua@oppo.com>
Suggested-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Acked-by: Joe Perches <joe@perches.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Huacai Chen <chenhuacai@loongson.cn>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>
Cc: Joe Perches <joe@perches.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: Xining Xu <mac.xxn@outlook.com>
Cc: Charlemagne Lasse <charlemagnelasse@gmail.com>
Cc: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-05-11 15:51:44 -07:00
..
1.Intro.rst
2.Process.rst docs: process: fix a typoed cross-reference 2023-05-20 08:07:04 -06:00
3.Early-stage.rst Documentation/process: use scripts/get_maintainer.pl on patches 2022-05-09 16:12:16 -06:00
4.Coding.rst Add .editorconfig file for basic formatting 2023-12-28 16:22:47 +09:00
5.Posting.rst docs: process: allow Closes tags with links 2023-04-18 16:39:31 -07:00
6.Followthrough.rst docs: remove the tips on how to submit patches from MAINTAINERS 2023-07-03 08:35:23 -06:00
7.AdvancedTopics.rst docs: try to encourage (netdev?) reviewers 2023-10-15 14:26:51 +01:00
8.Conclusion.rst docs: process: remove outdated submitting-drivers.rst 2022-07-14 15:03:57 -06:00
adding-syscalls.rst
applying-patches.rst Documentation: describe how to apply incremental stable patches 2022-03-09 16:29:44 -07:00
backporting.rst docs: backporting: address feedback 2023-10-26 11:49:16 -06:00
botching-up-ioctls.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
changes.rst - Kuan-Wei Chiu has developed the well-named series "lib min_heap: Min 2024-03-14 18:03:09 -07:00
clang-format.rst
code-of-conduct-interpretation.rst docs: update mediator contact information in CoC doc 2022-11-10 18:45:11 +01:00
code-of-conduct.rst
coding-style.rst Documentation: coding-style: ask function-like macros to evaluate parameters 2024-05-11 15:51:44 -07:00
contribution-maturity-model.rst Documentation/process: Add Linux Kernel Contribution Maturity Model 2023-03-14 12:22:59 -06:00
cve.rst Documentation: Document the Linux Kernel CVE process 2024-02-17 14:46:39 +01:00
deprecated.rst docs: deprecated.rst: Update an example 2023-07-14 13:36:31 -06:00
development-process.rst docs: use toctree :caption: and move introduction 2023-11-17 13:05:26 -07:00
email-clients.rst Documentation: process: Document suitability of Proton Mail for kernel development 2023-01-13 09:26:19 -07:00
embargoed-hardware-issues.rst Documentation: embargoed-hardware-issues.rst: Fix Trilok's email 2024-02-14 15:06:10 -07:00
handling-regressions.rst docs: handling-regressions.rst: Update regzbot command fixed-by to fix 2024-03-18 03:40:15 -06:00
howto.rst Documentation: multiple .rst files: Fix grammar and more consistent formatting 2024-02-05 10:24:54 -07:00
index.rst Documentation: Document the Linux Kernel CVE process 2024-02-17 14:46:39 +01:00
kernel-docs.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
kernel-driver-statement.rst
kernel-enforcement-statement.rst Documentation: drop optional BOMs 2021-05-10 15:17:34 -06:00
license-rules.rst
magic-number.rst char: pcmcia: remove all the drivers 2023-03-09 17:30:27 +01:00
maintainer-handbooks.rst Documentation/process: maintainer-soc: add clean platforms profile 2023-08-12 14:04:51 +02:00
maintainer-kvm-x86.rst Documentation/process: Add a maintainer handbook for KVM x86 2023-06-22 14:25:38 -07:00
maintainer-netdev.rst docs: netdev: update the link to the CI repo 2024-02-20 11:52:41 +01:00
maintainer-pgp-guide.rst docs: maintainer-pgp-guide: update for latest gnupg defaults 2023-01-02 16:37:18 -07:00
maintainer-soc-clean-dts.rst Documentation/process: maintainer-soc: add clean platforms profile 2023-08-12 14:04:51 +02:00
maintainer-soc.rst Documentation/process: maintainer-soc: document dtbs_check requirement for Samsung 2023-08-12 14:05:34 +02:00
maintainer-tip.rst Documentation/maintainer-tip: Add C++ tail comments exception 2024-02-13 13:19:40 +01:00
maintainers.rst
management-style.rst
programming-language.rst docs: programming-language: add Rust programming language section 2023-03-07 10:24:40 -07:00
researcher-guidelines.rst Documentation: update mailing list addresses 2024-02-21 13:44:21 -07:00
security-bugs.rst Documentation: Document the Linux Kernel CVE process 2024-02-17 14:46:39 +01:00
stable-api-nonsense.rst
stable-kernel-rules.rst Documentation: stable: clarify patch series prerequisites 2023-10-05 13:43:45 +02:00
submit-checklist.rst docs: submit-checklist: use subheadings 2024-03-03 08:41:33 -07:00
submitting-patches.rst docs: submitting-patches: improve the base commit explanation 2023-11-27 11:00:16 -07:00
volatile-considered-harmful.rst