linux/Documentation
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
..
ABI Char/Misc and other driver subsystem updates for 6.9-rc1 2024-03-21 13:21:31 -07:00
accel
accounting
admin-guide watchdog: allow nmi watchdog to use raw perf event 2024-05-08 08:41:29 -07:00
arch Documentation/x86: Fix title underline length 2024-03-25 11:29:16 +01:00
block
bpf
cdrom
core-api
cpu-freq
crypto
dev-tools Documentation: dev-tools: Add link to RV docs 2024-03-29 08:27:21 -06:00
devicetree Merge tag 'drm-msm-next-2024-04-11' of https://gitlab.freedesktop.org/drm/msm into drm-fixes 2024-04-12 11:01:45 +10:00
doc-guide
driver-api virtio: store owner from modules with register_virtio_driver() 2024-04-08 04:11:04 -04:00
fault-injection
fb
features
filesystems Documentation: filesystems: Add bcachefs toctree 2024-04-06 13:50:26 -04:00
firmware_class
firmware-guide More ACPI updates for 6.9-rc1 2024-03-19 11:15:14 -07:00
fpga
gpu
hid
hwmon
i2c
iio
images
infiniband
input
isdn
kbuild Documentation/llvm: Note s390 LLVM=1 support with LLVM 18.1.0 and newer 2024-03-31 21:09:50 +09:00
kernel-hacking
leds
litmus-tests
livepatch
locking
maintainer
mhi
misc-devices
mm This pull request contains updates for UBI and UBIFS: 2024-03-21 15:09:29 -07:00
netlabel
netlink
networking Documentation: Add documentation for eswitch attribute 2024-03-28 18:20:08 -07:00
nvdimm
nvme
PCI
pcmcia
peci
power
process Documentation: coding-style: ask function-like macros to evaluate parameters 2024-05-11 15:51:44 -07:00
RCU
rust
scheduler A single update for the documentation of the base_slice_ns tunable to 2024-03-24 11:11:05 -07:00
scsi
security
sound
sphinx
sphinx-static
spi spi: docs: spidev: fix echo command format 2024-03-19 18:37:55 +00:00
staging
target
tee
timers
tools tools/rtla: Add -U/--user-load option to timerlat 2024-03-20 05:39:06 +01:00
trace
translations
usb
userspace-api
virt Documentation: kvm/sev: clarify usage of KVM_MEMORY_ENCRYPT_OP 2024-03-18 19:03:53 -04:00
w1
watchdog
wmi
.gitignore
atomic_bitops.txt
atomic_t.txt
Changes
CodingStyle
conf.py
docutils.conf
dontdiff
index.rst
Kconfig
Makefile
memory-barriers.txt
SubmittingPatches
subsystem-apis.rst