address all -Wunused-const warnings
Subsystems (76)
cover address all -Wunused-const warnings
From: Arnd Bergmann <[email protected]>
Compilers traditionally warn for unused 'static' variables, but not if they are constant. The reason here is a custom for C++ programmers to define named constants as 'static const' variables in header files instead of using macros or enums.
In W=1 builds, we get warnings only static const variables in C files, but not in headers, which is a good compromise, but this still produces warning output in at least 30 files. These warnings are almost all harmless, but also trivial to fix, and there is no good reason to warn only about the non-const variables being unused.
I've gone through all the files that I found using randconfig and allmodconfig builds and created patches to avoid these warnings, with the goal of retaining a clean build once the option is enabled by default.
Unfortunately, there is one fairly large patch ("drivers: remove incorrect of_match_ptr/ACPI_PTR annotations") that touches 34 individual drivers that all need the same one-line change. If necessary, I can split it up by driver or by subsystem, but at least for reviewing I would keep it as one piece for the moment.
Please merge the individual patches through subsystem trees. I expect that some of these will have to go through multiple revisions before they are picked up, so anything that gets applied early saves me from resending.
Arnd
Arnd Bergmann (31):
powerpc/fsl-soc: hide unused const variable
ubsan: fix unused variable warning in test module
platform: goldfish: remove ACPI_PTR() annotations
i2c: pxa: hide unused icr_bits[] variable
3c515: remove unused 'mtu' variable
tracing: hide unused ftrace_event_id_fops
Input: synaptics: hide unused smbus_pnp_ids[] array
power: rt9455: hide unused rt9455_boost_voltage_values
efi: sysfb: don't build when EFI is disabled
clk: ti: dpll: fix incorrect #ifdef checks
apm-emulation: hide an unused variable
sisfb: hide unused variables
dma/congiguous: avoid warning about unused size_bytes
leds: apu: remove duplicate DMI lookup data
iio: ad5755: hook up of_device_id lookup to platform driver
greybus: arche-ctrl: move device table to its right location
lib: checksum: hide unused expected_csum_ipv6_magic[]
sunrpc: suppress warnings for unused procfs functions
comedi: ni_atmio: avoid warning for unused device_ids[] table
iwlegacy: don't warn for unused variables with DEBUG_FS=n drm/komeda: don't warn for unused debugfs files
firmware: qcom_scm: mark qcom_scm_qseecom_allowlist as __maybe_unused
crypto: ccp - drop platform ifdef checks
usb: gadget: omap_udc: remove unused variable
isdn: kcapi: don't build unused procfs code
cpufreq: intel_pstate: hide unused intel_pstate_cpu_oob_ids[]
net: xgbe: remove extraneous #ifdef checks
Input: imagis - remove incorrect ifdef checks
sata: mv: drop unnecessary #ifdef checks
ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations
spi: remove incorrect of_match_ptr annotations
drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
kbuild: always enable -Wunused-const-variable
Krzysztof Kozlowski (1):
Input: stmpe-ts - mark OF related data as maybe unused
arch/powerpc/sysdev/fsl_msi.c | 2 + drivers/ata/sata_mv.c | 64 +++++++++---------- drivers/char/apm-emulation.c | 5 +- drivers/char/ipmi/ipmb_dev_int.c | 2 +- drivers/char/tpm/tpm_ftpm_tee.c | 2 +- drivers/clk/ti/dpll.c | 10 ++- drivers/comedi/drivers/ni_atmio.c | 2 +- drivers/cpufreq/intel_pstate.c | 2 + drivers/crypto/ccp/sp-platform.c | 14 +--- drivers/dma/img-mdc-dma.c | 2 +- drivers/firmware/efi/Makefile | 3 +- drivers/firmware/efi/sysfb_efi.c | 2 - drivers/firmware/qcom/qcom_scm.c | 2 +- drivers/fpga/versal-fpga.c | 2 +- .../gpu/drm/arm/display/komeda/komeda_dev.c | 8 --- drivers/hid/hid-google-hammer.c | 6 +- drivers/i2c/busses/i2c-pxa.c | 2 +- drivers/i2c/muxes/i2c-mux-ltc4306.c | 2 +- drivers/i2c/muxes/i2c-mux-reg.c | 2 +- drivers/iio/dac/ad5755.c | 1 + drivers/input/mouse/synaptics.c | 2 + drivers/input/touchscreen/imagis.c | 4 +- drivers/input/touchscreen/stmpe-ts.c | 2 +- drivers/input/touchscreen/wdt87xx_i2c.c | 2 +- drivers/isdn/capi/Makefile | 3 +- drivers/isdn/capi/kcapi.c | 7 +- drivers/leds/leds-apu.c | 3 +- drivers/mux/adg792a.c | 2 +- drivers/net/ethernet/3com/3c515.c | 3 - drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 8 --- drivers/net/ethernet/apm/xgene-v2/main.c | 2 +- drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +- drivers/net/wireless/intel/iwlegacy/4965-rs.c | 15 +---- drivers/net/wireless/intel/iwlegacy/common.h | 2 - drivers/platform/goldfish/goldfish_pipe.c | 2 +- drivers/power/supply/rt9455_charger.c | 2 + drivers/regulator/pbias-regulator.c | 2 +- drivers/regulator/twl-regulator.c | 2 +- drivers/regulator/twl6030-regulator.c | 2 +- drivers/rtc/rtc-fsl-ftm-alarm.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/spi/spi-armada-3700.c | 2 +- drivers/spi/spi-img-spfi.c | 2 +- drivers/spi/spi-meson-spicc.c | 2 +- drivers/spi/spi-meson-spifc.c | 2 +- drivers/spi/spi-orion.c | 2 +- drivers/spi/spi-pic32-sqi.c | 2 +- drivers/spi/spi-pic32.c | 2 +- drivers/spi/spi-rockchip.c | 2 +- drivers/spi/spi-s3c64xx.c | 2 +- drivers/spi/spi-st-ssc4.c | 2 +- drivers/staging/greybus/arche-apb-ctrl.c | 1 + drivers/staging/greybus/arche-platform.c | 9 +-- drivers/staging/pi433/pi433_if.c | 2 +- drivers/tty/serial/amba-pl011.c | 6 +- drivers/tty/serial/ma35d1_serial.c | 2 +- drivers/usb/gadget/udc/omap_udc.c | 10 +-- drivers/video/fbdev/sis/init301.c | 3 +- kernel/dma/contiguous.c | 2 +- kernel/trace/trace_events.c | 4 ++ lib/checksum_kunit.c | 2 + lib/test_ubsan.c | 2 +- net/sunrpc/cache.c | 10 +-- scripts/Makefile.extrawarn | 1 - sound/soc/atmel/sam9x5_wm8731.c | 2 +- sound/soc/codecs/rt5514-spi.c | 2 +- sound/soc/qcom/lpass-sc7280.c | 2 +- sound/soc/samsung/aries_wm8994.c | 2 +- 69 files changed, 121 insertions(+), 169 deletions(-)
Signature · 106 lines
2.39.2 Cc: Michael Ellerman <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Damien Le Moal <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Corey Minyard <[email protected]> Cc: Peter Huewe <[email protected]> Cc: Jarkko Sakkinen <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Stephen Boyd <[email protected]> Cc: Ian Abbott <[email protected]> Cc: H Hartley Sweeten <[email protected]> Cc: Srinivas Pandruvada <[email protected]> Cc: Len Brown <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: John Allen <[email protected]> Cc: Herbert Xu <[email protected]> Cc: Vinod Koul <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Bjorn Andersson <[email protected]> Cc: Moritz Fischer <[email protected]> Cc: Liviu Dudau <[email protected]> Cc: Benjamin Tissoires <[email protected]> Cc: Andi Shyti <[email protected]> Cc: Michael Hennerich <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Lars-Peter Clausen <[email protected]> Cc: Jonathan Cameron <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Markuss Broks <[email protected]> Cc: Alexandre Torgue <[email protected]> Cc: Lee Jones <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Shyam Sundar S K <[email protected]> Cc: Iyappan Subramanian <[email protected]> Cc: Yisen Zhuang <[email protected]> Cc: Stanislaw Gruszka <[email protected]> Cc: Kalle Valo <[email protected]> Cc: Sebastian Reichel <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Mark Brown <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: Xiang Chen <[email protected]> Cc: "Martin K. Petersen" <[email protected]> Cc: Neil Armstrong <[email protected]> Cc: Heiko Stuebner <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: Vaibhav Hiremath <[email protected]> Cc: Alex Elder <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Jacky Huang <[email protected]> Cc: Helge Deller <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Robin Murphy <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Kees Cook <[email protected]> Cc: Trond Myklebust <[email protected]> Cc: Anna Schumaker <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected]
PATCH 1/34 powerpc/fsl-soc: hide unused const variable
From: Arnd Bergmann <[email protected]>
vmpic_msi_feature is only used conditionally, which triggers a rare -Werror=unused-const-variable= warning with gcc:
arch/powerpc/sysdev/fsl_msi.c:567:37: error: 'vmpic_msi_feature' defined but not used [-Werror=unused-const-variable=]
567 | static const struct fsl_msi_feature vmpic_msi_feature =
Hide this one in the same #ifdef as the reference so we can turn on the warning by default.
--- arch/powerpc/sysdev/fsl_msi.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/sysdev/fsl_msi.c +2 -0
@@ -564,10 +564,12 @@ static const struct fsl_msi_feature ipic_msi_feature = { .msiir_offset = 0x38, }; +#ifdef CONFIG_EPAPR_PARAVIRT static const struct fsl_msi_feature vmpic_msi_feature = { .fsl_pic_ip =FSL_PIC_IP_VMPIC , .msiir_offset =0 , }; +#endif static const struct of_device_id fsl_of_msi_ids[] = { {
Signature · 1 line
2.39.2
Re: [PATCH 01/34] powerpc/fsl-soc: hide unused const variable
Le 03/04/2024 à 10:06, Arnd Bergmann a écrit :
Quoted 5 lines
From: Arnd Bergmann <[email protected]>
vmpic_msi_featureis only used conditionally, which triggers a rare -Werror=unused-const-variable= warning with gcc:
Quoted 8 lines
arch/powerpc/sysdev/fsl_msi.c:567:37: error: 'vmpic_msi_feature' defined but not used [-Werror=unused-const-variable=]
567 | static const structfsl_msi_featurevmpic_msi_feature=Hide this one in the same #ifdef as the reference so we can turn on the warning by default.
Fixes 305bcf26128e ("powerpc/fsl-soc: use CONFIG_EPAPR_PARAVIRT for hcalls")Signed-off-by Arnd Bergmann <[email protected]>
Quoted 21 lines
--- arch/powerpc/sysdev/fsl_msi.c | 2 ++ 1 file changed, 2 insertions(+)arch/powerpc/sysdev/fsl_msi.c +2
-0@@ -564,10 +564,12 @@ static const struct fsl_msi_feature ipic_msi_feature = { .msiir_offset = 0x38, }; +#ifdef CONFIG_EPAPR_PARAVIRT static const struct fsl_msi_feature vmpic_msi_feature = { .fsl_pic_ip =FSL_PIC_IP_VMPIC , .msiir_offset =0 , }; +#endif static const struct of_device_id fsl_of_msi_ids[] = { {
PATCH 2/34 ubsan: fix unused variable warning in test module
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
This is one of the drivers with an unused variable that is marked 'const'. Adding a __used annotation here avoids the warning and lets us enable the option by default:
lib/test_ubsan.c:137:28: error: unused variable 'skip_ubsan_array' [-Werror,-Wunused-const-variable]
--- lib/test_ubsan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_ubsan.c +1 -1
@@ -134,7 +134,7 @@ static const test_ubsan_fp test_ubsan_array[] = { };/* Excluded because they Oops the module. */ -static const test_ubsan_fp skip_ubsan_array[] = { +static __used const test_ubsan_fp skip_ubsan_array[] = { test_ubsan_divrem_overflow, };
Signature · 1 line
2.39.2
Kees Cook
AppliedRe: (subset) [PATCH 02/34] ubsan: fix unused variable warning in test module
Quoted 8 lines · Arnd Bergmann
This is one of the drivers with an unused variable that is marked 'const'. Adding a
__usedannotation here avoids the warning and lets us enable the option by default:
lib/test_ubsan.c:137:28: error: unused variable 'skip_ubsan_array' [-Werror,-Wunused-const-variable][...]
Applied to for-next/hardening, thanks!
[02/34] ubsan: fix unused variable warning in test module
https://git.kernel.org/kees/c/bbda3ba626b9
Take care,
Signature · 1 line
Kees Cook
PATCH 3/34 platform: goldfish: remove ACPI_PTR() annotations
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
On platforms without ACPI support, this causes a W=1 warning from gcc when the driver is built-in:
drivers/platform/goldfish/goldfish_pipe.c:925:36: warning: 'goldfish_pipe_acpi_match' defined but not used [-Wunused-const-variable=]
925 | static const struct acpi_device_id goldfish_pipe_acpi_match[] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~There is no real harm in just keeping the small table around, so rather than adding more #ifdef checks, just reference it unconditionally to avoid the warning.
--- drivers/platform/goldfish/goldfish_pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/goldfish/goldfish_pipe.c +1 -1
@@ -940,7 +940,7 @@ static struct platform_driver goldfish_pipe_driver = { .driver = { .name = "goldfish_pipe", .of_match_table = goldfish_pipe_of_match, - .acpi_match_table = ACPI_PTR(goldfish_pipe_acpi_match), + .acpi_match_table = goldfish_pipe_acpi_match, } };
Signature · 1 line
2.39.2
Re: [PATCH 03/34] platform: goldfish: remove ACPI_PTR() annotations
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
On platforms without ACPI support, this causes a W=1 warning from gcc when the driver is built-in:
Quoted 7 lines
drivers/platform/goldfish/goldfish_pipe.c:925:36: warning: 'goldfish_pipe_acpi_match' defined but not used [-Wunused-const-variable=]925 | static const struct acpi_device_id goldfish_pipe_acpi_match[] = { | ^~~~~~~~~~~~~~~~~~~~~~~~There is no real harm in just keeping the small table around, so rather than adding more #ifdef checks, just reference it unconditionally to avoid the warning.
With this change you also may replace acpi.h by mod_devicetable.h. Please, also check all other conversions that you may replace of*.h/acpi.h by a proper one, i.e. mod_devicetable.h.
When addressed, this one
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 4/34 i2c: pxa: hide unused icr_bits[] variable
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The function using this is hidden in an #ifdef, so the variable needs the same one for a clean W=1 build:
drivers/i2c/busses/i2c-pxa.c:327:26: error: 'icr_bits' defined but not used [-Werror=unused-const-variable=]
--- drivers/i2c/busses/i2c-pxa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-pxa.c +1 -1
@@ -324,6 +324,7 @@ static void decode_ISR(unsigned int val)decode_bits (KERN_DEBUG "ISR" , isr_bits,ARRAY_SIZE (isr_bits), val); } +#ifdef CONFIG_I2C_PXA_SLAVE static const struct bits icr_bits[] = {PXA_BIT (ICR_START ,"START" ,NULL ), PXA_BIT(ICR_STOP, "STOP", NULL),
@@ -342,7 +343,6 @@ static const struct bits icr_bits[] = { PXA_BIT(ICR_UR, "UR", "ur"), }; -#ifdef CONFIG_I2C_PXA_SLAVE static void decode_ICR (unsigned int val) {decode_bits (KERN_DEBUG "ICR" , icr_bits,ARRAY_SIZE (icr_bits), val);
Signature · 1 line
2.39.2
Re: [PATCH 04/34] i2c: pxa: hide unused icr_bits[] variable
Hi Arnd,
Quoted 9 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The function using this is hidden in an #ifdef, so the variable needs the same one for a clean W=1 build:
drivers/i2c/busses/i2c-pxa.c:327:26: error: 'icr_bits' defined but not used [-Werror=unused-const-variable=]Fixes d6a7b5f84b5c ("[ARM] 4827/1: fix two warnings in drivers/i2c/busses/i2c-pxa.c")Signed-off-by Arnd Bergmann <[email protected]>
Applied to i2c/i2c-host-fixes on
git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git
Thank you,
Andi
Patches applied
===============
[04/34] i2c: pxa: hide unused icr_bits[] variable
commit: 95197779091166b9ed4b1c630c13600abf94ada7
PATCH 5/34 3c515: remove unused 'mtu' variable
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
This has never been used since the start of the git history. When building with W=1, the unused variable produces a gcc warning:
drivers/net/ethernet/3com/3c515.c:35:18: error: 'mtu' defined but not used [-Werror=unused-const-variable=]
Just remove it.
--- drivers/net/ethernet/3com/3c515.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/3com/3c515.c +0 -3
@@ -31,9 +31,6 @@Setting to > 1512 effectively disables this feature. */ static int rx_copybreak =200 ; -/* Allow setting MTU to a larger size, bypassing the normal ethernet setup. */ -static const int mtu =1500 ; -/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ static int max_interrupt_work =20 ;
Signature · 1 line
2.39.2
PATCH 6/34 tracing: hide unused ftrace_event_id_fops
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When CONFIG_PERF_EVENTS, a 'make W=1' build produces a warning about the unused ftrace_event_id_fops variable:
kernel/trace/trace_events.c:2155:37: error: 'ftrace_event_id_fops' defined but not used [-Werror=unused-const-variable=]
2155 | static const struct file_operations ftrace_event_id_fops = {
Hide this in the same #ifdef as the reference to it.
--- kernel/trace/trace_events.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/trace/trace_events.c +4 -0
@@ -1670,6 +1670,7 @@ static int trace_format_open(struct inode *inode, struct file *file)return 0 ; } +#ifdef CONFIG_PERF_EVENTS static ssize_t event_id_read (struct file *filp,char __user *ubuf,size_t cnt,loff_t *ppos) {
@@ -1684,6 +1685,7 @@ event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)return simple_read_from_buffer (ubuf, cnt, ppos, buf, len); } +#endif static ssize_t event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
@@ -2152,10 +2154,12 @@ static const struct file_operations ftrace_event_format_fops = { .release = seq_release, }; +#ifdef CONFIG_PERF_EVENTS static const struct file_operations ftrace_event_id_fops = { .read = event_id_read, .llseek = default_llseek, }; +#endif static const struct file_operations ftrace_event_filter_fops = { .open = tracing_open_file_tr,
Signature · 1 line
2.39.2
PATCH 7/34 Input: stmpe-ts - mark OF related data as maybe unused
In reply to Arnd BergmannFrom: Krzysztof Kozlowski <[email protected]>
When compile tested with W=1 on x86_64 with driver as built-in:
stmpe-ts.c:371:34: error: unused variable 'stmpe_ts_ids' [-Werror,-Wunused-const-variable]
--- drivers/input/touchscreen/stmpe-ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/stmpe-ts.c +1 -1
@@ -366,7 +366,7 @@ static struct platform_driver stmpe_ts_driver = { };module_platform_driver (stmpe_ts_driver); -static const struct of_device_id stmpe_ts_ids[] = { +static const struct of_device_id stmpe_ts_ids[]__maybe_unused = { { .compatible ="st,stmpe-ts" , }, { }, };
Signature · 1 line
2.39.2
Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
Quoted 5 lines · Arnd Bergmann
From: Krzysztof Kozlowski <[email protected]>
When compile tested with W=1 on
x86_64with driver as built-in:stmpe-ts.c:371:34: error: unused variable '
stmpe_ts_ids' [-Werror,-Wunused-const-variable]
...
drivers/input/touchscreen/stmpe-ts.c static struct platform_driver stmpe_ts_driver = { · line 369
Quoted 2 lines
drivers/input/touchscreen/stmpe-ts.c +1
-1-static const struct of_device_id stmpe_ts_ids[] = { +static const struct of_device_id stmpe_ts_ids[]__maybe_unused = {
__maybe_unused?
Why not adding it into .driver as you have done in another patch in this series?
Quoted 3 lines
drivers/input/touchscreen/stmpe-ts.c +0
-0{ .compatible = "st,stmpe-ts", }, { }, };
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Arnd Bergmann
From: Krzysztof Kozlowski <[email protected]>
When compile tested with W=1 on
x86_64with driver as built-in:stmpe-ts.c:371:34: error: unused variable '
stmpe_ts_ids' [-Werror,-Wunused-const-variable]
Quoted 8 lines
...
drivers/input/touchscreen/stmpe-ts.c static struct platform_driver stmpe_ts_driver = { · line 369
Quoted 2 lines
drivers/input/touchscreen/stmpe-ts.c +1
-1-static const struct of_device_id stmpe_ts_ids[] = { +static const struct of_device_id stmpe_ts_ids[]__maybe_unused = {
__maybe_unused?Why not adding it into .driver as you have done in another patch in this series?
Because there is no benefit in this. This is instantiated by MFD, so the only thing you need is entry for module loading.
Best regards,
Krzysztof
Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
Quoted 2 lines · Krzysztof Kozlowski
Quoted 1 line · Andy Shevchenko
On Wed, Apr 03, 2024 at 10:06:25AM +0200, Arnd Bergmann wrote:
...
Quoted 9 lines
Quoted 6 lines
drivers/input/touchscreen/stmpe-ts.c static struct platform_driver stmpe_ts_driver = { · line 369
Quoted 2 lines
drivers/input/touchscreen/stmpe-ts.c +1
-1-static const struct of_device_id stmpe_ts_ids[] = { +static const struct of_device_id stmpe_ts_ids[]__maybe_unused = {
__maybe_unused?Why not adding it into .driver as you have done in another patch in this series?
Because there is no benefit in this. This is instantiated by MFD, so the only thing you need is entry for module loading.
Hmm... Seems to me rather a good candidate for MODULE_ALIAS in this case. No?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
Quoted 11 lines · Andy Shevchenko
Quoted 2 lines · Krzysztof Kozlowski
Quoted 1 line · Andy Shevchenko
On Wed, Apr 03, 2024 at 10:06:25AM +0200, Arnd Bergmann wrote:
...
Quoted 5 lines
Quoted 5 lines
drivers/input/touchscreen/stmpe-ts.c static struct platform_driver stmpe_ts_driver = { · line 369
Quoted 2 lines
drivers/input/touchscreen/stmpe-ts.c +1
-1-static const struct of_device_id stmpe_ts_ids[] = { +static const struct of_device_id stmpe_ts_ids[]__maybe_unused = {
__maybe_unused?
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Why not adding it into .driver as you have done in another patch in this series?
Because there is no benefit in this. This is instantiated by MFD, so the only thing you need is entry for module loading.
Hmm... Seems to me rather a good candidate for
MODULE_ALIASin this case. No?
No, I do not think module alias is for that purpose. This is a valid compatible, documented and provided by DT so it is expected to be in of_device_id.
Best regards,
Krzysztof
Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
In reply to Arnd BergmannHello,
Quoted 17 lines · Arnd Bergmann
From: Krzysztof Kozlowski <[email protected]>
When compile tested with W=1 on
x86_64with driver as built-in:stmpe-ts.c:371:34: error: unused variable '
stmpe_ts_ids' [-Werror,-Wunused-const-variable]Signed-off-by Krzysztof Kozlowski <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>--- drivers/input/touchscreen/stmpe-ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/touchscreen/stmpe-ts.c +0
-0
drivers/input/touchscreen/stmpe-ts.c static struct platform_driver stmpe_ts_driver = { · line 372
Quoted 8 lines
drivers/input/touchscreen/stmpe-ts.c +1
-1@@ -366,7 +366,7 @@ static struct platform_driver stmpe_ts_driver = { };module_platform_driver (stmpe_ts_driver); -static const struct of_device_id stmpe_ts_ids[] = { +static const struct of_device_id stmpe_ts_ids[]__maybe_unused = { { .compatible ="st,stmpe-ts" , }, { }, };
I'd suggest the following instead:
drivers/input/touchscreen/stmpe-ts.c +10 -9
@@ -357,21 +357,22 @@ static void stmpe_ts_remove(struct platform_device *pdev)stmpe_disable (ts->stmpe,STMPE_BLOCK_TOUCHSCREEN ); } -static struct platform_driver stmpe_ts_driver = { - .driver = { - .name =STMPE_TS_NAME , - }, - .probe = stmpe_input_probe, - .remove_new = stmpe_ts_remove, -}; -module_platform_driver (stmpe_ts_driver); -static const struct of_device_id stmpe_ts_ids[] = { { .compatible ="st,stmpe-ts" , }, { }, };MODULE_DEVICE_TABLE (of, stmpe_ts_ids); +static struct platform_driver stmpe_ts_driver = { + .driver = { + .name =STMPE_TS_NAME , + .of_match_table = stmpe_ts_ids, + }, + .probe = stmpe_input_probe, + .remove_new = stmpe_ts_remove, +}; +module_platform_driver (stmpe_ts_driver); +MODULE_AUTHOR ("Luotao Fu <[email protected]>" );MODULE_DESCRIPTION ("STMPEXXX touchscreen driver" );MODULE_LICENSE ("GPL" );
I wonder if with the status quo binding via dt works at all with stmpe_ts_driver.driver.of_match_table unset?!
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
Hello again,
Quoted 66 lines · Uwe Kleine-König
Quoted 17 lines · Arnd Bergmann
From: Krzysztof Kozlowski <[email protected]>
When compile tested with W=1 on
x86_64with driver as built-in:stmpe-ts.c:371:34: error: unused variable '
stmpe_ts_ids' [-Werror,-Wunused-const-variable]Signed-off-by Krzysztof Kozlowski <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>--- drivers/input/touchscreen/stmpe-ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/touchscreen/stmpe-ts.c +0
-0drivers/input/touchscreen/stmpe-ts.c static struct platform_driver stmpe_ts_driver = { · line 372
Quoted 8 lines
drivers/input/touchscreen/stmpe-ts.c +1
-1@@ -366,7 +366,7 @@ static struct platform_driver stmpe_ts_driver = { };module_platform_driver (stmpe_ts_driver); -static const struct of_device_id stmpe_ts_ids[] = { +static const struct of_device_id stmpe_ts_ids[]__maybe_unused = { { .compatible ="st,stmpe-ts" , }, { }, };I'd suggest the following instead:
drivers/input/touchscreen/stmpe-ts.c +10
-9@@ -357,21 +357,22 @@ static void stmpe_ts_remove(struct platform_device *pdev)stmpe_disable (ts->stmpe,STMPE_BLOCK_TOUCHSCREEN ); } -static struct platform_driver stmpe_ts_driver = { - .driver = { - .name =STMPE_TS_NAME , - }, - .probe = stmpe_input_probe, - .remove_new = stmpe_ts_remove, -}; -module_platform_driver (stmpe_ts_driver); -static const struct of_device_id stmpe_ts_ids[] = { { .compatible ="st,stmpe-ts" , }, { }, };MODULE_DEVICE_TABLE (of, stmpe_ts_ids); +static struct platform_driver stmpe_ts_driver = { + .driver = { + .name =STMPE_TS_NAME , + .of_match_table = stmpe_ts_ids, + }, + .probe = stmpe_input_probe, + .remove_new = stmpe_ts_remove, +}; +module_platform_driver (stmpe_ts_driver); +MODULE_AUTHOR ("Luotao Fu <[email protected]>" );MODULE_DESCRIPTION ("STMPEXXX touchscreen driver" );MODULE_LICENSE ("GPL" );
Quoted 2 lines
I wonder if with the status quo binding via dt works at all with stmpe_ts_driver.driver.of_match_table unset?!
I missed the discussion between Andy and Krzysztof when I wrote my mail. I still think this should be considered and if .of_match_table should stay unassigned (e.g. to allow dropping stmpe_ts_ids in case the driver is built-in?) I think adding a code comment would be appropriate because having an of_device_id array but not adding it to the driver is unusuall and generally a bad template for new drivers.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
PATCH 8/34 Input: synaptics: hide unused smbus_pnp_ids[] array
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When SMBUS is disabled, this is never referenced, causing a W=1 warning:
drivers/input/mouse/synaptics.c:164:27: error: 'smbus_pnp_ids' defined but not used [-Werror=unused-const-variable=]
Hide the array behind the same #ifdef as the code referencing it.
--- drivers/input/mouse/synaptics.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/mouse/synaptics.c +2 -0
@@ -161,6 +161,7 @@ static const char * const topbuttonpad_pnp_ids[] = {NULL }; +#ifdef CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS static const char *const smbus_pnp_ids[] = {/* all of the topbuttonpad_pnp_ids are valid, we just add some extras */ "LEN0048", /* X1 Carbon 3 */
@@ -195,6 +196,7 @@ static const char * const smbus_pnp_ids[] = {"SYN3257" ,/* HP Envy 13-ad105ng */ NULL }; +#endif static const char *const forcepad_pnp_ids[] = {"SYN300D" ,
Signature · 1 line
2.39.2
PATCH 9/34 power: rt9455: hide unused rt9455_boost_voltage_values
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The rt9455_boost_voltage_values[] array is only used when USB PHY support is enabled, causing a W=1 warning otherwise:
drivers/power/supply/rt9455_charger.c:200:18: error: 'rt9455_boost_voltage_values' defined but not used [-Werror=unused-const-variable=]
Enclose the definition in the same #ifdef as the references to it.
--- drivers/power/supply/rt9455_charger.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/power/supply/rt9455_charger.c +2 -0
@@ -192,6 +192,7 @@ static const int rt9455_voreg_values[] = { 4450000, 4450000, 4450000, 4450000, 4450000, 4450000, 4450000, 4450000 }; +#if IS_ENABLED (CONFIG_USB_PHY )/* * When the charger is in boost mode, REG02[7:2] represent boost output * voltage.
@@ -207,6 +208,7 @@ static const int rt9455_boost_voltage_values[] = {5600000 ,5600000 ,5600000 ,5600000 ,5600000 ,5600000 ,5600000 ,5600000 , 5600000, 5600000, 5600000, 5600000, 5600000, 5600000, 5600000, 5600000, }; +#endif /* REG07[3:0] (VMREG) in uV */ static const int rt9455_vmreg_values[] = {
Signature · 1 line
2.39.2
PATCH 10/34 efi: sysfb: don't build when EFI is disabled
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
With 'make W=1', there is a warning when EFI is turned off but sysfb_efi still gets built:
drivers/firmware/efi/sysfb_efi.c:188:35: error: unused variable 'efifb_dmi_system_table' [-Werror,-Wunused-const-variable]
static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
^
drivers/firmware/efi/sysfb_efi.c:238:35: error: unused variable 'efifb_dmi_swap_width_height' [-Werror,-Wunused-const-variable]
static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
^drivers/firmware/efi/sysfb_efi.c:297:28: error: unused function 'find_pci_overlap_node' [-Werror,-Wunused-function] static struct device_node *find_pci_overlap_node(void)
There was an earlier patch to address the duplicate function definitions, but that missed how we should not be building this file in the first place.
--- drivers/firmware/efi/Makefile | 3 ++- drivers/firmware/efi/sysfb_efi.c | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/firmware/efi/Makefile +2 -1
@@ -30,7 +30,8 @@ obj-$(CONFIG_EFI_RCI2_TABLE) += rci2-table.o obj-$(CONFIG_EFI_EMBEDDED_FIRMWARE) += embedded-firmware.o obj-$(CONFIG_LOAD_UEFI_KEYS) += mokvar-table.o -obj-$(CONFIG_SYSFB) += sysfb_efi.o +sysfb-$(CONFIG_SYSFB) += sysfb_efi.o +obj-$(CONFIG_EFI) += $(sysfb-y) arm-obj-$(CONFIG_EFI) := efi-init.o arm-runtime.o obj-$(CONFIG_ARM) += $(arm-obj-y)
drivers/firmware/efi/sysfb_efi.c +0 -2
@@ -346,7 +346,6 @@ static const struct fwnode_operations efifb_fwnode_ops = { .add_links = efifb_add_links, }; -#ifdef CONFIG_EFI static struct fwnode_handle efifb_fwnode;__init void sysfb_apply_efi_quirks (void )
@@ -372,4 +371,3 @@ __init void sysfb_set_efifb_fwnode(struct platform_device *pd) pd->dev.fwnode = &efifb_fwnode; } } -#endif
Signature · 1 line
2.39.2
Re: [PATCH 10/34] efi: sysfb: don't build when EFI is disabled
Quoted 12 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
With 'make W=1', there is a warning when EFI is turned off but
sysfb_efistill gets built:
drivers/firmware/efi/sysfb_efi.c:188:35: error: unused variable 'efifb_dmi_system_table' [-Werror,-Wunused-const-variable]static const struct dmi_system_id efifb_dmi_system_table[] __initconst = { ^ drivers/firmware/efi/sysfb_efi.c:238:35: error: unused variable 'efifb_dmi_swap_width_height' [-Werror,-Wunused-const-variable] static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = { ^
Quoted 8 lines
drivers/firmware/efi/sysfb_efi.c:297:28: error: unused function 'find_pci_overlap_node' [-Werror,-Wunused-function] static structdevice_node*find_pci_overlap_node(void)There was an earlier patch to address the duplicate function definitions, but that missed how we should not be building this file in the first place.
Fixes 15d27b15de96 ("efi: sysfb_efi: fix build when EFI is not set")Signed-off-by Arnd Bergmann <[email protected]>
or I can take it via the EFI tree if you prefer.
Quoted 39 lines
--- drivers/firmware/efi/Makefile | 3 ++- drivers/firmware/efi/sysfb_efi.c | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-)drivers/firmware/efi/Makefile +2
-1@@ -30,7 +30,8 @@ obj-$(CONFIG_EFI_RCI2_TABLE) += rci2-table.o obj-$(CONFIG_EFI_EMBEDDED_FIRMWARE) += embedded-firmware.o obj-$(CONFIG_LOAD_UEFI_KEYS) += mokvar-table.o -obj-$(CONFIG_SYSFB) += sysfb_efi.o +sysfb-$(CONFIG_SYSFB) += sysfb_efi.o +obj-$(CONFIG_EFI) += $(sysfb-y) arm-obj-$(CONFIG_EFI) := efi-init.o arm-runtime.o obj-$(CONFIG_ARM) += $(arm-obj-y)drivers/firmware/efi/sysfb_efi.c +0
-3@@ -346,7 +346,6 @@ static const struct fwnode_operations efifb_fwnode_ops = { .add_links = efifb_add_links, }; -#ifdef CONFIG_EFI static struct fwnode_handle efifb_fwnode;__init void sysfb_apply_efi_quirks (void )@@ -372,4 +371,3 @@ __init void sysfb_set_efifb_fwnode(struct platform_device *pd) pd->dev.fwnode = &efifb_fwnode; } } -#endif --2.39.2
Javier Martinez Canillas
Acked-byRe: [PATCH 10/34] efi: sysfb: don't build when EFI is disabled
Quoted 16 lines · Ard Biesheuvel
Quoted 15 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
With 'make W=1', there is a warning when EFI is turned off but
sysfb_efistill gets built:
drivers/firmware/efi/sysfb_efi.c:188:35: error: unused variable 'efifb_dmi_system_table' [-Werror,-Wunused-const-variable]static const struct dmi_system_id efifb_dmi_system_table[] __initconst = { ^ drivers/firmware/efi/sysfb_efi.c:238:35: error: unused variable 'efifb_dmi_swap_width_height' [-Werror,-Wunused-const-variable] static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = { ^
drivers/firmware/efi/sysfb_efi.c:297:28: error: unused function 'find_pci_overlap_node' [-Werror,-Wunused-function] static structdevice_node*find_pci_overlap_node(void)
Quoted 8 lines
Quoted 5 lines
There was an earlier patch to address the duplicate function definitions, but that missed how we should not be building this file in the first place.
Fixes 15d27b15de96 ("efi: sysfb_efi: fix build when EFI is not set")Signed-off-by Arnd Bergmann <[email protected]>Acked-by Ard Biesheuvel <[email protected]>
Looks good to me too.
Quoted 2 lines
or I can take it via the EFI tree if you prefer.
I think that could be merged through your EFI tree. Thanks!
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
PATCH 11/34 clk: ti: dpll: fix incorrect #ifdef checks
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Building with W=1 shows warnings about unused const variables like this one:
drivers/clk/ti/dpll.c:99:29: error: unused variable 'omap3_dpll_core_ck_ops' [-Werror,-Wunused-const-variable] static const struct clk_ops omap3_dpll_core_ck_ops = {};
The problem is that the #ifdef checks for some of the structures in this file have gone out of sync with the code referencing them. Update these to match the current usage.
--- drivers/clk/ti/dpll.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/clk/ti/dpll.c +4 -6
@@ -34,8 +34,6 @@ static const struct clk_ops dpll_m4xen_ck_ops = { .save_context = &omap3_core_dpll_save_context, .restore_context = &omap3_core_dpll_restore_context, }; -#else -static const struct clk_ops dpll_m4xen_ck_ops = {};#endif #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) || \
@@ -95,11 +93,7 @@ static const struct clk_ops omap3_dpll_core_ck_ops = { .recalc_rate = &omap3_dpll_recalc, .round_rate = &omap2_dpll_round_rate, }; -#else -static const struct clk_ops omap3_dpll_core_ck_ops = {}; -#endif -#ifdef CONFIG_ARCH_OMAP3 static const struct clk_ops omap3_dpll_ck_ops = { .enable = &omap3_noncore_dpll_enable, .disable = &omap3_noncore_dpll_disable,
@@ -137,9 +131,13 @@ static const struct clk_ops omap3_dpll_per_ck_ops = { };#endif +#if defined(CONFIG_ARCH_OMAP4 ) || defined(CONFIG_SOC_OMAP5 ) || \ + defined(CONFIG_SOC_DRA7XX ) || defined(CONFIG_SOC_AM33XX ) || \ + defined(CONFIG_SOC_AM43XX )static const struct clk_ops dpll_x2_ck_ops = { .recalc_rate = &omap3_clkoutx2_recalc, }; +#endif /** * _register_dpll - low level registration of a DPLL clock
Signature · 1 line
2.39.2
Re: [PATCH 11/34] clk: ti: dpll: fix incorrect #ifdef checks
Quoted 3 lines · Arnd Bergmann
The problem is that the #ifdef checks for some of the structures in this file have gone out of sync with the code referencing them. Update these to match the current usage.
Looks good to me:
Re: [PATCH 11/34] clk: ti: dpll: fix incorrect #ifdef checks
In reply to Arnd BergmannQuoting Arnd Bergmann (2024-04-03 01:06:29)
Quoted 7 lines
From: Arnd Bergmann <[email protected]>
Building with W=1 shows warnings about unused const variables like this one:
drivers/clk/ti/dpll.c:99:29: error: unused variable 'omap3_dpll_core_ck_ops' [-Werror,-Wunused-const-variable] static const structclk_opsomap3_dpll_core_ck_ops= {};
Quoted 6 lines
The problem is that the #ifdef checks for some of the structures in this file have gone out of sync with the code referencing them. Update these to match the current usage.
Signed-off-by Arnd Bergmann <[email protected]>---
Applied to clk-next
PATCH 12/34 apm-emulation: hide an unused variable
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The driver_version variable is only used inside of an #ifdef block, which leads to a W=1 warning:
drivers/char/apm-emulation.c:144:19: error: 'driver_version' defined but not used [-Werror=unused-const-variable=]
Move this into the function using it.
--- drivers/char/apm-emulation.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/char/apm-emulation.c +2 -3
@@ -141,9 +141,6 @@ static struct apm_queue kapmd_queue;static DEFINE_MUTEX (state_lock); -static const char driver_version[] ="1.13" ;/* no spaces */ - -/* * Compatibility cruft until the IPAQ people move over to the new
@@ -435,6 +432,8 @@ static struct miscdevice apm_device = {*/ static int proc_apm_show (struct seq_file *m,void *v) { +static const char driver_version[] ="1.13" ;/* no spaces */ +struct apm_power_info info;char *units;
Signature · 1 line
2.39.2
Re: [PATCH 12/34] apm-emulation: hide an unused variable
Quoted 30 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The
driver_versionvariable is only used inside of an #ifdef block, which leads to a W=1 warning:
drivers/char/apm-emulation.c:144:19: error: 'driver_version' defined but not used [-Werror=unused-const-variable=]Move this into the function using it.
Fixes 7726942fb15e ("[APM] Add shared version of APM emulation")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/char/apm-emulation.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/char/apm-emulation.c +0
-3@@ -141,9 +141,6 @@ static struct apm_queue kapmd_queue;static DEFINE_MUTEX (state_lock); -static const char driver_version[] ="1.13" ;/* no spaces */ - -/* * Compatibility cruft until the IPAQ people move over to the new
drivers/char/apm-emulation.c static struct miscdevice apm_device = { · line 438
Quoted 7 lines
drivers/char/apm-emulation.c +2
-0@@ -435,6 +432,8 @@ static struct miscdevice apm_device = {*/ static int proc_apm_show (struct seq_file *m,void *v) { +static const char driver_version[] ="1.13" ;/* no spaces */ +struct apm_power_info info;char *units;
Heh, I really should mark this driver as Orphaned. Anyway, for this particular patch:
Signature · 2 lines
Jiri Kosina SUSE Labs
PATCH 13/34 sisfb: hide unused variables
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Building with W=1 shows that a couple of variables in this driver are only used in certain configurations:
drivers/video/fbdev/sis/init301.c:239:28: error: 'SiS_Part2CLVX_6' defined but not used [-Werror=unused-const-variable=]
239 | static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:230:28: error: 'SiS_Part2CLVX_5' defined but not used [-Werror=unused-const-variable=]
230 | static const unsigned char SiS_Part2CLVX_5[] = { /* 750p */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:211:28: error: 'SiS_Part2CLVX_4' defined but not used [-Werror=unused-const-variable=]
211 | static const unsigned char SiS_Part2CLVX_4[] = { /* PAL */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:192:28: error: 'SiS_Part2CLVX_3' defined but not used [-Werror=unused-const-variable=]
192 | static const unsigned char SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:184:28: error: 'SiS_Part2CLVX_2' defined but not used [-Werror=unused-const-variable=]
184 | static const unsigned char SiS_Part2CLVX_2[] = {
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:176:28: error: 'SiS_Part2CLVX_1' defined but not used [-Werror=unused-const-variable=]
176 | static const unsigned char SiS_Part2CLVX_1[] = {
| ^~~~~~~~~~~~~~~This started showing up after the definitions were moved into the source file from the header, which was not flagged by the compiler. Move the definition into the appropriate #ifdef block that already exists next to them.
--- drivers/video/fbdev/sis/init301.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/fbdev/sis/init301.c +1 -2
@@ -172,7 +172,7 @@ static const unsigned char SiS_HiTVGroup3_2[] = { };/* 301C / 302ELV extended Part2 TV registers (4 tap scaler) */ - +#ifdef CONFIG_FB_SIS_315 static const unsigned char SiS_Part2CLVX_1[] = {0x00 ,0x00 , 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
@@ -245,7 +245,6 @@ static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */ 0xFF,0xFF, }; -#ifdef CONFIG_FB_SIS_315 /* 661 et al LCD data structure (2.03.00) */ static const unsigned char SiS_LCDStruct661[] = {/* 1024x768 */
Signature · 1 line
2.39.2
Re: [PATCH 13/34] sisfb: hide unused variables
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Building with W=1 shows that a couple of variables in this driver are only used in certain configurations:
Quoted 7 lines
drivers/video/fbdev/sis/init301.c:239:28: error: 'SiS_Part2CLVX_6' defined but not used [-Werror=unused-const-variable=]
...Fixes 5908986ef348 ("video: fbdev: sis: avoid mismatched prototypes")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/video/fbdev/sis/init301.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
applied to fbdev git tree.
Thanks!
Helge
PATCH 14/34 dma/congiguous: avoid warning about unused size_bytes
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When building with W=1, this variable is unused for configs with CONFIG_CMA_SIZE_SEL_PERCENTAGE=y:
kernel/dma/contiguous.c:67:26: error: 'size_bytes' defined but not used [-Werror=unused-const-variable=]
Mark it as __maybe_unused to avoid the warning without adding more ifdef checks to this file.
--- kernel/dma/contiguous.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/contiguous.c +1 -1
@@ -64,7 +64,7 @@ struct cma *dma_contiguous_default_area;* Users, who want to set the size of global CMA area for their system * should use cma= kernel parameter. */ -static const phys_addr_t size_bytes__initconst = +static const phys_addr_t size_bytes__initconst __maybe_unused = (phys_addr_t )CMA_SIZE_MBYTES *SZ_1M ;static phys_addr_t size_cmdline__initdata =-1 ;static phys_addr_t base_cmdline__initdata ;
Signature · 1 line
2.39.2
Re: [PATCH 14/34] dma/congiguous: avoid warning about unused size_bytes
contiguous is misspelled in the subject.
Instead of the __maybe_unused annotation I'd just conver it to a cpp #define. I can take care of that if you want.
PATCH 15/34 leds: apu: remove duplicate DMI lookup data
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Building with W=1 shows a warning about an unused dmi_system_id table:
drivers/leds/leds-apu.c:85:35: error: 'apu_led_dmi_table' defined but not used [-Werror=unused-const-variable=]
85 | static const struct dmi_system_id apu_led_dmi_table[] __initconst = {
Since the current version doesn't even do anything about the different implementations but only checks the type of system, just drop the custom lookup logic and call dmi_check_system() using the table itself.
--- drivers/leds/leds-apu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/leds/leds-apu.c +1 -2
@@ -181,8 +181,7 @@ static int __init apu_led_init(void)struct platform_device *pdev;int err; -if (!(dmi_match (DMI_SYS_VENDOR ,"PC Engines" ) && - (dmi_match (DMI_PRODUCT_NAME ,"APU" ) ||dmi_match (DMI_PRODUCT_NAME ,"apu1" )))) { +if (!dmi_check_system (apu_led_dmi_table)) {pr_err ("No PC Engines APUv1 board detected. For APUv2,3 support, enable CONFIG_PCENGINES_APU2\n" );return -ENODEV ; }
Signature · 1 line
2.39.2
Re: (subset) [PATCH 15/34] leds: apu: remove duplicate DMI lookup data
Quoted 10 lines · Arnd Bergmann
Building with W=1 shows a warning about an unused
dmi_system_idtable:
drivers/leds/leds-apu.c:85:35: error: 'apu_led_dmi_table' defined but not used [-Werror=unused-const-variable=]
85 | static const structdmi_system_idapu_led_dmi_table[]__initconst= {Since the current version doesn't even do anything about the different implementations but only checks the type of system, just drop the custom lookup logic and call
dmi_check_system()using the table itself.[...]
Applied, thanks!
[15/34] leds: apu: remove duplicate DMI lookup data
commit: 6e37e66058d9c0bfa13d32e2c6ff14439d5e62f9
--
Lee Jones [李琼斯]
PATCH 16/34 iio: ad5755: hook up of_device_id lookup to platform driver
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When the driver is built-in, 'make W=1' warns about an unused ID table:
drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
866 | static const struct of_device_id ad5755_of_match[] = {
While the data is duplicated in the spi_device_id, it's common to use the actual OF compatible strings in the driver.
Since there are no in-tree users of plain platform devices, the spi_device_id table could actually be dropped entirely with this.
--- drivers/iio/dac/ad5755.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/dac/ad5755.c +1 -0
@@ -876,6 +876,7 @@ MODULE_DEVICE_TABLE(of, ad5755_of_match);static struct spi_driver ad5755_driver = { .driver = { .name ="ad5755" , + .of_match_table = ad5755_of_match, }, .probe = ad5755_probe, .id_table = ad5755_id,
Signature · 1 line
2.39.2
Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When the driver is built-in, 'make W=1' warns about an unused ID table:
Quoted 8 lines
drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
866 | static const structof_device_idad5755_of_match[] = {While the data is duplicated in the
spi_device_id, it's common to use the actual OF compatible strings in the driver.Since there are no in-tree users of plain platform devices, the
spi_device_idtable could actually be dropped entirely with this.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
In reply to Arnd BergmannQuoted 24 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When the driver is built-in, 'make W=1' warns about an unused ID table:
drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
866 | static const structof_device_idad5755_of_match[] = {While the data is duplicated in the
spi_device_id, it's common to use the actual OF compatible strings in the driver.Since there are no in-tree users of plain platform devices, the
spi_device_idtable could actually be dropped entirely with this.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/iio/dac/ad5755.c | 1 + 1 file changed, 1 insertion(+)drivers/iio/dac/ad5755.c +0
-0
drivers/iio/dac/ad5755.c MODULE_DEVICE_TABLE(of, ad5755_of_match); · line 879
Quoted 4 lines
drivers/iio/dac/ad5755.c +1
-0@@ -876,6 +876,7 @@ MODULE_DEVICE_TABLE(of, ad5755_of_match);static struct spi_driver ad5755_driver = { .driver = { .name ="ad5755" , + .of_match_table = ad5755_of_match,
I was working on this as well and have a bit bigger solution, following Jonathan's preference (I think):
https://lore.kernel.org/all/20240226192555.14aa178e@jic23-huawei/
I need to send v3, somehow I missed his comments.
Jonathan,
Do you want me to still work on this according to your comments (which I missed, I am sorry).
Best regards,
Krzysztof
Arnd Bergmann
maintainerRe: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
Quoted 33 lines · Krzysztof Kozlowski
Quoted 24 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When the driver is built-in, 'make W=1' warns about an unused ID table:
drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
866 | static const structof_device_idad5755_of_match[] = {While the data is duplicated in the
spi_device_id, it's common to use the actual OF compatible strings in the driver.Since there are no in-tree users of plain platform devices, the
spi_device_idtable could actually be dropped entirely with this.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/iio/dac/ad5755.c | 1 + 1 file changed, 1 insertion(+)drivers/iio/dac/ad5755.c +0
-0drivers/iio/dac/ad5755.c MODULE_DEVICE_TABLE(of, ad5755_of_match); · line 879
Quoted 4 lines
drivers/iio/dac/ad5755.c +1
-0@@ -876,6 +876,7 @@ MODULE_DEVICE_TABLE(of, ad5755_of_match);static struct spi_driver ad5755_driver = { .driver = { .name ="ad5755" , + .of_match_table = ad5755_of_match,I was working on this as well and have a bit bigger solution, following Jonathan's preference (I think):
Quoted 3 lines
https://lore.kernel.org/all/20240226192555.14aa178e@jic23-huawei/
I need to send v3, somehow I missed his comments.
Yes, that looks good as well, though you might need to drop spi_device_id table if you convert it to using pointers.
Arnd
Jonathan Cameron
maintainerRe: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
Quoted 34 lines · On Wed, 03 Apr 2024 12:01:13 +0200 "Arnd Bergmann" <[email protected]> wrote:
Quoted 33 lines · Krzysztof Kozlowski
Quoted 24 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When the driver is built-in, 'make W=1' warns about an unused ID table:
drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
866 | static const structof_device_idad5755_of_match[] = {While the data is duplicated in the
spi_device_id, it's common to use the actual OF compatible strings in the driver.Since there are no in-tree users of plain platform devices, the
spi_device_idtable could actually be dropped entirely with this.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/iio/dac/ad5755.c | 1 + 1 file changed, 1 insertion(+)drivers/iio/dac/ad5755.c +0
-0drivers/iio/dac/ad5755.c MODULE_DEVICE_TABLE(of, ad5755_of_match); · line 879
Quoted 4 lines
drivers/iio/dac/ad5755.c +1
-0@@ -876,6 +876,7 @@ MODULE_DEVICE_TABLE(of, ad5755_of_match);static struct spi_driver ad5755_driver = { .driver = { .name ="ad5755" , + .of_match_table = ad5755_of_match,I was working on this as well and have a bit bigger solution, following Jonathan's preference (I think):
Quoted 6 lines
Quoted 3 lines
https://lore.kernel.org/all/20240226192555.14aa178e@jic23-huawei/
I need to send v3, somehow I missed his comments.
Yes, that looks good as well, though you might need to drop
spi_device_idtable if you convert it to using pointers.
Put them in there as well (with appropriate cast). We don't want to stop supporting probe paths that might be using that.
My preference is for both tables, same pointers in each then the use of the relevant bus specific wrapper - here spi_get_device_match_data() which will happily deal with matches in either table (thus avoiding the potential mess of them getting out of sync)
Jonathan
Quoted 2 lines
Arnd
Jonathan Cameron
maintainerRe: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
In reply to Krzysztof KozlowskiQuoted 33 lines · On Wed, 3 Apr 2024 11:55:06 +0200 Krzysztof Kozlowski…
Quoted 24 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When the driver is built-in, 'make W=1' warns about an unused ID table:
drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
866 | static const structof_device_idad5755_of_match[] = {While the data is duplicated in the
spi_device_id, it's common to use the actual OF compatible strings in the driver.Since there are no in-tree users of plain platform devices, the
spi_device_idtable could actually be dropped entirely with this.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/iio/dac/ad5755.c | 1 + 1 file changed, 1 insertion(+)drivers/iio/dac/ad5755.c +0
-0drivers/iio/dac/ad5755.c MODULE_DEVICE_TABLE(of, ad5755_of_match); · line 879
Quoted 4 lines
drivers/iio/dac/ad5755.c +1
-0@@ -876,6 +876,7 @@ MODULE_DEVICE_TABLE(of, ad5755_of_match);static struct spi_driver ad5755_driver = { .driver = { .name ="ad5755" , + .of_match_table = ad5755_of_match,I was working on this as well and have a bit bigger solution, following Jonathan's preference (I think):
Quoted 7 lines
https://lore.kernel.org/all/20240226192555.14aa178e@jic23-huawei/
I need to send v3, somehow I missed his comments.
Jonathan,
Do you want me to still work on this according to your comments (which I missed, I am sorry).
No problem on missing the reply! (I'd forgotten all about this!) I would prefer that solution to this one that relies on the two tables having equivalent entries. So I'll not pick up this patch.
Thanks,
Jonathan
Quoted 4 lines
Best regards,
Krzysztof
PATCH 17/34 greybus: arche-ctrl: move device table to its right location
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The arche-ctrl has two platform drivers and three of_device_id tables, but one table is only used for the the module loader, while the other two seem to be associated with their drivers.
This leads to a W=1 warning when the driver is built-in:
drivers/staging/greybus/arche-platform.c:623:34: error: 'arche_combined_id' defined but not used [-Werror=unused-const-variable=]
623 | static const struct of_device_id arche_combined_id[] = {
Drop the extra table and register both tables that are actually used as the ones for the module loader instead.
--- drivers/staging/greybus/arche-apb-ctrl.c | 1 + drivers/staging/greybus/arche-platform.c | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/staging/greybus/arche-apb-ctrl.c +1 -0
@@ -466,6 +466,7 @@ static const struct of_device_id arche_apb_ctrl_of_match[] = { { .compatible = "usbffff,2", }, { }, }; +MODULE_DEVICE_TABLE (of, arche_apb_ctrl_of_match);static struct platform_driver arche_apb_ctrl_device_driver = { .probe = arche_apb_ctrl_probe,
drivers/staging/greybus/arche-platform.c +1 -8
@@ -619,14 +619,7 @@ static const struct of_device_id arche_platform_of_match[] = { { .compatible = "google,arche-platform", }, { }, }; - -static const struct of_device_id arche_combined_id[] = { -/* Use PID/VID of SVC device */ - { .compatible ="google,arche-platform" , }, - { .compatible ="usbffff,2" , }, - { }, -}; -MODULE_DEVICE_TABLE (of, arche_combined_id); +MODULE_DEVICE_TABLE (of, arche_platform_of_match);static struct platform_driver arche_platform_device_driver = { .probe = arche_platform_probe,
Signature · 1 line
2.39.2
Re: [PATCH 17/34] greybus: arche-ctrl: move device table to its right location
Quoted 6 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The arche-ctrl has two platform drivers and three
of_device_idtables, but one table is only used for the the module loader, while the other two seem to be associated with their drivers.
Quoted 7 lines
This leads to a W=1 warning when the driver is built-in:
drivers/staging/greybus/arche-platform.c:623:34: error: 'arche_combined_id' defined but not used [-Werror=unused-const-variable=]
623 | static const structof_device_idarche_combined_id[] = {Drop the extra table and register both tables that are actually used as the ones for the module loader instead.
So what I see is that this commit added arche_combined_id[]:
1e5dd1f8279a8 greybus: arche-platform: merge arche-apb-ctrl and
arche-platform
That moved the arche_apb_ctrl_device_driver struct and some other associated bits out of arche-apb-ctrl.c and into arche-platform.c. It *kept* arche_platform_of_match[] as the of_match_table for arche_platform_device_driver, but defined arche_combined_id[] and declared it for modalias to indicate both drivers were implemented in the single kernel module.
The later commit (the one you references in "Fixes") then moved the arche_apb_ctrl_device_driver etc. back to arche-apb-ctrl.c. That commit did *not* use MODULE_DEVICE_TABLE() to declare arche_apb_ctrl_of_match[] for modalias. And it simply kept the (no longer correct) arche_combined_id[] table to be used by the arche_platform_device_driver.
So your fix:
- Declares for modalias that arche_apb_ctrl_of_match[] is the of_match_table for arche_apb_ctrl_device_driver.
- Declares for modalias that arche_platform_of_match[] is the of_match_table for arche_platform_device_driver.
- Gets rid of arche_combined_id[], which is no longer used.
In short: looks good to me.
Quoted 40 lines
Fixes 7b62b61c752a ("greybus: arche-ctrl: Don't expose driver internals to arche-platform driver")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/staging/greybus/arche-apb-ctrl.c | 1 + drivers/staging/greybus/arche-platform.c | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-)drivers/staging/greybus/arche-apb-ctrl.c +1
-0@@ -466,6 +466,7 @@ static const struct of_device_id arche_apb_ctrl_of_match[] = { { .compatible = "usbffff,2", }, { }, }; +MODULE_DEVICE_TABLE (of, arche_apb_ctrl_of_match);static struct platform_driver arche_apb_ctrl_device_driver = { .probe = arche_apb_ctrl_probe,drivers/staging/greybus/arche-platform.c +1
-8@@ -619,14 +619,7 @@ static const struct of_device_id arche_platform_of_match[] = { { .compatible = "google,arche-platform", }, { }, }; - -static const struct of_device_id arche_combined_id[] = { -/* Use PID/VID of SVC device */ - { .compatible ="google,arche-platform" , }, - { .compatible ="usbffff,2" , }, - { }, -}; -MODULE_DEVICE_TABLE (of, arche_combined_id); +MODULE_DEVICE_TABLE (of, arche_platform_of_match);static struct platform_driver arche_platform_device_driver = { .probe = arche_platform_probe,
PATCH 18/34 lib: checksum: hide unused expected_csum_ipv6_magic[]
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When CONFIG_NET is disabled, an extra warning shows up for this unused variable:
lib/checksum_kunit.c:218:18: error: 'expected_csum_ipv6_magic' defined but not used [-Werror=unused-const-variable=]
Hide it under the same #ifdef as the reference to it.
--- lib/checksum_kunit.c | 2 ++ 1 file changed, 2 insertions(+)
lib/checksum_kunit.c +2 -0
@@ -215,6 +215,7 @@ static const u32 init_sums_no_overflow[] = { 0xffff0000, 0xfffffffb, }; +#ifdef CONFIG_NET static const u16 expected_csum_ipv6_magic[] = {0x18d4 ,0x3085 ,0x2e4b ,0xd9f4 ,0xbdc8 ,0x78f ,0x1034 ,0x8422 ,0x6fc0 , 0xd2f6, 0xbeb5, 0x9d3, 0x7e2a, 0x312e, 0x778e, 0xc1bb, 0x7cf2, 0x9d1e,
@@ -240,6 +241,7 @@ static const u16 expected_csum_ipv6_magic[] = {0x99aa ,0xb06b ,0xee19 ,0xcc2c ,0xf34c ,0x7c49 ,0xdac3 ,0xa71e ,0xc988 ,0x3845 ,0x1014 }; +#endif static const u16 expected_fast_csum[] = {0xda83 ,0x45da ,0x4f46 ,0x4e4f ,0x34e ,0xe902 ,0xa5e9 ,0x87a5 ,0x7187 ,
Signature · 1 line
2.39.2
Re: [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[]
Le 03/04/2024 à 10:06, Arnd Bergmann a écrit :
Quoted 10 lines
From: Arnd Bergmann <[email protected]>
When
CONFIG_NETis disabled, an extra warning shows up for this unused variable:
lib/checksum_kunit.c:218:18: error: 'expected_csum_ipv6_magic' defined but not used [-Werror=unused-const-variable=]Hide it under the same #ifdef as the reference to it.
Fixes f24a70106dc1 ("lib: checksum: Fix build with CONFIG_NET=n")
I think that commit introduced unjustified #ifdef in a C file.
Refer
https://docs.kernel.org/process/coding-style.html#conditional-compilation
The fix should be:
lib/checksum_kunit.c +0 -1
@@ -594,7 +594,6 @@ static void test_ip_fast_csum(struct kunit *test)static void test_csum_ipv6_magic (struct kunit *test) { -#if defined(CONFIG_NET )const struct in6_addr *saddr;const struct in6_addr *daddr;unsigned int len;
@@ -608,6 +607,9 @@ static void test_csum_ipv6_magic(struct kunit *test) const int csum_offset = sizeof(struct in6_addr) + sizeof(struct
in6_addr) +
sizeof(int) + sizeof(char);
+ if (!IS_ENABLED(CONFIG_NET))
+ return;
+
for (int i = 0; i < NUM_IPv6_TESTS; i++) {
saddr = (const struct in6_addr *)(random_buf + i); daddr = (const struct in6_addr *)(random_buf + i +
@@ -618,7 +620,6 @@ static void test_csum_ipv6_magic(struct kunit *test)
CHECK_EQ(to_sum16(expected_csum_ipv6_magic[i]),
csum_ipv6_magic(saddr, daddr, len, proto, csum));
}
-#endif /* !CONFIG_NET */
}
static struct kunit_case __refdata checksum_test_cases[] = {Quoted 25 lines
Signed-off-by Arnd Bergmann <[email protected]>--- lib/checksum_kunit.c | 2 ++ 1 file changed, 2 insertions(+)lib/checksum_kunit.c +2
-0@@ -215,6 +215,7 @@ static const u32 init_sums_no_overflow[] = { 0xffff0000, 0xfffffffb, }; +#ifdef CONFIG_NET static const u16 expected_csum_ipv6_magic[] = {0x18d4 ,0x3085 ,0x2e4b ,0xd9f4 ,0xbdc8 ,0x78f ,0x1034 ,0x8422 ,0x6fc0 , 0xd2f6, 0xbeb5, 0x9d3, 0x7e2a, 0x312e, 0x778e, 0xc1bb, 0x7cf2, 0x9d1e,@@ -240,6 +241,7 @@ static const u16 expected_csum_ipv6_magic[] = {0x99aa ,0xb06b ,0xee19 ,0xcc2c ,0xf34c ,0x7c49 ,0xdac3 ,0xa71e ,0xc988 ,0x3845 ,0x1014 }; +#endif static const u16 expected_fast_csum[] = {0xda83 ,0x45da ,0x4f46 ,0x4e4f ,0x34e ,0xe902 ,0xa5e9 ,0x87a5 ,0x7187 ,
Arnd Bergmann
maintainerRe: [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[]
Quoted 26 lines · Christophe Leroy
Le 03/04/2024 à 10:06, Arnd Bergmann a écrit :
Quoted 10 lines
From: Arnd Bergmann <[email protected]>
When
CONFIG_NETis disabled, an extra warning shows up for this unused variable:
lib/checksum_kunit.c:218:18: error: 'expected_csum_ipv6_magic' defined but not used [-Werror=unused-const-variable=]Hide it under the same #ifdef as the reference to it.
Fixes f24a70106dc1 ("lib: checksum: Fix build with CONFIG_NET=n")I think that commit introduced unjustified #ifdef in a C file.
Refer
https://docs.kernel.org/process/coding-style.html#conditional-compilationThe fix should be:
(quoted diff) +3
-0+ if (!IS_ENABLED(CONFIG_NET)) + return; + for (int i = 0; i < NUM_IPv6_TESTS; i++) { saddr = (const struct in6_addr *)(random_buf + i); daddr = (const struct in6_addr *)(random_buf + i +
Review static void test_csum_ipv6_magic(struct kunit *test) · line 621
Quoted 4 lines
(quoted diff) +0
-1@@ -618,7 +620,6 @@ static void test_csum_ipv6_magic(struct kunit *test) CHECK_EQ(to_sum16(expected_csum_ipv6_magic[i]), csum_ipv6_magic(saddr, daddr, len, proto, csum)); } -#endif /* !CONFIG_NET */
Yes, I usually prefer that approach, and I think I tried it first but ran into compile-time problems because csum_ipv6_magic() is declared conditionally. Let me try again, maybe I misremember what I did or I can remove some more #ifdef checks for this.
Arnd
Re: [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[]
Le 03/04/2024 à 10:58, Arnd Bergmann a écrit :
Quoted 20 lines · Christophe Leroy
Quoted 19 lines
Le 03/04/2024 à 10:06, Arnd Bergmann a écrit :
Quoted 10 lines
From: Arnd Bergmann <[email protected]>
When
CONFIG_NETis disabled, an extra warning shows up for this unused variable:
lib/checksum_kunit.c:218:18: error: 'expected_csum_ipv6_magic' defined but not used [-Werror=unused-const-variable=]Hide it under the same #ifdef as the reference to it.
Fixes f24a70106dc1 ("lib: checksum: Fix build with CONFIG_NET=n")I think that commit introduced unjustified #ifdef in a C file.
Refer
https://docs.kernel.org/process/coding-style.html#conditional-compilationThe fix should be:
Quoted 16 lines
Review static void test_csum_ipv6_magic(struct kunit *test) · line 621
Quoted 11 lines
(quoted diff) +3
-1+ if (!IS_ENABLED(CONFIG_NET)) + return; + for (int i = 0; i < NUM_IPv6_TESTS; i++) { saddr = (const struct in6_addr *)(random_buf + i); daddr = (const struct in6_addr *)(random_buf + i +@@ -618,7 +620,6 @@ static void test_csum_ipv6_magic(struct kunit *test) CHECK_EQ(to_sum16(expected_csum_ipv6_magic[i]), csum_ipv6_magic(saddr, daddr, len, proto, csum)); } -#endif /* !CONFIG_NET */Yes, I usually prefer that approach, and I think I tried it first but ran into compile-time problems because
csum_ipv6_magic()is declared conditionally. Let me try again, maybe I misremember what I did or I can remove some more #ifdef checks for this.
FWIW, before replying I did a build check with pmac32_defconfig (powerpc) with CONFIG_NET removed. I was able to build lib/checksum_kunit.o and objdump shown there was no reference to csum_ipv6_magic() inside it.
Christophe
Arnd Bergmann
maintainerRe: [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[]
Quoted 8 lines · Christophe Leroy
Le 03/04/2024 à 10:58, Arnd Bergmann a écrit :
Quoted 5 lines · Christophe Leroy
Yes, I usually prefer that approach, and I think I tried it first but ran into compile-time problems because
csum_ipv6_magic()is declared conditionally. Let me try again, maybe I misremember what I did or I can remove some more #ifdef checks for this.
Quoted 4 lines
FWIW, before replying I did a build check with
pmac32_defconfig(powerpc) withCONFIG_NETremoved. I was able to buildlib/checksum_kunit.oand objdump shown there was no reference tocsum_ipv6_magic()inside it.
Right, got it now. I was confused a bit by CONFIG_NET vs CONFIG_IPV6 given that the common definition for csum_ipv6_magic() is in net/ipv6 but unlike other files there still gets build when IPV6 is disabled but NET remains turned on.
I've done a little more randconfig testing to verify it, sending v2 now.
Arnd
PATCH 19/34 sunrpc: suppress warnings for unused procfs functions
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
There is a warning about unused variables when building with W=1 and no procfs:
net/sunrpc/cache.c:1660:30: error: 'cache_flush_proc_ops' defined but not used [-Werror=unused-const-variable=]
1660 | static const struct proc_ops cache_flush_proc_ops = {
| ^~~~~~~~~~~~~~~~~~~~
net/sunrpc/cache.c:1622:30: error: 'content_proc_ops' defined but not used [-Werror=unused-const-variable=]
1622 | static const struct proc_ops content_proc_ops = {
| ^~~~~~~~~~~~~~~~
net/sunrpc/cache.c:1598:30: error: 'cache_channel_proc_ops' defined but not used [-Werror=unused-const-variable=]
1598 | static const struct proc_ops cache_channel_proc_ops = {
| ^~~~~~~~~~~~~~~~~~~~~~These are used inside of an #ifdef, so replacing that with an IS_ENABLED() check lets the compiler see how they are used while still dropping them during dead code elimination.
--- net/sunrpc/cache.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
net/sunrpc/cache.c +3 -7
@@ -1673,12 +1673,14 @@ static void remove_cache_proc_entries(struct cache_detail *cd) } } -#ifdef CONFIG_PROC_FS static int create_cache_proc_entries (struct cache_detail *cd,struct net *net) {struct proc_dir_entry *p;struct sunrpc_net *sn; +if (!IS_ENABLED (CONFIG_PROC_FS )) +return 0 ; + sn =net_generic (net, sunrpc_net_id); cd->procfs =proc_mkdir (cd->name, sn->proc_net_rpc);if (cd->procfs ==NULL )
@@ -1706,12 +1708,6 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)remove_cache_proc_entries (cd);return -ENOMEM ; } -#else /* CONFIG_PROC_FS */ -static int create_cache_proc_entries (struct cache_detail *cd,struct net *net) -{ -return 0 ; -} -#endif void __init cache_initialize (void ) {
Signature · 1 line
2.39.2
Re: [PATCH 19/34] sunrpc: suppress warnings for unused procfs functions
Quoted 47 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
There is a warning about unused variables when building with W=1 and no procfs:
net/sunrpc/cache.c:1660:30: error: 'cache_flush_proc_ops' defined but not used [-Werror=unused-const-variable=]1660 | static const struct proc_ops cache_flush_proc_ops = { | ^~~~~~~~~~~~~~~~~~~~ net/sunrpc/cache.c:1622:30: error: 'content_proc_ops' defined but not used [-Werror=unused-const-variable=] 1622 | static const struct proc_ops content_proc_ops = { | ^~~~~~~~~~~~~~~~ net/sunrpc/cache.c:1598:30: error: 'cache_channel_proc_ops' defined but not used [-Werror=unused-const-variable=] 1598 | static const struct proc_ops cache_channel_proc_ops = { | ^~~~~~~~~~~~~~~~~~~~~~These are used inside of an #ifdef, so replacing that with an
IS_ENABLED()check lets the compiler see how they are used while still dropping them during dead code elimination.Fixes dbf847ecb631 ("knfsd: allow cache_register to return error on failure")Signed-off-by Arnd Bergmann <[email protected]>--- net/sunrpc/cache.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)net/sunrpc/cache.c +3
-1@@ -1673,12 +1673,14 @@ static void remove_cache_proc_entries(struct cache_detail *cd) } } -#ifdef CONFIG_PROC_FS static int create_cache_proc_entries (struct cache_detail *cd,struct net *net) {struct proc_dir_entry *p;struct sunrpc_net *sn; +if (!IS_ENABLED (CONFIG_PROC_FS )) +return 0 ; + sn =net_generic (net, sunrpc_net_id); cd->procfs =proc_mkdir (cd->name, sn->proc_net_rpc);if (cd->procfs ==NULL )@@ -1706,12 +1708,6 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)remove_cache_proc_entries (cd);return -ENOMEM ;
net/sunrpc/cache.c static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) · line 1713
Quoted 10 lines
net/sunrpc/cache.c +0
-6} -#else /* CONFIG_PROC_FS */ -static int create_cache_proc_entries (struct cache_detail *cd,struct net *net) -{ -return 0 ; -} -#endif void __init cache_initialize (void ) {
Re: [PATCH 19/34] sunrpc: suppress warnings for unused procfs functions
In reply to Arnd BergmannQuoted 14 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
There is a warning about unused variables when building with W=1 and no procfs:
net/sunrpc/cache.c:1660:30: error: 'cache_flush_proc_ops' defined but not used [-Werror=unused-const-variable=]1660 | static const struct proc_ops cache_flush_proc_ops = { | ^~~~~~~~~~~~~~~~~~~~ net/sunrpc/cache.c:1622:30: error: 'content_proc_ops' defined but not used [-Werror=unused-const-variable=] 1622 | static const struct proc_ops content_proc_ops = { | ^~~~~~~~~~~~~~~~ net/sunrpc/cache.c:1598:30: error: 'cache_channel_proc_ops' defined but not used [-Werror=unused-const-variable=] 1598 | static const struct proc_ops cache_channel_proc_ops = { | ^~~~~~~~~~~~~~~~~~~~~~
Quoted 6 lines
These are used inside of an #ifdef, so replacing that with an
IS_ENABLED()check lets the compiler see how they are used while still dropping them during dead code elimination.Fixes dbf847ecb631 ("knfsd: allow cache_register to return error on failure")Signed-off-by Arnd Bergmann <[email protected]>
Quoted 40 lines
--- net/sunrpc/cache.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)net/sunrpc/cache.c +3
-7@@ -1673,12 +1673,14 @@ static void remove_cache_proc_entries(struct cache_detail *cd) } } -#ifdef CONFIG_PROC_FS static int create_cache_proc_entries (struct cache_detail *cd,struct net *net) {struct proc_dir_entry *p;struct sunrpc_net *sn; +if (!IS_ENABLED (CONFIG_PROC_FS )) +return 0 ; + sn =net_generic (net, sunrpc_net_id); cd->procfs =proc_mkdir (cd->name, sn->proc_net_rpc);if (cd->procfs ==NULL )@@ -1706,12 +1708,6 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)remove_cache_proc_entries (cd);return -ENOMEM ; } -#else /* CONFIG_PROC_FS */ -static int create_cache_proc_entries (struct cache_detail *cd,struct net *net) -{ -return 0 ; -} -#endif void __init cache_initialize (void ) {Signature · 1 line
2.39.2
Signature · 1 line
Chuck Lever
PATCH 20/34 comedi: ni_atmio: avoid warning for unused device_ids[] table
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When the driver is built-in, it produces a W=1 warning:
drivers/comedi/drivers/ni_atmio.c:209:35: error: 'device_ids' defined but not used [-Werror=unused-const-variable=]
209 | static const struct pnp_device_id device_ids[] = {
The actual probe() function has a different way of identifying the hardware, so just mark this one as __maybe_unused so it can be dropped when built-in.
--- drivers/comedi/drivers/ni_atmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/comedi/drivers/ni_atmio.c +1 -1
@@ -206,7 +206,7 @@ static const int ni_irqpin[] = {#include "ni_mio_common.c" -static const struct pnp_device_id device_ids[] = { +static const struct pnp_device_id __maybe_unused device_ids[] = { {.id ="NIC1900" , .driver_data =0 }, {.id ="NIC2400" , .driver_data =0 }, {.id ="NIC2500" , .driver_data =0 },
Signature · 1 line
2.39.2
PATCH 21/34 iwlegacy: don't warn for unused variables with DEBUG_FS=n
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The reference to il_rate_mcs is inside of an #ifdef, causing a W=1 warning:
drivers/net/wireless/intel/iwlegacy/4965-rs.c:189:38: error: unused variable 'il_rate_mcs' [-Werror,-Wunused-const-variable] static const struct il_rate_mcs_info il_rate_mcs[RATE_COUNT] = {
Replace the #ifdef with a PTR_IF() for better compile time analysis. The dead code will still get eliminated, but the warning goes away.
--- drivers/net/wireless/intel/iwlegacy/4965-rs.c | 15 ++------------- drivers/net/wireless/intel/iwlegacy/common.h | 2 -- 2 files changed, 2 insertions(+), 15 deletions(-)
drivers/net/wireless/intel/iwlegacy/4965-rs.c +2 -13
@@ -132,15 +132,8 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,static void il4965_rs_stay_in_table (struct il_lq_sta *lq_sta,bool force_search); -#ifdef CONFIG_MAC80211_DEBUGFS static void il4965_rs_dbgfs_set_mcs (struct il_lq_sta *lq_sta,u32 *rate_n_flags,int idx); -#else -static void -il4965_rs_dbgfs_set_mcs (struct il_lq_sta *lq_sta,u32 * rate_n_flags,int idx) -{ -} -#endif /* * The following tables contain the expected throughput metrics for all rates
@@ -2495,8 +2488,6 @@ il4965_rs_free_sta(void *il_r, struct ieee80211_sta *sta, void *il_sta)D_RATE ("leave\n" ); } -#ifdef CONFIG_MAC80211_DEBUGFS -static void il4965_rs_dbgfs_set_mcs (struct il_lq_sta *lq_sta,u32 * rate_n_flags,int idx) {
@@ -2758,7 +2749,6 @@ il4965_rs_add_debugfs(void *il, void *il_sta, struct dentry *dir)debugfs_create_u8 ("tx_agg_tid_enable" ,0600 , dir, &lq_sta->tx_agg_tid_en); } -#endif /* * Initialization of rate scaling information is done by driver after
@@ -2781,9 +2771,8 @@ static const struct rate_control_ops rs_4965_ops = { .free = il4965_rs_free, .alloc_sta = il4965_rs_alloc_sta, .free_sta = il4965_rs_free_sta, -#ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = il4965_rs_add_debugfs, -#endif + .add_sta_debugfs = PTR_IF(IS_ENABLED(CONFIG_DEBUG_FS), + il4965_rs_add_debugfs), };int
drivers/net/wireless/intel/iwlegacy/common.h +0 -2
@@ -2804,9 +2804,7 @@ struct il_lq_sta {struct il_scale_tbl_info lq_info[LQ_SIZE ];/* "active", "search" */ struct il_traffic_load load[TID_MAX_LOAD_COUNT ];u8 tx_agg_tid_en; -#ifdef CONFIG_MAC80211_DEBUGFS u32 dbg_fixed_rate; -#endif struct il_priv *drv;/* used to be in sta_info */
Signature · 1 line
2.39.2
Re: [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n
Quoted 9 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The reference to
il_rate_mcsis inside of an #ifdef, causing a W=1 warning:
drivers/net/wireless/intel/iwlegacy/4965-rs.c:189:38: error: unused variable 'il_rate_mcs' [-Werror,-Wunused-const-variable] static const structil_rate_mcs_infoil_rate_mcs[RATE_COUNT] = {Replace the #ifdef with a
PTR_IF()for better compile time analysis. The dead code will still get eliminated, but the warning goes away.
...
drivers/net/wireless/intel/iwlegacy/4965-rs.c static const struct rate_control_ops rs_4965_ops = { · line 2775
Quoted 2 lines
drivers/net/wireless/intel/iwlegacy/4965-rs.c +2
-0+ .add_sta_debugfs = PTR_IF(IS_ENABLED(CONFIG_DEBUG_FS), + il4965_rs_add_debugfs),
I believe it's not the first and not the last driver that wants this kind of thing. Maybe
- split out PTR_IF() from kernel.h
- add debugfs_ptr()
- use it?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n
In reply to Arnd BergmannQuoted 37 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The reference to
il_rate_mcsis inside of an #ifdef, causing a W=1 warning:
drivers/net/wireless/intel/iwlegacy/4965-rs.c:189:38: error: unused variable 'il_rate_mcs' [-Werror,-Wunused-const-variable] static const structil_rate_mcs_infoil_rate_mcs[RATE_COUNT] = {Replace the #ifdef with a
PTR_IF()for better compile time analysis. The dead code will still get eliminated, but the warning goes away.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/net/wireless/intel/iwlegacy/4965-rs.c | 15 ++------------- drivers/net/wireless/intel/iwlegacy/common.h | 2 -- 2 files changed, 2 insertions(+), 15 deletions(-)drivers/net/wireless/intel/iwlegacy/4965-rs.c +0
-7@@ -132,15 +132,8 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,static void il4965_rs_stay_in_table (struct il_lq_sta *lq_sta,bool force_search); -#ifdef CONFIG_MAC80211_DEBUGFS static void il4965_rs_dbgfs_set_mcs (struct il_lq_sta *lq_sta,u32 *rate_n_flags,int idx); -#else -static void -il4965_rs_dbgfs_set_mcs (struct il_lq_sta *lq_sta,u32 * rate_n_flags,int idx) -{ -} -#endif /* * The following tables contain the expected throughput metrics for all rates
drivers/net/wireless/intel/iwlegacy/4965-rs.c il4965_rs_free_sta(void *il_r, struct ieee80211_sta *sta, void *il_sta) · line 2499
Quoted 5 lines
drivers/net/wireless/intel/iwlegacy/4965-rs.c +0
-2@@ -2495,8 +2488,6 @@ il4965_rs_free_sta(void *il_r, struct ieee80211_sta *sta, void *il_sta)D_RATE ("leave\n" ); } -#ifdef CONFIG_MAC80211_DEBUGFS -
if the const table is only used by this function, why not do the trivial thing and relocate it to be inside this #ifdef, or even to be within the function itself?
Quoted 12 lines
drivers/net/wireless/intel/iwlegacy/4965-rs.c +0
-1static void il4965_rs_dbgfs_set_mcs (struct il_lq_sta *lq_sta,u32 * rate_n_flags,int idx) {@@ -2758,7 +2749,6 @@ il4965_rs_add_debugfs(void *il, void *il_sta, struct dentry *dir)debugfs_create_u8 ("tx_agg_tid_enable" ,0600 , dir, &lq_sta->tx_agg_tid_en); } -#endif /* * Initialization of rate scaling information is done by driver after
drivers/net/wireless/intel/iwlegacy/4965-rs.c static const struct rate_control_ops rs_4965_ops = { · line 2774
Quoted 7 lines
drivers/net/wireless/intel/iwlegacy/4965-rs.c +1
-3@@ -2781,9 +2771,8 @@ static const struct rate_control_ops rs_4965_ops = { .free = il4965_rs_free, .alloc_sta = il4965_rs_alloc_sta, .free_sta = il4965_rs_free_sta, -#ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = il4965_rs_add_debugfs, -#endif + .add_sta_debugfs = PTR_IF(IS_ENABLED(CONFIG_DEBUG_FS),
CONFIG_DEBUG_FS != CONFIG_MAC80211_DEBUGFS, is that intentional?
drivers/net/wireless/intel/iwlegacy/4965-rs.c static const struct rate_control_ops rs_4965_ops = { · line 2775
Quoted 1 line
drivers/net/wireless/intel/iwlegacy/4965-rs.c +1
-0+ il4965_rs_add_debugfs),
so using this you don't get a warning about all those static functions and tables being unused when the feature is disabled? that's pretty cool. is that because the compiler sees them instead of the preprocessor stripping them out?
Quoted 8 lines
drivers/net/wireless/intel/iwlegacy/4965-rs.c +0
-0};int drivers/net/wireless/intel/iwlegacy/common.h +0
-0
drivers/net/wireless/intel/iwlegacy/common.h struct il_lq_sta { · line 2809
Quoted 6 lines
drivers/net/wireless/intel/iwlegacy/common.h +0
-2@@ -2804,9 +2804,7 @@ struct il_lq_sta {struct il_scale_tbl_info lq_info[LQ_SIZE ];/* "active", "search" */ struct il_traffic_load load[TID_MAX_LOAD_COUNT ];u8 tx_agg_tid_en; -#ifdef CONFIG_MAC80211_DEBUGFS u32 dbg_fixed_rate; -#endif
and yes it is trivial, but we now waste this memory when the feature is not enabled
Quoted 3 lines
drivers/net/wireless/intel/iwlegacy/common.h +0
-0struct il_priv *drv;/* used to be in sta_info */
PATCH 22/34 drm/komeda: don't warn for unused debugfs files
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
With debugfs disabled, the komeda_register debugfs file is unused:
drivers/gpu/drm/arm/display/komeda/komeda_dev.c:44:1: error: unused variable 'komeda_register_fops' [-Werror,-Wunused-const-variable] DEFINE_SHOW_ATTRIBUTE(komeda_register);
The komeda_debugfs_init() function already has a call to debugfs_initialized() that ends up eliminating the file as dead code, so just drop the #ifdef to get rid of the warning.
--- drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -8
@@ -12,10 +12,8 @@#include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/dma-mapping.h> -#ifdef CONFIG_DEBUG_FS #include <linux/debugfs.h> #include <linux/seq_file.h> -#endif #include <drm/drm_print.h>
@@ -43,7 +41,6 @@ static int komeda_register_show(struct seq_file *sf, void *x)DEFINE_SHOW_ATTRIBUTE (komeda_register); -#ifdef CONFIG_DEBUG_FS static void komeda_debugfs_init (struct komeda_dev *mdev) {if (!debugfs_initialized ())
@@ -55,7 +52,6 @@ static void komeda_debugfs_init(struct komeda_dev *mdev)debugfs_create_x16 ("err_verbosity" ,0664 , mdev->debugfs_root, &mdev->err_verbosity); } -#endif static ssize_t core_id_show (struct device *dev,struct device_attribute *attr,char *buf)
@@ -265,9 +261,7 @@ struct komeda_dev *komeda_dev_create(struct device *dev) mdev->err_verbosity =KOMEDA_DEV_PRINT_ERR_EVENTS ; -#ifdef CONFIG_DEBUG_FS komeda_debugfs_init (mdev); -#endif return mdev;
@@ -286,9 +280,7 @@ void komeda_dev_destroy(struct komeda_dev *mdev)sysfs_remove_group (&dev->kobj, &komeda_sysfs_attr_group); -#ifdef CONFIG_DEBUG_FS debugfs_remove_recursive (mdev->debugfs_root); -#endif if (mdev->aclk)clk_prepare_enable (mdev->aclk);
Signature · 1 line
2.39.2
PATCH 23/34 firmware: qcom_scm: mark qcom_scm_qseecom_allowlist as __maybe_unused
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When CONFIG_OF is disabled, there is no reference to this variable:
drivers/firmware/qcom/qcom_scm.c:1655:34: error: unused variable 'qcom_scm_qseecom_allowlist' [-Werror,-Wunused-const-variable] static const struct of_device_id qcom_scm_qseecom_allowlist[] = {
Mark it as __maybe_unused to hide this warning.
--- drivers/firmware/qcom/qcom_scm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/qcom/qcom_scm.c +1 -1
@@ -1652,7 +1652,7 @@ EXPORT_SYMBOL_GPL(qcom_scm_qseecom_app_send);* We do not yet support re-entrant calls via the qseecom interface. To prevent + any potential issues with this, only allow validated machines for now. */ -static const struct of_device_id qcom_scm_qseecom_allowlist[] = { +static const struct of_device_id qcom_scm_qseecom_allowlist[]__maybe_unused = { { .compatible ="lenovo,thinkpad-x13s" , }, { } };
Signature · 1 line
2.39.2
Re: [PATCH 23/34] firmware: qcom_scm: mark qcom_scm_qseecom_allowlist as __maybe_unused
Quoted 4 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When
CONFIG_OFis disabled, there is no reference to this variable:
Quoted 8 lines
drivers/firmware/qcom/qcom_scm.c:1655:34: error: unused variable 'qcom_scm_qseecom_allowlist' [-Werror,-Wunused-const-variable] static const structof_device_idqcom_scm_qseecom_allowlist[] = {Mark it as
__maybe_unusedto hide this warning.Fixes 00b1248606ba ("firmware: qcom_scm: Add support for Qualcomm Secure Execution Environment SCM interface")Signed-off-by Arnd Bergmann <[email protected]>---
I already fixed this and have an Ack:
https://lore.kernel.org/all/[email protected]/
Can anyone pick up that one? Why these trivial and obvious fixes take so much effort...
Just like Arnd, I keep fixing many little things which takes considerable amount of time. This is not a problem. You know what is the problem? Chasing maintainers, keeping track of my own patches, resending and pinging. All this takes considerable amount of time which is a *wasted* time which I could spend on developing new code. Then finding out that Arnd spent his time to fix this again!
Same simple issue being fixed by two people. Considering effort spent on tracking/resending patches (or even writing this stupid rant), simple patch which should take 1h of developers time takes 3 or four times more!
Best regards,
Krzysztof
PATCH 24/34 crypto: ccp - drop platform ifdef checks
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When both ACPI and OF are disabled, the dev_vdata variable is unused:
drivers/crypto/ccp/sp-platform.c:33:34: error: unused variable 'dev_vdata' [-Werror,-Wunused-const-variable]
This is not a useful configuration, and there is not much point in saving a few bytes when only one of the two is enabled, so just remove all these ifdef checks and rely on of_match_node() and acpi_match_device() returning NULL when these subsystems are disabled.
--- drivers/crypto/ccp/sp-platform.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/crypto/ccp/sp-platform.c +2 -12
@@ -39,44 +39,38 @@ static const struct sp_dev_vdata dev_vdata[] = { }, }; -#ifdef CONFIG_ACPI static const struct acpi_device_id sp_acpi_match[] = { {"AMDI0C00" , (kernel_ulong_t)&dev_vdata[0 ] }, { }, };MODULE_DEVICE_TABLE (acpi, sp_acpi_match); -#endif -#ifdef CONFIG_OF static const struct of_device_id sp_of_match[] = { { .compatible ="amd,ccp-seattle-v1a" , .data = (const void *)&dev_vdata[0 ] }, { }, };MODULE_DEVICE_TABLE (of, sp_of_match); -#endif static struct sp_dev_vdata *sp_get_of_version (struct platform_device *pdev) { -#ifdef CONFIG_OF const struct of_device_id *match; match =of_match_node (sp_of_match, pdev->dev.of_node);if (match && match->data)return (struct sp_dev_vdata *)match->data; -#endif +return NULL ; }static struct sp_dev_vdata *sp_get_acpi_version (struct platform_device *pdev) { -#ifdef CONFIG_ACPI const struct acpi_device_id *match; match =acpi_match_device (sp_acpi_match, &pdev->dev);if (match && match->driver_data)return (struct sp_dev_vdata *)match->driver_data; -#endif +return NULL ; }
@@ -212,12 +206,8 @@ static int sp_platform_resume(struct platform_device *pdev)static struct platform_driver sp_platform_driver = { .driver = { .name ="ccp" , -#ifdef CONFIG_ACPI .acpi_match_table = sp_acpi_match, -#endif -#ifdef CONFIG_OF .of_match_table = sp_of_match, -#endif }, .probe = sp_platform_probe, .remove_new = sp_platform_remove,
Signature · 1 line
2.39.2
Re: [PATCH 24/34] crypto: ccp - drop platform ifdef checks
Quoted 6 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When both ACPI and OF are disabled, the
dev_vdatavariable is unused:
drivers/crypto/ccp/sp-platform.c:33:34: error: unused variable 'dev_vdata' [-Werror,-Wunused-const-variable]
Quoted 7 lines
This is not a useful configuration, and there is not much point in saving a few bytes when only one of the two is enabled, so just remove all these ifdef checks and rely on
of_match_node()andacpi_match_device()returning NULL when these subsystems are disabled.Fixes 6c5063434098 ("crypto: ccp - Add ACPI support")Signed-off-by Arnd Bergmann <[email protected]>
Would using __maybe_unused on dev_vdata be the safer, easier choice?
Either way, I don't think removing the #ifdefs will pose a problem, so:
Quoted 68 lines
--- drivers/crypto/ccp/sp-platform.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)drivers/crypto/ccp/sp-platform.c +2
-12@@ -39,44 +39,38 @@ static const struct sp_dev_vdata dev_vdata[] = { }, }; -#ifdef CONFIG_ACPI static const struct acpi_device_id sp_acpi_match[] = { {"AMDI0C00" , (kernel_ulong_t)&dev_vdata[0 ] }, { }, };MODULE_DEVICE_TABLE (acpi, sp_acpi_match); -#endif -#ifdef CONFIG_OF static const struct of_device_id sp_of_match[] = { { .compatible ="amd,ccp-seattle-v1a" , .data = (const void *)&dev_vdata[0 ] }, { }, };MODULE_DEVICE_TABLE (of, sp_of_match); -#endif static struct sp_dev_vdata *sp_get_of_version (struct platform_device *pdev) { -#ifdef CONFIG_OF const struct of_device_id *match; match =of_match_node (sp_of_match, pdev->dev.of_node);if (match && match->data)return (struct sp_dev_vdata *)match->data; -#endif +return NULL ; }static struct sp_dev_vdata *sp_get_acpi_version (struct platform_device *pdev) { -#ifdef CONFIG_ACPI const struct acpi_device_id *match; match =acpi_match_device (sp_acpi_match, &pdev->dev);if (match && match->driver_data)return (struct sp_dev_vdata *)match->driver_data; -#endif +return NULL ; }@@ -212,12 +206,8 @@ static int sp_platform_resume(struct platform_device *pdev)static struct platform_driver sp_platform_driver = { .driver = { .name ="ccp" , -#ifdef CONFIG_ACPI .acpi_match_table = sp_acpi_match, -#endif -#ifdef CONFIG_OF .of_match_table = sp_of_match, -#endif }, .probe = sp_platform_probe, .remove_new = sp_platform_remove,
Arnd Bergmann
maintainerRe: [PATCH 24/34] crypto: ccp - drop platform ifdef checks
Quoted 12 lines · Tom Lendacky
Quoted 11 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When both ACPI and OF are disabled, the
dev_vdatavariable is unused:
drivers/crypto/ccp/sp-platform.c:33:34: error: unused variable 'dev_vdata' [-Werror,-Wunused-const-variable]This is not a useful configuration, and there is not much point in saving a few bytes when only one of the two is enabled, so just remove all these ifdef checks and rely on
of_match_node()andacpi_match_device()returning NULL when these subsystems are disabled.
Quoted 4 lines
Quoted 2 lines
Fixes 6c5063434098 ("crypto: ccp - Add ACPI support")Signed-off-by Arnd Bergmann <[email protected]>Would using
__maybe_unusedondev_vdatabe the safer, easier choice?
It's a simpler change, but leaves the extra complexity that is not needed here.
Arnd
Herbert Xu
maintainerRe: [PATCH 24/34] crypto: ccp - drop platform ifdef checks
In reply to Arnd BergmannQuoted 11 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When both ACPI and OF are disabled, the
dev_vdatavariable is unused:
drivers/crypto/ccp/sp-platform.c:33:34: error: unused variable 'dev_vdata' [-Werror,-Wunused-const-variable]This is not a useful configuration, and there is not much point in saving a few bytes when only one of the two is enabled, so just remove all these ifdef checks and rely on
of_match_node()andacpi_match_device()returning NULL when these subsystems are disabled.
Quoted 5 lines
Fixes 6c5063434098 ("crypto: ccp - Add ACPI support")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/crypto/ccp/sp-platform.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
PATCH 25/34 usb: gadget: omap_udc: remove unused variable
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The driver_desc variable is only used in some configurations:
drivers/usb/gadget/udc/omap_udc.c:113:19: error: unused variable 'driver_desc' [-Werror,-Wunused-const-variable]
Since there is only ever one user of it, just open-code the string in place and remove the global variable and the macro behind it. This also helps grep for the MODULE_DESCRIPTION string.
--- drivers/usb/gadget/udc/omap_udc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/usb/gadget/udc/omap_udc.c +3 -7
@@ -56,7 +56,6 @@/* ISO too */ #define USE_ISO -#define DRIVER_DESC "OMAP UDC driver"#define DRIVER_VERSION "4 October 2004"#define OMAP_DMA_USB_W2FC_TX0 29
@@ -110,7 +109,6 @@ MODULE_PARM_DESC(use_dma, "enable/disable DMA");static const char driver_name[] ="omap_udc" ; -static const char driver_desc[] =DRIVER_DESC ;/*-------------------------------------------------------------------------*/
@@ -2299,13 +2297,11 @@ static int proc_udc_show(struct seq_file *s, void *_)spin_lock_irqsave (&udc->lock, flags); - seq_printf(s, "%s, version: " DRIVER_VERSION + seq_printf(s, "OMAP UDC driver, version: " DRIVER_VERSION #ifdef USE_ISO " (iso)" #endif -"%s\n" , - driver_desc, - use_dma ?" (dma)" :"" ); +"%s\n" , use_dma ?" (dma)" :"" ); tmp =omap_readw (UDC_REV ) &0xff ; seq_printf(s,
@@ -2994,6 +2990,6 @@ static struct platform_driver udc_driver = {module_platform_driver (udc_driver); -MODULE_DESCRIPTION (DRIVER_DESC ); +MODULE_DESCRIPTION ("OMAP UDC driver" );MODULE_LICENSE ("GPL" );MODULE_ALIAS ("platform:omap_udc" );
Signature · 1 line
2.39.2
Re: [PATCH 25/34] usb: gadget: omap_udc: remove unused variable
Hi,
Quoted 11 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The
driver_descvariable is only used in some configurations:
drivers/usb/gadget/udc/omap_udc.c:113:19: error: unused variable 'driver_desc' [-Werror,-Wunused-const-variable]Since there is only ever one user of it, just open-code the string in place and remove the global variable and the macro behind it. This also helps grep for the
MODULE_DESCRIPTIONstring.Signed-off-by Arnd Bergmann <[email protected]>
A.
Quoted 51 lines
--- drivers/usb/gadget/udc/omap_udc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/usb/gadget/udc/omap_udc.c +3
-7@@ -56,7 +56,6 @@/* ISO too */ #define USE_ISO -#define DRIVER_DESC "OMAP UDC driver"#define DRIVER_VERSION "4 October 2004"#define OMAP_DMA_USB_W2FC_TX0 29@@ -110,7 +109,6 @@ MODULE_PARM_DESC(use_dma, "enable/disable DMA");static const char driver_name[] ="omap_udc" ; -static const char driver_desc[] =DRIVER_DESC ;/*-------------------------------------------------------------------------*/ @@ -2299,13 +2297,11 @@ static int proc_udc_show(struct seq_file *s, void *_)spin_lock_irqsave (&udc->lock, flags); - seq_printf(s, "%s, version: " DRIVER_VERSION + seq_printf(s, "OMAP UDC driver, version: " DRIVER_VERSION #ifdef USE_ISO " (iso)" #endif -"%s\n" , - driver_desc, - use_dma ?" (dma)" :"" ); +"%s\n" , use_dma ?" (dma)" :"" ); tmp =omap_readw (UDC_REV ) &0xff ; seq_printf(s,@@ -2994,6 +2990,6 @@ static struct platform_driver udc_driver = {module_platform_driver (udc_driver); -MODULE_DESCRIPTION (DRIVER_DESC ); +MODULE_DESCRIPTION ("OMAP UDC driver" );MODULE_LICENSE ("GPL" );MODULE_ALIAS ("platform:omap_udc" );Signature · 1 line
2.39.2
PATCH 26/34 isdn: kcapi: don't build unused procfs code
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The procfs file is completely unused without CONFIG_PROC_FS but causes a compile time warning:
drivers/isdn/capi/kcapi_proc.c:97:36: error: unused variable 'seq_controller_ops' [-Werror,-Wunused-const-variable] static const struct seq_operations seq_controller_ops = {drivers/isdn/capi/kcapi_proc.c:104:36: error: unused variable 'seq_contrstats_ops' [-Werror,-Wunused-const-variable] drivers/isdn/capi/kcapi_proc.c:179:36: error: unused variable 'seq_applications_ops' [-Werror,-Wunused-const-variable] drivers/isdn/capi/kcapi_proc.c:186:36: error: unused variable 'seq_applstats_ops' [-Werror,-Wunused-const-variable]
Remove the file from the build in that config and make the calls into it conditional instead.
--- drivers/isdn/capi/Makefile | 3 ++- drivers/isdn/capi/kcapi.c | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/isdn/capi/Makefile +2 -1
@@ -2,4 +2,5 @@ # Makefile for the CAPI subsystem used by BT_CMTP obj-$(CONFIG_BT_CMTP) += kernelcapi.o -kernelcapi-y := kcapi.o capiutil.o capi.o kcapi_proc.o +kernelcapi-y := kcapi.o capiutil.o capi.o +kernelcapi-$(CONFIG_PROC_FS) += kcapi_proc.o
drivers/isdn/capi/kcapi.c +5 -2
@@ -917,13 +917,16 @@ int __init kcapi_init(void)return err; } -kcapi_proc_init (); +if (IS_ENABLED (CONFIG_PROC_FS )) +kcapi_proc_init (); +return 0 ; }void kcapi_exit (void ) { -kcapi_proc_exit (); +if (IS_ENABLED (CONFIG_PROC_FS )) +kcapi_proc_exit ();cdebug_exit ();destroy_workqueue (kcapi_wq);
Signature · 1 line
2.39.2
PATCH 27/34 cpufreq: intel_pstate: hide unused intel_pstate_cpu_oob_ids[]
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The reference to this variable is hidden in an #ifdef:
drivers/cpufreq/intel_pstate.c:2440:32: error: 'intel_pstate_cpu_oob_ids' defined but not used [-Werror=unused-const-variable=]
Use the same check around the definition.
--- drivers/cpufreq/intel_pstate.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpufreq/intel_pstate.c +2 -0
@@ -2437,6 +2437,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { };MODULE_DEVICE_TABLE (x86cpu, intel_pstate_cpu_ids); +#ifdef CONFIG_ACPI static const struct x86_cpu_id intel_pstate_cpu_oob_ids[]__initconst = {X86_MATCH (BROADWELL_D , core_funcs), X86_MATCH(BROADWELL_X, core_funcs),
@@ -2445,6 +2446,7 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = { X86_MATCH(SAPPHIRERAPIDS_X, core_funcs), {} }; +#endif static const struct x86_cpu_id intel_pstate_cpu_ee_disable_ids[] = {X86_MATCH (KABYLAKE , core_funcs),
Signature · 1 line
2.39.2
Re: [PATCH 27/34] cpufreq: intel_pstate: hide unused intel_pstate_cpu_oob_ids[]
Quoted 27 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The reference to this variable is hidden in an #ifdef:
drivers/cpufreq/intel_pstate.c:2440:32: error: 'intel_pstate_cpu_oob_ids' defined but not used [-Werror=unused-const-variable=]Use the same check around the definition.
Signed-off-by Arnd Bergmann <[email protected]>--- drivers/cpufreq/intel_pstate.c | 2 ++ 1 file changed, 2 insertions(+)drivers/cpufreq/intel_pstate.c +1
-0@@ -2437,6 +2437,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { };MODULE_DEVICE_TABLE (x86cpu, intel_pstate_cpu_ids); +#ifdef CONFIG_ACPI static const struct x86_cpu_id intel_pstate_cpu_oob_ids[]__initconst = {X86_MATCH (BROADWELL_D , core_funcs), X86_MATCH(BROADWELL_X, core_funcs),
drivers/cpufreq/intel_pstate.c static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = {
Quoted 8 lines
drivers/cpufreq/intel_pstate.c +1
-1@@ -2445,6 +2446,7 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = { X86_MATCH(SAPPHIRERAPIDS_X, core_funcs), {} }; +#endif static const struct x86_cpu_id intel_pstate_cpu_ee_disable_ids[] = {X86_MATCH (KABYLAKE , core_funcs), --
Applied as 6.10 material, thanks!
PATCH 28/34 net: xgbe: remove extraneous #ifdef checks
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When both ACPI and OF are disabled, xgbe_v1 is unused and causes a W=1 warning:
drivers/net/ethernet/amd/xgbe/xgbe-platform.c:533:39: error: unused variable 'xgbe_v1' [-Werror,-Wunused-const-variable] static const struct xgbe_version_data xgbe_v1 = {
There is no real point in trying to save a few bytes for the match tables, so just make them always visible.
--- drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-platform.c +0 -8
@@ -538,7 +538,6 @@ static const struct xgbe_version_data xgbe_v1 = { .tx_tstamp_workaround = 1, }; -#ifdef CONFIG_ACPI static const struct acpi_device_id xgbe_acpi_match[] = { { .id ="AMDI8001" , .driver_data = (kernel_ulong_t)&xgbe_v1 },
@@ -546,9 +545,7 @@ static const struct acpi_device_id xgbe_acpi_match[] = { };MODULE_DEVICE_TABLE (acpi, xgbe_acpi_match); -#endif -#ifdef CONFIG_OF static const struct of_device_id xgbe_of_match[] = { { .compatible ="amd,xgbe-seattle-v1a" , .data = &xgbe_v1 },
@@ -556,7 +553,6 @@ static const struct of_device_id xgbe_of_match[] = { };MODULE_DEVICE_TABLE (of, xgbe_of_match); -#endif static SIMPLE_DEV_PM_OPS(xgbe_platform_pm_ops, xgbe_platform_suspend, xgbe_platform_resume);
@@ -564,12 +560,8 @@ static SIMPLE_DEV_PM_OPS(xgbe_platform_pm_ops,static struct platform_driver xgbe_driver = { .driver = { .name =XGBE_DRV_NAME , -#ifdef CONFIG_ACPI .acpi_match_table = xgbe_acpi_match, -#endif -#ifdef CONFIG_OF .of_match_table = xgbe_of_match, -#endif .pm = &xgbe_platform_pm_ops, }, .probe = xgbe_platform_probe,
Signature · 1 line
2.39.2
PATCH 29/34 Input: imagis - remove incorrect ifdef checks
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When CONFIG_OF is disabled, three variables become unused:
drivers/input/touchscreen/imagis.c:391:39: error: unused variable 'imagis_3032c_data' [-Werror,-Wunused-const-variable] drivers/input/touchscreen/imagis.c:399:39: error: unused variable 'imagis_3038b_data' [-Werror,-Wunused-const-variable] drivers/input/touchscreen/imagis.c:407:39: error: unused variable 'imagis_3038c_data' [-Werror,-Wunused-const-variable]
There is no real point in building this driver without CONFIG_OF, so just remove the #ifdef checks and just always build this to avoids the warnings.
--- drivers/input/touchscreen/imagis.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/input/touchscreen/imagis.c +1 -3
@@ -411,7 +411,6 @@ static const struct imagis_properties imagis_3038c_data = { .whoami_val = IST3038C_WHOAMI, }; -#ifdef CONFIG_OF static const struct of_device_id imagis_of_match[] = { { .compatible ="imagis,ist3032c" , .data = &imagis_3032c_data }, { .compatible ="imagis,ist3038b" , .data = &imagis_3038b_data },
@@ -419,13 +418,12 @@ static const struct of_device_id imagis_of_match[] = { { }, };MODULE_DEVICE_TABLE (of, imagis_of_match); -#endif static struct i2c_driver imagis_ts_driver = { .driver = { .name ="imagis-touchscreen" , .pm =pm_sleep_ptr (&imagis_pm_ops), - .of_match_table =of_match_ptr (imagis_of_match), + .of_match_table = imagis_of_match, }, .probe = imagis_probe, };
Signature · 1 line
2.39.2
PATCH 30/34 sata: mv: drop unnecessary #ifdef checks
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Building with W=1 shows a warning for an unused variable when CONFIG_PCI is diabled:
drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable] static const struct pci_device_id mv_pci_tbl[] = {
Move the table into the same block that containsn the pci_driver definition.
--- drivers/ata/sata_mv.c | 64 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 32 deletions(-)
drivers/ata/sata_mv.c +32 -32
@@ -787,37 +787,6 @@ static const struct ata_port_info mv_port_info[] = { }, }; -static const struct pci_device_id mv_pci_tbl[] = { - {PCI_VDEVICE (MARVELL ,0x5040 ), chip_504x }, - {PCI_VDEVICE (MARVELL ,0x5041 ), chip_504x }, - {PCI_VDEVICE (MARVELL ,0x5080 ), chip_5080 }, - {PCI_VDEVICE (MARVELL ,0x5081 ), chip_508x }, -/* RocketRAID 1720/174x have different identifiers */ - {PCI_VDEVICE (TTI ,0x1720 ), chip_6042 }, - {PCI_VDEVICE (TTI ,0x1740 ), chip_6042 }, - {PCI_VDEVICE (TTI ,0x1742 ), chip_6042 }, - - {PCI_VDEVICE (MARVELL ,0x6040 ), chip_604x }, - {PCI_VDEVICE (MARVELL ,0x6041 ), chip_604x }, - {PCI_VDEVICE (MARVELL ,0x6042 ), chip_6042 }, - {PCI_VDEVICE (MARVELL ,0x6080 ), chip_608x }, - {PCI_VDEVICE (MARVELL ,0x6081 ), chip_608x }, - - {PCI_VDEVICE (ADAPTEC2 ,0x0241 ), chip_604x }, - -/* Adaptec 1430SA */ - {PCI_VDEVICE (ADAPTEC2 ,0x0243 ), chip_7042 }, - -/* Marvell 7042 support */ - {PCI_VDEVICE (MARVELL ,0x7042 ), chip_7042 }, - -/* Highpoint RocketRAID PCIe series */ - {PCI_VDEVICE (TTI ,0x2300 ), chip_7042 }, - {PCI_VDEVICE (TTI ,0x2310 ), chip_7042 }, - - { }/* terminate list */ -}; -static const struct mv_hw_ops mv5xxx_ops = { .phy_errata = mv5_phy_errata, .enable_leds = mv5_enable_leds,
@@ -4303,6 +4272,37 @@ static int mv_pci_init_one(struct pci_dev *pdev,static int mv_pci_device_resume (struct pci_dev *pdev);#endif +static const struct pci_device_id mv_pci_tbl[] = { + {PCI_VDEVICE (MARVELL ,0x5040 ), chip_504x }, + {PCI_VDEVICE (MARVELL ,0x5041 ), chip_504x }, + {PCI_VDEVICE (MARVELL ,0x5080 ), chip_5080 }, + {PCI_VDEVICE (MARVELL ,0x5081 ), chip_508x }, +/* RocketRAID 1720/174x have different identifiers */ + {PCI_VDEVICE (TTI ,0x1720 ), chip_6042 }, + {PCI_VDEVICE (TTI ,0x1740 ), chip_6042 }, + {PCI_VDEVICE (TTI ,0x1742 ), chip_6042 }, + + {PCI_VDEVICE (MARVELL ,0x6040 ), chip_604x }, + {PCI_VDEVICE (MARVELL ,0x6041 ), chip_604x }, + {PCI_VDEVICE (MARVELL ,0x6042 ), chip_6042 }, + {PCI_VDEVICE (MARVELL ,0x6080 ), chip_608x }, + {PCI_VDEVICE (MARVELL ,0x6081 ), chip_608x }, + + {PCI_VDEVICE (ADAPTEC2 ,0x0241 ), chip_604x }, + +/* Adaptec 1430SA */ + {PCI_VDEVICE (ADAPTEC2 ,0x0243 ), chip_7042 }, + +/* Marvell 7042 support */ + {PCI_VDEVICE (MARVELL ,0x7042 ), chip_7042 }, + +/* Highpoint RocketRAID PCIe series */ + {PCI_VDEVICE (TTI ,0x2300 ), chip_7042 }, + {PCI_VDEVICE (TTI ,0x2310 ), chip_7042 }, + + { }/* terminate list */ +}; +static struct pci_driver mv_pci_driver = { .name =DRV_NAME ,
@@ -4315,6 +4315,7 @@ static struct pci_driver mv_pci_driver = {#endif }; +MODULE_DEVICE_TABLE (pci, mv_pci_tbl);/** * mv_print_info - Dump key info to kernel log for perusal.
@@ -4487,7 +4488,6 @@ static void __exit mv_exit(void)MODULE_AUTHOR ("Brett Russ" );MODULE_DESCRIPTION ("SCSI low-level driver for Marvell SATA controllers" );MODULE_LICENSE ("GPL v2" ); -MODULE_DEVICE_TABLE (pci, mv_pci_tbl);MODULE_VERSION (DRV_VERSION );MODULE_ALIAS ("platform:" DRV_NAME );
Signature · 1 line
2.39.2
Damien Le Moal
maintainerRe: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
Quoted 4 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Building with W=1 shows a warning for an unused variable when
CONFIG_PCIis diabled:
s/diabled/disabled
Quoted 5 lines
drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable] static const structpci_device_idmv_pci_tbl[] = {Move the table into the same block that containsn the
pci_driverdefinition.
s/containsn/contains
But no need to resend, I will fix that when applying.
Thanks !
Quoted 103 lines
Fixes 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/ata/sata_mv.c | 64 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 32 deletions(-)drivers/ata/sata_mv.c +32
-32@@ -787,37 +787,6 @@ static const struct ata_port_info mv_port_info[] = { }, }; -static const struct pci_device_id mv_pci_tbl[] = { - {PCI_VDEVICE (MARVELL ,0x5040 ), chip_504x }, - {PCI_VDEVICE (MARVELL ,0x5041 ), chip_504x }, - {PCI_VDEVICE (MARVELL ,0x5080 ), chip_5080 }, - {PCI_VDEVICE (MARVELL ,0x5081 ), chip_508x }, -/* RocketRAID 1720/174x have different identifiers */ - {PCI_VDEVICE (TTI ,0x1720 ), chip_6042 }, - {PCI_VDEVICE (TTI ,0x1740 ), chip_6042 }, - {PCI_VDEVICE (TTI ,0x1742 ), chip_6042 }, - - {PCI_VDEVICE (MARVELL ,0x6040 ), chip_604x }, - {PCI_VDEVICE (MARVELL ,0x6041 ), chip_604x }, - {PCI_VDEVICE (MARVELL ,0x6042 ), chip_6042 }, - {PCI_VDEVICE (MARVELL ,0x6080 ), chip_608x }, - {PCI_VDEVICE (MARVELL ,0x6081 ), chip_608x }, - - {PCI_VDEVICE (ADAPTEC2 ,0x0241 ), chip_604x }, - -/* Adaptec 1430SA */ - {PCI_VDEVICE (ADAPTEC2 ,0x0243 ), chip_7042 }, - -/* Marvell 7042 support */ - {PCI_VDEVICE (MARVELL ,0x7042 ), chip_7042 }, - -/* Highpoint RocketRAID PCIe series */ - {PCI_VDEVICE (TTI ,0x2300 ), chip_7042 }, - {PCI_VDEVICE (TTI ,0x2310 ), chip_7042 }, - - { }/* terminate list */ -}; -static const struct mv_hw_ops mv5xxx_ops = { .phy_errata = mv5_phy_errata, .enable_leds = mv5_enable_leds,@@ -4303,6 +4272,37 @@ static int mv_pci_init_one(struct pci_dev *pdev,static int mv_pci_device_resume (struct pci_dev *pdev);#endif +static const struct pci_device_id mv_pci_tbl[] = { + {PCI_VDEVICE (MARVELL ,0x5040 ), chip_504x }, + {PCI_VDEVICE (MARVELL ,0x5041 ), chip_504x }, + {PCI_VDEVICE (MARVELL ,0x5080 ), chip_5080 }, + {PCI_VDEVICE (MARVELL ,0x5081 ), chip_508x }, +/* RocketRAID 1720/174x have different identifiers */ + {PCI_VDEVICE (TTI ,0x1720 ), chip_6042 }, + {PCI_VDEVICE (TTI ,0x1740 ), chip_6042 }, + {PCI_VDEVICE (TTI ,0x1742 ), chip_6042 }, + + {PCI_VDEVICE (MARVELL ,0x6040 ), chip_604x }, + {PCI_VDEVICE (MARVELL ,0x6041 ), chip_604x }, + {PCI_VDEVICE (MARVELL ,0x6042 ), chip_6042 }, + {PCI_VDEVICE (MARVELL ,0x6080 ), chip_608x }, + {PCI_VDEVICE (MARVELL ,0x6081 ), chip_608x }, + + {PCI_VDEVICE (ADAPTEC2 ,0x0241 ), chip_604x }, + +/* Adaptec 1430SA */ + {PCI_VDEVICE (ADAPTEC2 ,0x0243 ), chip_7042 }, + +/* Marvell 7042 support */ + {PCI_VDEVICE (MARVELL ,0x7042 ), chip_7042 }, + +/* Highpoint RocketRAID PCIe series */ + {PCI_VDEVICE (TTI ,0x2300 ), chip_7042 }, + {PCI_VDEVICE (TTI ,0x2310 ), chip_7042 }, + + { }/* terminate list */ +}; +static struct pci_driver mv_pci_driver = { .name =DRV_NAME ,@@ -4315,6 +4315,7 @@ static struct pci_driver mv_pci_driver = {#endif }; +MODULE_DEVICE_TABLE (pci, mv_pci_tbl);/** * mv_print_info - Dump key info to kernel log for perusal. @@ -4487,7 +4488,6 @@ static void __exit mv_exit(void)MODULE_AUTHOR ("Brett Russ" );MODULE_DESCRIPTION ("SCSI low-level driver for Marvell SATA controllers" );MODULE_LICENSE ("GPL v2" ); -MODULE_DEVICE_TABLE (pci, mv_pci_tbl);MODULE_VERSION (DRV_VERSION );MODULE_ALIAS ("platform:" DRV_NAME );
Signature · 2 lines
Damien Le Moal Western Digital Research
Damien Le Moal
maintainerRe: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
In reply to Arnd BergmannQuoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Building with W=1 shows a warning for an unused variable when
CONFIG_PCIis diabled:
Quoted 8 lines
drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable] static const structpci_device_idmv_pci_tbl[] = {Move the table into the same block that containsn the
pci_driverdefinition.Fixes 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")Signed-off-by Arnd Bergmann <[email protected]>
The patch title is also not describing what the patch does. Are you OK with changing that to:
ata: sata_mv: Fix PCI device ID table declaration warning
?
Quoted 100 lines
--- drivers/ata/sata_mv.c | 64 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 32 deletions(-)drivers/ata/sata_mv.c +32
-32@@ -787,37 +787,6 @@ static const struct ata_port_info mv_port_info[] = { }, }; -static const struct pci_device_id mv_pci_tbl[] = { - {PCI_VDEVICE (MARVELL ,0x5040 ), chip_504x }, - {PCI_VDEVICE (MARVELL ,0x5041 ), chip_504x }, - {PCI_VDEVICE (MARVELL ,0x5080 ), chip_5080 }, - {PCI_VDEVICE (MARVELL ,0x5081 ), chip_508x }, -/* RocketRAID 1720/174x have different identifiers */ - {PCI_VDEVICE (TTI ,0x1720 ), chip_6042 }, - {PCI_VDEVICE (TTI ,0x1740 ), chip_6042 }, - {PCI_VDEVICE (TTI ,0x1742 ), chip_6042 }, - - {PCI_VDEVICE (MARVELL ,0x6040 ), chip_604x }, - {PCI_VDEVICE (MARVELL ,0x6041 ), chip_604x }, - {PCI_VDEVICE (MARVELL ,0x6042 ), chip_6042 }, - {PCI_VDEVICE (MARVELL ,0x6080 ), chip_608x }, - {PCI_VDEVICE (MARVELL ,0x6081 ), chip_608x }, - - {PCI_VDEVICE (ADAPTEC2 ,0x0241 ), chip_604x }, - -/* Adaptec 1430SA */ - {PCI_VDEVICE (ADAPTEC2 ,0x0243 ), chip_7042 }, - -/* Marvell 7042 support */ - {PCI_VDEVICE (MARVELL ,0x7042 ), chip_7042 }, - -/* Highpoint RocketRAID PCIe series */ - {PCI_VDEVICE (TTI ,0x2300 ), chip_7042 }, - {PCI_VDEVICE (TTI ,0x2310 ), chip_7042 }, - - { }/* terminate list */ -}; -static const struct mv_hw_ops mv5xxx_ops = { .phy_errata = mv5_phy_errata, .enable_leds = mv5_enable_leds,@@ -4303,6 +4272,37 @@ static int mv_pci_init_one(struct pci_dev *pdev,static int mv_pci_device_resume (struct pci_dev *pdev);#endif +static const struct pci_device_id mv_pci_tbl[] = { + {PCI_VDEVICE (MARVELL ,0x5040 ), chip_504x }, + {PCI_VDEVICE (MARVELL ,0x5041 ), chip_504x }, + {PCI_VDEVICE (MARVELL ,0x5080 ), chip_5080 }, + {PCI_VDEVICE (MARVELL ,0x5081 ), chip_508x }, +/* RocketRAID 1720/174x have different identifiers */ + {PCI_VDEVICE (TTI ,0x1720 ), chip_6042 }, + {PCI_VDEVICE (TTI ,0x1740 ), chip_6042 }, + {PCI_VDEVICE (TTI ,0x1742 ), chip_6042 }, + + {PCI_VDEVICE (MARVELL ,0x6040 ), chip_604x }, + {PCI_VDEVICE (MARVELL ,0x6041 ), chip_604x }, + {PCI_VDEVICE (MARVELL ,0x6042 ), chip_6042 }, + {PCI_VDEVICE (MARVELL ,0x6080 ), chip_608x }, + {PCI_VDEVICE (MARVELL ,0x6081 ), chip_608x }, + + {PCI_VDEVICE (ADAPTEC2 ,0x0241 ), chip_604x }, + +/* Adaptec 1430SA */ + {PCI_VDEVICE (ADAPTEC2 ,0x0243 ), chip_7042 }, + +/* Marvell 7042 support */ + {PCI_VDEVICE (MARVELL ,0x7042 ), chip_7042 }, + +/* Highpoint RocketRAID PCIe series */ + {PCI_VDEVICE (TTI ,0x2300 ), chip_7042 }, + {PCI_VDEVICE (TTI ,0x2310 ), chip_7042 }, + + { }/* terminate list */ +}; +static struct pci_driver mv_pci_driver = { .name =DRV_NAME ,@@ -4315,6 +4315,7 @@ static struct pci_driver mv_pci_driver = {#endif }; +MODULE_DEVICE_TABLE (pci, mv_pci_tbl);/** * mv_print_info - Dump key info to kernel log for perusal. @@ -4487,7 +4488,6 @@ static void __exit mv_exit(void)MODULE_AUTHOR ("Brett Russ" );MODULE_DESCRIPTION ("SCSI low-level driver for Marvell SATA controllers" );MODULE_LICENSE ("GPL v2" ); -MODULE_DEVICE_TABLE (pci, mv_pci_tbl);MODULE_VERSION (DRV_VERSION );MODULE_ALIAS ("platform:" DRV_NAME );
Signature · 2 lines
Damien Le Moal Western Digital Research
Arnd Bergmann
maintainerRe: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
Quoted 15 lines · Damien Le Moal
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Building with W=1 shows a warning for an unused variable when
CONFIG_PCIis diabled:Quoted 8 lines
drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable] static const structpci_device_idmv_pci_tbl[] = {Move the table into the same block that containsn the
pci_driverdefinition.Fixes 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")Signed-off-by Arnd Bergmann <[email protected]>
Quoted 6 lines
The patch title is also not describing what the patch does. Are you OK with changing that to:
ata:
sata_mv: Fix PCI device ID table declaration warning?
Yes, please do, thanks!
I had first tried to remove all the #ifdef checks and just rely on dead-code-elimination doing the same when pci_register_driver() is stubbed out and IS_ENABLED(CONFIG_OF) checks turn off the rest. Unfortunately, the include/linux/pci.h interfaces are not all stubbed out here and cause compile-time failures without CONFIG_PCI, so that didn't work out.
Arnd
Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
Quoted 16 lines · Arnd Bergmann
Quoted 15 lines · Damien Le Moal
Quoted 13 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Building with W=1 shows a warning for an unused variable when
CONFIG_PCIis diabled:
drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable] static const structpci_device_idmv_pci_tbl[] = {Move the table into the same block that containsn the
pci_driverdefinition.Fixes 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")Signed-off-by Arnd Bergmann <[email protected]>
Quoted 8 lines
Quoted 6 lines
The patch title is also not describing what the patch does. Are you OK with changing that to:
ata:
sata_mv: Fix PCI device ID table declaration warning?
Yes, please do, thanks!
Applied to for-6.9-fixes with discussed tweaks and removal of extra blanklines pointed out by Andy. Thanks !
Quoted 9 lines
I had first tried to remove all the #ifdef checks and just rely on dead-code-elimination doing the same when
pci_register_driver()is stubbed out andIS_ENABLED(CONFIG_OF)checks turn off the rest. Unfortunately, theinclude/linux/pci.hinterfaces are not all stubbed out here and cause compile-time failures withoutCONFIG_PCI, so that didn't work out.Arnd
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
In reply to Arnd BergmannQuoted 10 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Building with W=1 shows a warning for an unused variable when
CONFIG_PCIis diabled:
drivers/ata/sata_mv.c:790:35: error: unused variable 'mv_pci_tbl' [-Werror,-Wunused-const-variable] static const structpci_device_idmv_pci_tbl[] = {Move the table into the same block that containsn the
pci_driverdefinition.
...
drivers/ata/sata_mv.c static int mv_pci_init_one(struct pci_dev *pdev,
Quoted 4 lines
drivers/ata/sata_mv.c +3
-0+ { }/* terminate list */ +}; +
Too many blank lines now.
Quoted 3 lines
static struct
pci_drivermv_pci_driver= {
.name =DRV_NAME,
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 31/34 spi: remove incorrect of_match_ptr annotations
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When building with CONFIG_OF disabled but W=1 extra warnings enabled, a couple of driver cause a warning about an unused ID table:
drivers/spi/spi-armada-3700.c:806:34: error: unused variable 'a3700_spi_dt_ids' [-Werror,-Wunused-const-variable] drivers/spi/spi-orion.c:614:34: error: unused variable 'orion_spi_of_match_table' [-Werror,-Wunused-const-variable] drivers/spi/spi-pic32-sqi.c:673:34: error: unused variable 'pic32_sqi_of_ids' [-Werror,-Wunused-const-variable] drivers/spi/spi-pic32.c:850:34: error: unused variable 'pic32_spi_of_match' [-Werror,-Wunused-const-variable] drivers/spi/spi-rockchip.c:1020:34: error: unused variable 'rockchip_spi_dt_match' [-Werror,-Wunused-const-variable] drivers/spi/spi-s3c64xx.c:1642:34: error: unused variable 's3c64xx_spi_dt_match' [-Werror,-Wunused-const-variable] drivers/spi/spi-st-ssc4.c:439:34: error: unused variable 'stm_spi_match' [-Werror,-Wunused-const-variable]
These appear to all be copied from the same original driver, so fix them at the same time by removing the unnecessary of_match_ptr() annotation. As far as I can tell, all these drivers are only actually used on configurations that have CONFIG_OF enabled.
--- drivers/spi/spi-armada-3700.c | 2 +- drivers/spi/spi-img-spfi.c | 2 +- drivers/spi/spi-meson-spicc.c | 2 +- drivers/spi/spi-meson-spifc.c | 2 +- drivers/spi/spi-orion.c | 2 +- drivers/spi/spi-pic32-sqi.c | 2 +- drivers/spi/spi-pic32.c | 2 +- drivers/spi/spi-rockchip.c | 2 +- drivers/spi/spi-s3c64xx.c | 2 +- drivers/spi/spi-st-ssc4.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-)
drivers/spi/spi-armada-3700.c +1 -1
@@ -902,7 +902,7 @@ static int a3700_spi_probe(struct platform_device *pdev)static struct platform_driver a3700_spi_driver = { .driver = { .name =DRIVER_NAME , - .of_match_table =of_match_ptr (a3700_spi_dt_ids), + .of_match_table = a3700_spi_dt_ids, }, .probe = a3700_spi_probe, };
drivers/spi/spi-img-spfi.c +1 -1
@@ -753,7 +753,7 @@ static struct platform_driver img_spfi_driver = { .driver = { .name = "img-spfi", .pm = &img_spfi_pm_ops, - .of_match_table = of_match_ptr(img_spfi_of_match), + .of_match_table = img_spfi_of_match, }, .probe = img_spfi_probe, .remove_new = img_spfi_remove,
drivers/spi/spi-meson-spicc.c +1 -1
@@ -946,7 +946,7 @@ static struct platform_driver meson_spicc_driver = { .remove_new = meson_spicc_remove, .driver = { .name = "meson-spicc", - .of_match_table = of_match_ptr(meson_spicc_of_match), + .of_match_table = meson_spicc_of_match, }, };
drivers/spi/spi-meson-spifc.c +1 -1
@@ -432,7 +432,7 @@ static struct platform_driver meson_spifc_driver = { .remove_new = meson_spifc_remove, .driver = { .name = "meson-spifc", - .of_match_table = of_match_ptr(meson_spifc_dt_match), + .of_match_table = meson_spifc_dt_match, .pm = &meson_spifc_pm_ops, }, };
drivers/spi/spi-orion.c +1 -1
@@ -843,7 +843,7 @@ static struct platform_driver orion_spi_driver = { .driver = { .name = DRIVER_NAME, .pm = &orion_spi_pm_ops, - .of_match_table = of_match_ptr(orion_spi_of_match_table), + .of_match_table = orion_spi_of_match_table, }, .probe = orion_spi_probe, .remove_new = orion_spi_remove,
drivers/spi/spi-pic32-sqi.c +1 -1
@@ -679,7 +679,7 @@ MODULE_DEVICE_TABLE(of, pic32_sqi_of_ids);static struct platform_driver pic32_sqi_driver = { .driver = { .name ="sqi-pic32" , - .of_match_table =of_match_ptr (pic32_sqi_of_ids), + .of_match_table = pic32_sqi_of_ids, }, .probe = pic32_sqi_probe, .remove_new = pic32_sqi_remove,
drivers/spi/spi-pic32.c +1 -1
@@ -856,7 +856,7 @@ MODULE_DEVICE_TABLE(of, pic32_spi_of_match);static struct platform_driver pic32_spi_driver = { .driver = { .name ="spi-pic32" , - .of_match_table =of_match_ptr (pic32_spi_of_match), + .of_match_table = pic32_spi_of_match, }, .probe = pic32_spi_probe, .remove_new = pic32_spi_remove,
drivers/spi/spi-rockchip.c +1 -1
@@ -1042,7 +1042,7 @@ static struct platform_driver rockchip_spi_driver = { .driver = { .name = DRIVER_NAME, .pm = &rockchip_spi_pm, - .of_match_table = of_match_ptr(rockchip_spi_dt_match), + .of_match_table = rockchip_spi_dt_match, }, .probe = rockchip_spi_probe, .remove_new = rockchip_spi_remove,
drivers/spi/spi-s3c64xx.c +1 -1
@@ -1677,7 +1677,7 @@ static struct platform_driver s3c64xx_spi_driver = { .driver = { .name = "s3c64xx-spi", .pm = &s3c64xx_spi_pm, - .of_match_table = of_match_ptr(s3c64xx_spi_dt_match), + .of_match_table = s3c64xx_spi_dt_match, }, .probe = s3c64xx_spi_probe, .remove_new = s3c64xx_spi_remove,
drivers/spi/spi-st-ssc4.c +1 -1
@@ -446,7 +446,7 @@ static struct platform_driver spi_st_driver = { .driver = { .name = "spi-st", .pm = &spi_st_pm, - .of_match_table = of_match_ptr(stm_spi_match), + .of_match_table = stm_spi_match, }, .probe = spi_st_probe, .remove_new = spi_st_remove,
Signature · 1 line
2.39.2
Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When building with
CONFIG_OFdisabled but W=1 extra warnings enabled, a couple of driver cause a warning about an unused ID table:
Quoted 7 lines
drivers/spi/spi-armada-3700.c:806:34: error: unused variable 'a3700_spi_dt_ids' [-Werror,-Wunused-const-variable]drivers/spi/spi-orion.c:614:34: error: unused variable 'orion_spi_of_match_table' [-Werror,-Wunused-const-variable]drivers/spi/spi-pic32-sqi.c:673:34: error: unused variable 'pic32_sqi_of_ids' [-Werror,-Wunused-const-variable]drivers/spi/spi-pic32.c:850:34: error: unused variable 'pic32_spi_of_match' [-Werror,-Wunused-const-variable]drivers/spi/spi-rockchip.c:1020:34: error: unused variable 'rockchip_spi_dt_match' [-Werror,-Wunused-const-variable]drivers/spi/spi-s3c64xx.c:1642:34: error: unused variable 's3c64xx_spi_dt_match' [-Werror,-Wunused-const-variable]drivers/spi/spi-st-ssc4.c:439:34: error: unused variable 'stm_spi_match' [-Werror,-Wunused-const-variable]
I would drop these 'drivers/spi/' parts as we know they are all in the same folder.
Quoted 4 lines
These appear to all be copied from the same original driver, so fix them at the same time by removing the unnecessary
of_match_ptr()annotation. As far as I can tell, all these drivers are only actually used on configurations that haveCONFIG_OFenabled.
LGTM,
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
In reply to Arnd BergmannQuoted 13 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When building with
CONFIG_OFdisabled but W=1 extra warnings enabled, a couple of driver cause a warning about an unused ID table:
drivers/spi/spi-armada-3700.c:806:34: error: unused variable 'a3700_spi_dt_ids' [-Werror,-Wunused-const-variable]drivers/spi/spi-orion.c:614:34: error: unused variable 'orion_spi_of_match_table' [-Werror,-Wunused-const-variable]drivers/spi/spi-pic32-sqi.c:673:34: error: unused variable 'pic32_sqi_of_ids' [-Werror,-Wunused-const-variable]drivers/spi/spi-pic32.c:850:34: error: unused variable 'pic32_spi_of_match' [-Werror,-Wunused-const-variable]drivers/spi/spi-rockchip.c:1020:34: error: unused variable 'rockchip_spi_dt_match' [-Werror,-Wunused-const-variable]drivers/spi/spi-s3c64xx.c:1642:34: error: unused variable 's3c64xx_spi_dt_match' [-Werror,-Wunused-const-variable]drivers/spi/spi-st-ssc4.c:439:34: error: unused variable 'stm_spi_match' [-Werror,-Wunused-const-variable]
Quoted 4 lines
These appear to all be copied from the same original driver, so fix them at the same time by removing the unnecessary
of_match_ptr()annotation. As far as I can tell, all these drivers are only actually used on configurations that haveCONFIG_OFenabled.
I think I already tried to fix all of these, but Mark rejected my patches:
https://lore.kernel.org/all/[email protected]/
All of the changes here look the same as my patchset, I also got there some Acks.
Best regards,
Krzysztof
Mark Brown
maintainerRe: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
In reply to Arnd BergmannQuoted 4 lines · Arnd Bergmann
These appear to all be copied from the same original driver, so fix them at the same time by removing the unnecessary
of_match_ptr()annotation. As far as I can tell, all these drivers are only actually used on configurations that haveCONFIG_OFenabled.
Why are we not fixing of_match_ptr() here, or at least adding the ifdefs in case someone does end up wanting to run without OF?
Just as a general thing for something like this where the patches aren't expected to get merged together it makes life much easier to not send as a series - pulling individual patches out of a series causes issues with things like b4, especially if you have to apply them to multiple places, and there's limited benefit.
Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
Quoted 9 lines · Mark Brown
Quoted 4 lines · Arnd Bergmann
These appear to all be copied from the same original driver, so fix them at the same time by removing the unnecessary
of_match_ptr()annotation. As far as I can tell, all these drivers are only actually used on configurations that haveCONFIG_OFenabled.Why are we not fixing
of_match_ptr()here, or at least adding the ifdefs in case someone does end up wanting to run without OF?
Fixing of_match_ptr =
include/linux/of.h +1 -1
@@ -890,7 +890,7 @@ static inline const void *of_device_get_match_data(const struct device *dev) return NULL; } -#define of_match_ptr (_ptr) NULL +#define of_match_ptr (_ptr) (0 ? (_ptr) : NULL)#define of_match_node (_matches, _node) NULL#endif /* CONFIG_OF */
?
Assuming this helps, I agree this would be the better fix.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
Wed, Apr 03, 2024 at 11:05:51PM +0200, Uwe Kleine-König kirjoitti:
Quoted 18 lines · Mark Brown
Quoted 9 lines · Arnd Bergmann
Quoted 5 lines
These appear to all be copied from the same original driver, so fix them at the same time by removing the unnecessary
of_match_ptr()annotation. As far as I can tell, all these drivers are only actually used on configurations that haveCONFIG_OFenabled.Why are we not fixing
of_match_ptr()here, or at least adding the ifdefs in case someone does end up wanting to run without OF?Fixing
of_match_ptr=include/linux/of.h +0
-0
include/linux/of.h static inline const void *of_device_get_match_data(const struct device *dev) · line 893
Quoted 5 lines
include/linux/of.h +1
-1@@ -890,7 +890,7 @@ static inline const void *of_device_get_match_data(const struct device *dev)return NULL ; } -#define of_match_ptr (_ptr) NULL +#define of_match_ptr (_ptr) (0 ? (_ptr) : NULL)
FWIW, we have PTR_IF() (with a side note to split it from kernel.h in a separate header or less twisted one).
Quoted 6 lines
include/linux/of.h +0
-0#define of_match_node (_matches, _node) NULL#endif /* CONFIG_OF */ ?
Assuming this helps, I agree this would be the better fix.
Why? I mean why do we need to even have this API? It's always good to know which devices are supported by the module even if you have no need in such support or it's not compiled in. One of the reasons why is to be able to google for compatible hardware, for example.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Arnd Bergmann
maintainerRe: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
Quoted 22 lines · Andy Shevchenko
Wed, Apr 03, 2024 at 11:05:51PM +0200, Uwe Kleine-König kirjoitti:
Quoted 21 lines · Mark Brown
Quoted 9 lines · Arnd Bergmann
Quoted 5 lines
These appear to all be copied from the same original driver, so fix them at the same time by removing the unnecessary
of_match_ptr()annotation. As far as I can tell, all these drivers are only actually used on configurations that haveCONFIG_OFenabled.Why are we not fixing
of_match_ptr()here, or at least adding the ifdefs in case someone does end up wanting to run without OF?Fixing
of_match_ptr=include/linux/of.h +0
-0@@ -890,7 +890,7 @@ static inline const void *of_device_get_match_data(const struct device *dev)return NULL ; }
Quoted 2 lines
include/linux/of.h static inline const void *of_device_get_match_data(const struct device *dev) · line 893
Quoted 2 lines
include/linux/of.h +1
-1-#define of_match_ptr (_ptr) NULL +#define of_match_ptr (_ptr) (0 ? (_ptr) : NULL)
This would require removing several hundred "#ifdef CONFIG_OF" checks around the of_device_id tables at the same time unfortunately. Most of those are completely unnecessary, so if we wanted to remove those, we should remove the of_match_ptr() instances at the same time.
Quoted 5 lines
Quoted 5 lines
include/linux/of.h +0
-0#define of_match_node (_matches, _node) NULL#endif /* CONFIG_OF */ ?
Quoted 7 lines
Quoted 1 line
Assuming this helps, I agree this would be the better fix.
Why? I mean why do we need to even have this API? It's always good to know which devices are supported by the module even if you have no need in such support or it's not compiled in. One of the reasons why is to be able to google for compatible hardware, for example.
As far as I can tell, the of_match_ptr() helper was a historic mistake, it makes pretty much no sense in its current form.
The version that Uwe proposes would have made sense but we can't change it now.
Arnd
PATCH 32/34 ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When building with CONFIG_OF and/or CONFIG_ACPI disabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
sound/soc/atmel/sam9x5_wm8731.c:187:34: error: unused variable 'sam9x5_wm8731_of_match' [-Werror,-Wunused-const-variable] sound/soc/codecs/rt5514-spi.c:496:34: error: unused variable 'rt5514_of_match' [-Werror,-Wunused-const-variable] sound/soc/samsung/aries_wm8994.c:524:34: error: unused variable 'samsung_wm8994_of_match' [-Werror,-Wunused-const-variable]
The fix is always to just remove the of_match_ptr() and ACPI_PTR() wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.
--- sound/soc/amd/acp3x-rt5682-max9836.c | 2 +- sound/soc/atmel/sam9x5_wm8731.c | 2 +- sound/soc/codecs/rt5514-spi.c | 2 +- sound/soc/qcom/lpass-sc7280.c | 2 +- sound/soc/samsung/aries_wm8994.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
sound/soc/amd/acp3x-rt5682-max9836.c +1 -1
@@ -543,7 +543,7 @@ MODULE_DEVICE_TABLE(acpi, acp3x_audio_acpi_match);static struct platform_driver acp3x_audio = { .driver = { .name ="acp3x-alc5682-max98357" , - .acpi_match_table =ACPI_PTR (acp3x_audio_acpi_match), + .acpi_match_table = acp3x_audio_acpi_match, .pm = &snd_soc_pm_ops, }, .probe = acp3x_probe,
sound/soc/atmel/sam9x5_wm8731.c +1 -1
@@ -193,7 +193,7 @@ MODULE_DEVICE_TABLE(of, sam9x5_wm8731_of_match);static struct platform_driver sam9x5_wm8731_driver = { .driver = { .name =DRV_NAME , - .of_match_table =of_match_ptr (sam9x5_wm8731_of_match), + .of_match_table = sam9x5_wm8731_of_match, }, .probe = sam9x5_wm8731_driver_probe, .remove_new = sam9x5_wm8731_driver_remove,
sound/soc/codecs/rt5514-spi.c +1 -1
@@ -503,7 +503,7 @@ static struct spi_driver rt5514_spi_driver = { .driver = { .name = "rt5514", .pm = &rt5514_pm_ops, - .of_match_table = of_match_ptr(rt5514_of_match), + .of_match_table = rt5514_of_match, }, .probe = rt5514_spi_probe, };
sound/soc/qcom/lpass-sc7280.c +1 -1
@@ -441,7 +441,7 @@ MODULE_DEVICE_TABLE(of, sc7280_lpass_cpu_device_id);static struct platform_driver sc7280_lpass_cpu_platform_driver = { .driver = { .name ="sc7280-lpass-cpu" , - .of_match_table =of_match_ptr (sc7280_lpass_cpu_device_id), + .of_match_table = sc7280_lpass_cpu_device_id, .pm = &sc7280_lpass_pm_ops, }, .probe = asoc_qcom_lpass_cpu_platform_probe,
sound/soc/samsung/aries_wm8994.c +1 -1
@@ -689,7 +689,7 @@ static int aries_audio_probe(struct platform_device *pdev)static struct platform_driver aries_audio_driver = { .driver = { .name ="aries-audio-wm8994" , - .of_match_table =of_match_ptr (samsung_wm8994_of_match), + .of_match_table = samsung_wm8994_of_match, .pm = &snd_soc_pm_ops, }, .probe = aries_audio_probe,
Signature · 1 line
2.39.2
Re: [PATCH 32/34] ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations
Quoted 14 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When building with
CONFIG_OFand/orCONFIG_ACPIdisabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
sound/soc/atmel/sam9x5_wm8731.c:187:34: error: unused variable 'sam9x5_wm8731_of_match' [-Werror,-Wunused-const-variable]sound/soc/codecs/rt5514-spi.c:496:34: error: unused variable 'rt5514_of_match' [-Werror,-Wunused-const-variable]sound/soc/samsung/aries_wm8994.c:524:34: error: unused variable 'samsung_wm8994_of_match' [-Werror,-Wunused-const-variable]The fix is always to just remove the
of_match_ptr()andACPI_PTR()wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.
Quoted 7 lines
Signed-off-by Arnd Bergmann <[email protected]>--- sound/soc/amd/acp3x-rt5682-max9836.c | 2 +- sound/soc/atmel/sam9x5_wm8731.c | 2 +- sound/soc/codecs/rt5514-spi.c | 2 +- sound/soc/qcom/lpass-sc7280.c | 2 +- sound/soc/samsung/aries_wm8994.c | 2 +-
I sent it already as well:
https://lore.kernel.org/all/[email protected]/
and Mark did not pick it up, I guess for the same reason as SPI.
Best regards,
Krzysztof
Re: [PATCH 32/34] ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations
In reply to Arnd BergmannQuoted 13 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When building with
CONFIG_OFand/orCONFIG_ACPIdisabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
sound/soc/atmel/sam9x5_wm8731.c:187:34: error: unused variable 'sam9x5_wm8731_of_match' [-Werror,-Wunused-const-variable]sound/soc/codecs/rt5514-spi.c:496:34: error: unused variable 'rt5514_of_match' [-Werror,-Wunused-const-variable]sound/soc/samsung/aries_wm8994.c:524:34: error: unused variable 'samsung_wm8994_of_match' [-Werror,-Wunused-const-variable]The fix is always to just remove the
of_match_ptr()andACPI_PTR()wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.
...
sound/soc/amd/acp3x-rt5682-max9836.c MODULE_DEVICE_TABLE(acpi, acp3x_audio_acpi_match); · line 549
Quoted 12 lines
index
d6cdb6d9fdd6..ffc105759994100644sound/soc/amd/acp3x-rt5682-max9836.c +1
-1@@ -543,7 +543,7 @@ MODULE_DEVICE_TABLE(acpi, acp3x_audio_acpi_match);static struct platform_driver acp3x_audio = { .driver = { .name ="acp3x-alc5682-max98357" , - .acpi_match_table =ACPI_PTR (acp3x_audio_acpi_match), + .acpi_match_table = acp3x_audio_acpi_match, .pm = &snd_soc_pm_ops, }, .probe = acp3x_probe,
Replace acpi_match_device() by device_get_match_data() and acpi.h by mod_devicetable.h + property.h.
I really would like to see agnostic drivers (when they don't need of*.h/acpi.h to be included as "proxy" headers).
With this, the change probably needs to be separated from this patch.
If you address as suggested,
...
The rest I haven't checked, it might be possible to do something similar there as well.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 33/34 drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
When building with CONFIG_OF and/or CONFIG_ACPI disabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
drivers/char/tpm/tpm_ftpm_tee.c:356:34: error: unused variable 'of_ftpm_tee_ids' [-Werror,-Wunused-const-variable] drivers/dma/img-mdc-dma.c:863:34: error: unused variable 'mdc_dma_of_match' [-Werror,-Wunused-const-variable] drivers/fpga/versal-fpga.c:62:34: error: unused variable 'versal_fpga_of_match' [-Werror,-Wunused-const-variable] drivers/i2c/muxes/i2c-mux-ltc4306.c:200:34: error: unused variable 'ltc4306_of_match' [-Werror,-Wunused-const-variable] drivers/i2c/muxes/i2c-mux-reg.c:242:34: error: unused variable 'i2c_mux_reg_of_match' [-Werror,-Wunused-const-variable] drivers/memory/pl353-smc.c:62:34: error: unused variable 'pl353_smc_supported_children' [-Werror,-Wunused-const-variable] drivers/regulator/pbias-regulator.c:136:34: error: unused variable 'pbias_of_match' [-Werror,-Wunused-const-variable] drivers/regulator/twl-regulator.c:552:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable] drivers/regulator/twl6030-regulator.c:645:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable] drivers/scsi/hisi_sas/hisi_sas_v2_hw.c:3635:36: error: unused variable 'sas_v2_acpi_match' [-Werror,-Wunused-const-variable] drivers/staging/pi433/pi433_if.c:1359:34: error: unused variable 'pi433_dt_ids' [-Werror,-Wunused-const-variable] drivers/tty/serial/amba-pl011.c:2945:34: error: unused variable 'sbsa_uart_of_match' [-Werror,-Wunused-const-variable]
The fix is always to just remove the of_match_ptr() and ACPI_PTR() wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.
I considered splitting up the large patch into per subsystem patches, but since it's really just the same thing everywhere it feels better to do it all at once.
--- drivers/char/ipmi/ipmb_dev_int.c | 2 +- drivers/char/tpm/tpm_ftpm_tee.c | 2 +- drivers/dma/img-mdc-dma.c | 2 +- drivers/fpga/versal-fpga.c | 2 +- drivers/hid/hid-google-hammer.c | 6 ++---- drivers/i2c/muxes/i2c-mux-ltc4306.c | 2 +- drivers/i2c/muxes/i2c-mux-reg.c | 2 +- drivers/input/touchscreen/wdt87xx_i2c.c | 2 +- drivers/mux/adg792a.c | 2 +- drivers/net/ethernet/apm/xgene-v2/main.c | 2 +- drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +- drivers/regulator/pbias-regulator.c | 2 +- drivers/regulator/twl-regulator.c | 2 +- drivers/regulator/twl6030-regulator.c | 2 +- drivers/rtc/rtc-fsl-ftm-alarm.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/staging/pi433/pi433_if.c | 2 +- drivers/tty/serial/amba-pl011.c | 6 +++--- drivers/tty/serial/ma35d1_serial.c | 2 +- 20 files changed, 23 insertions(+), 25 deletions(-)
drivers/char/ipmi/ipmb_dev_int.c +1 -1
@@ -364,7 +364,7 @@ MODULE_DEVICE_TABLE(acpi, acpi_ipmb_id);static struct i2c_driver ipmb_driver = { .driver = { .name ="ipmb-dev" , - .acpi_match_table =ACPI_PTR (acpi_ipmb_id), + .acpi_match_table = acpi_ipmb_id, }, .probe = ipmb_probe, .remove = ipmb_remove,
drivers/char/tpm/tpm_ftpm_tee.c +1 -1
@@ -362,7 +362,7 @@ MODULE_DEVICE_TABLE(of, of_ftpm_tee_ids);static struct platform_driver ftpm_tee_plat_driver = { .driver = { .name ="ftpm-tee" , - .of_match_table =of_match_ptr (of_ftpm_tee_ids), + .of_match_table = of_ftpm_tee_ids, }, .shutdown = ftpm_plat_tee_shutdown, .probe = ftpm_plat_tee_probe,
drivers/dma/img-mdc-dma.c +1 -1
@@ -1073,7 +1073,7 @@ static struct platform_driver mdc_dma_driver = { .driver = { .name = "img-mdc-dma", .pm = &img_mdc_pm_ops, - .of_match_table = of_match_ptr(mdc_dma_of_match), + .of_match_table = mdc_dma_of_match, }, .probe = mdc_dma_probe, .remove_new = mdc_dma_remove,
drivers/fpga/versal-fpga.c +1 -1
@@ -69,7 +69,7 @@ static struct platform_driver versal_fpga_driver = { .probe = versal_fpga_probe, .driver = { .name = "versal_fpga_manager", - .of_match_table = of_match_ptr(versal_fpga_of_match), + .of_match_table = versal_fpga_of_match, }, };module_platform_driver (versal_fpga_driver);
drivers/hid/hid-google-hammer.c +2 -4
@@ -275,21 +275,19 @@ static const struct acpi_device_id cbas_ec_acpi_ids[] = { };MODULE_DEVICE_TABLE (acpi, cbas_ec_acpi_ids); -#ifdef CONFIG_OF static const struct of_device_id cbas_ec_of_match[] = { { .compatible ="google,cros-cbas" }, { }, };MODULE_DEVICE_TABLE (of, cbas_ec_of_match); -#endif static struct platform_driver cbas_ec_driver = { .probe = cbas_ec_probe, .remove = cbas_ec_remove, .driver = { .name ="cbas_ec" , - .acpi_match_table =ACPI_PTR (cbas_ec_acpi_ids), - .of_match_table =of_match_ptr (cbas_ec_of_match), + .acpi_match_table = cbas_ec_acpi_ids, + .of_match_table = cbas_ec_of_match, .pm = &cbas_ec_pm_ops, }, };
drivers/i2c/muxes/i2c-mux-ltc4306.c +1 -1
@@ -303,7 +303,7 @@ static void ltc4306_remove(struct i2c_client *client)static struct i2c_driver ltc4306_driver = { .driver = { .name ="ltc4306" , - .of_match_table =of_match_ptr (ltc4306_of_match), + .of_match_table = ltc4306_of_match, }, .probe = ltc4306_probe, .remove = ltc4306_remove,
drivers/i2c/muxes/i2c-mux-reg.c +1 -1
@@ -250,7 +250,7 @@ static struct platform_driver i2c_mux_reg_driver = { .remove_new = i2c_mux_reg_remove, .driver = { .name = "i2c-mux-reg", - .of_match_table = of_match_ptr(i2c_mux_reg_of_match), + .of_match_table = i2c_mux_reg_of_match, }, };
drivers/input/touchscreen/wdt87xx_i2c.c +1 -1
@@ -1166,7 +1166,7 @@ static struct i2c_driver wdt87xx_driver = { .name = WDT87XX_NAME, .dev_groups = wdt87xx_groups, .pm = pm_sleep_ptr(&wdt87xx_pm_ops), - .acpi_match_table = ACPI_PTR(wdt87xx_acpi_id), + .acpi_match_table = wdt87xx_acpi_id, }, };module_i2c_driver (wdt87xx_driver);
drivers/mux/adg792a.c +1 -1
@@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(of, adg792a_of_match);static struct i2c_driver adg792a_driver = { .driver = { .name ="adg792a" , - .of_match_table =of_match_ptr (adg792a_of_match), + .of_match_table = adg792a_of_match, }, .probe = adg792a_probe, .id_table = adg792a_id,
drivers/net/ethernet/apm/xgene-v2/main.c +1 -1
@@ -731,7 +731,7 @@ MODULE_DEVICE_TABLE(acpi, xge_acpi_match);static struct platform_driver xge_driver = { .driver = { .name ="xgene-enet-v2" , - .acpi_match_table =ACPI_PTR (xge_acpi_match), + .acpi_match_table = xge_acpi_match, }, .probe = xge_probe, .remove_new = xge_remove,
drivers/net/ethernet/hisilicon/hns_mdio.c +1 -1
@@ -639,7 +639,7 @@ static struct platform_driver hns_mdio_driver = { .driver = { .name = MDIO_DRV_NAME, .of_match_table = hns_mdio_match, - .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match), + .acpi_match_table = hns_mdio_acpi_match, }, };
drivers/regulator/pbias-regulator.c +1 -1
@@ -231,7 +231,7 @@ static struct platform_driver pbias_regulator_driver = { .driver = { .name = "pbias-regulator", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(pbias_of_match), + .of_match_table = pbias_of_match, }, };
drivers/regulator/twl-regulator.c +1 -1
@@ -656,7 +656,7 @@ static struct platform_driver twlreg_driver = { .driver = { .name = "twl4030_reg", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(twl_of_match), + .of_match_table = twl_of_match, }, };
drivers/regulator/twl6030-regulator.c +1 -1
@@ -765,7 +765,7 @@ static struct platform_driver twlreg_driver = { .driver = { .name = "twl6030_reg", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(twl_of_match), + .of_match_table = twl_of_match, }, };
drivers/rtc/rtc-fsl-ftm-alarm.c +1 -1
@@ -320,7 +320,7 @@ static struct platform_driver ftm_rtc_driver = { .driver = { .name = "ftm-alarm", .of_match_table = ftm_rtc_match, - .acpi_match_table = ACPI_PTR(ftm_imx_acpi_ids), + .acpi_match_table = ftm_imx_acpi_ids, }, };
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +1 -1
@@ -1788,7 +1788,7 @@ static struct platform_driver hisi_sas_v1_driver = { .driver = { .name = DRV_NAME, .of_match_table = sas_v1_of_match, - .acpi_match_table = ACPI_PTR(sas_v1_acpi_match), + .acpi_match_table = sas_v1_acpi_match, }, };
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1 -1
@@ -3635,7 +3635,7 @@ static struct platform_driver hisi_sas_v2_driver = { .driver = { .name = DRV_NAME, .of_match_table = sas_v2_of_match, - .acpi_match_table = ACPI_PTR(sas_v2_acpi_match), + .acpi_match_table = sas_v2_acpi_match, }, };
drivers/staging/pi433/pi433_if.c +1 -1
@@ -1367,7 +1367,7 @@ static struct spi_driver pi433_spi_driver = { .driver = { .name = "pi433", .owner = THIS_MODULE, - .of_match_table = of_match_ptr(pi433_dt_ids), + .of_match_table = pi433_dt_ids, }, .probe = pi433_probe, .remove = pi433_remove,
drivers/tty/serial/amba-pl011.c +3 -3
@@ -2948,7 +2948,7 @@ static const struct of_device_id sbsa_uart_of_match[] = { };MODULE_DEVICE_TABLE (of, sbsa_uart_of_match); -static const struct acpi_device_id __maybe_unused sbsa_uart_acpi_match[] = { +static const struct acpi_device_id sbsa_uart_acpi_match[] = { {"ARMH0011" ,0 }, {"ARMHB000" ,0 }, {},
@@ -2961,8 +2961,8 @@ static struct platform_driver arm_sbsa_uart_platform_driver = { .driver = { .name = "sbsa-uart", .pm = &pl011_dev_pm_ops, - .of_match_table = of_match_ptr(sbsa_uart_of_match), - .acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match), + .of_match_table = sbsa_uart_of_match, + .acpi_match_table = sbsa_uart_acpi_match, .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011), }, };
drivers/tty/serial/ma35d1_serial.c +1 -1
@@ -798,7 +798,7 @@ static struct platform_driver ma35d1serial_driver = { .resume = ma35d1serial_resume, .driver = { .name = "ma35d1-uart", - .of_match_table = of_match_ptr(ma35d1_serial_of_match), + .of_match_table = ma35d1_serial_of_match, }, };
Signature · 1 line
2.39.2
Krzysztof Kozlowski
maintainerRe: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
Quoted 27 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When building with
CONFIG_OFand/orCONFIG_ACPIdisabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
drivers/char/tpm/tpm_ftpm_tee.c:356:34: error: unused variable 'of_ftpm_tee_ids' [-Werror,-Wunused-const-variable]drivers/dma/img-mdc-dma.c:863:34: error: unused variable 'mdc_dma_of_match' [-Werror,-Wunused-const-variable]drivers/fpga/versal-fpga.c:62:34: error: unused variable 'versal_fpga_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-ltc4306.c:200:34: error: unused variable 'ltc4306_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-reg.c:242:34: error: unused variable 'i2c_mux_reg_of_match' [-Werror,-Wunused-const-variable]drivers/memory/pl353-smc.c:62:34: error: unused variable 'pl353_smc_supported_children' [-Werror,-Wunused-const-variable]drivers/regulator/pbias-regulator.c:136:34: error: unused variable 'pbias_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl-regulator.c:552:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl6030-regulator.c:645:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/scsi/hisi_sas/hisi_sas_v2_hw.c:3635:36: error: unused variable 'sas_v2_acpi_match' [-Werror,-Wunused-const-variable]drivers/staging/pi433/pi433_if.c:1359:34: error: unused variable 'pi433_dt_ids' [-Werror,-Wunused-const-variable]drivers/tty/serial/amba-pl011.c:2945:34: error: unused variable 'sbsa_uart_of_match' [-Werror,-Wunused-const-variable]The fix is always to just remove the
of_match_ptr()andACPI_PTR()wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.I considered splitting up the large patch into per subsystem patches, but since it's really just the same thing everywhere it feels better to do it all at once.
Signed-off-by Arnd Bergmann <[email protected]>
Quoted 15 lines
--- drivers/char/ipmi/ipmb_dev_int.c | 2 +- drivers/char/tpm/tpm_ftpm_tee.c | 2 +- drivers/dma/img-mdc-dma.c | 2 +- drivers/fpga/versal-fpga.c | 2 +- drivers/hid/hid-google-hammer.c | 6 ++---- drivers/i2c/muxes/i2c-mux-ltc4306.c | 2 +- drivers/i2c/muxes/i2c-mux-reg.c | 2 +- drivers/input/touchscreen/wdt87xx_i2c.c | 2 +- drivers/mux/adg792a.c | 2 +- drivers/net/ethernet/apm/xgene-v2/main.c | 2 +- drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +- drivers/regulator/pbias-regulator.c | 2 +- drivers/regulator/twl-regulator.c | 2 +- drivers/regulator/twl6030-regulator.c | 2 +-
I covered regulators here the same way:
https://lore.kernel.org/all/[email protected]/
but just like SPI and ASoC, Mark did not agree to pick them up.
Best regards,
Krzysztof
Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
In reply to Arnd BergmannQuoted 19 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When building with
CONFIG_OFand/orCONFIG_ACPIdisabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
drivers/char/tpm/tpm_ftpm_tee.c:356:34: error: unused variable 'of_ftpm_tee_ids' [-Werror,-Wunused-const-variable]drivers/dma/img-mdc-dma.c:863:34: error: unused variable 'mdc_dma_of_match' [-Werror,-Wunused-const-variable]drivers/fpga/versal-fpga.c:62:34: error: unused variable 'versal_fpga_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-ltc4306.c:200:34: error: unused variable 'ltc4306_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-reg.c:242:34: error: unused variable 'i2c_mux_reg_of_match' [-Werror,-Wunused-const-variable]drivers/memory/pl353-smc.c:62:34: error: unused variable 'pl353_smc_supported_children' [-Werror,-Wunused-const-variable]drivers/regulator/pbias-regulator.c:136:34: error: unused variable 'pbias_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl-regulator.c:552:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl6030-regulator.c:645:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/scsi/hisi_sas/hisi_sas_v2_hw.c:3635:36: error: unused variable 'sas_v2_acpi_match' [-Werror,-Wunused-const-variable]drivers/staging/pi433/pi433_if.c:1359:34: error: unused variable 'pi433_dt_ids' [-Werror,-Wunused-const-variable]drivers/tty/serial/amba-pl011.c:2945:34: error: unused variable 'sbsa_uart_of_match' [-Werror,-Wunused-const-variable]
Quoted 6 lines
The fix is always to just remove the
of_match_ptr()andACPI_PTR()wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.I considered splitting up the large patch into per subsystem patches, but since it's really just the same thing everywhere it feels better to do it all at once.
Can we split to three groups:
- Dropping ACPI_PTR()
- Dropping of_match_ptr() (which I won't review in depth, for example)
- Dropping both
?
...
drivers/char/ipmi/ipmb_dev_int.c MODULE_DEVICE_TABLE(acpi, acpi_ipmb_id); · line 370
Quoted 11 lines
drivers/char/ipmi/ipmb_dev_int.c +1
-1@@ -364,7 +364,7 @@ MODULE_DEVICE_TABLE(acpi, acpi_ipmb_id);static struct i2c_driver ipmb_driver = { .driver = { .name ="ipmb-dev" , - .acpi_match_table =ACPI_PTR (acpi_ipmb_id), + .acpi_match_table = acpi_ipmb_id, }, .probe = ipmb_probe, .remove = ipmb_remove,
acpi.h --> mod_devicetable.h.
...
Quoted 16 lines
drivers/hid/hid-google-hammer.c +0
-2@@ -275,21 +275,19 @@ static const struct acpi_device_id cbas_ec_acpi_ids[] = { };MODULE_DEVICE_TABLE (acpi, cbas_ec_acpi_ids); -#ifdef CONFIG_OF static const struct of_device_id cbas_ec_of_match[] = { { .compatible ="google,cros-cbas" }, { }, };MODULE_DEVICE_TABLE (of, cbas_ec_of_match); -#endif static struct platform_driver cbas_ec_driver = { .probe = cbas_ec_probe,
drivers/hid/hid-google-hammer.c static const struct acpi_device_id cbas_ec_acpi_ids[] = { · line 293
Quoted 10 lines
drivers/hid/hid-google-hammer.c +2
-2.remove = cbas_ec_remove, .driver = { .name = "cbas_ec", - .acpi_match_table = ACPI_PTR(cbas_ec_acpi_ids), - .of_match_table = of_match_ptr(cbas_ec_of_match), + .acpi_match_table = cbas_ec_acpi_ids, + .of_match_table = cbas_ec_of_match, .pm = &cbas_ec_pm_ops, }, };
Ditto, and likely of.h can be also dropped.
...
drivers/input/touchscreen/wdt87xx_i2c.c static struct i2c_driver wdt87xx_driver = { · line 1172
Quoted 11 lines
drivers/input/touchscreen/wdt87xx_i2c.c +1
-1@@ -1166,7 +1166,7 @@ static struct i2c_driver wdt87xx_driver = { .name = WDT87XX_NAME, .dev_groups = wdt87xx_groups, .pm = pm_sleep_ptr(&wdt87xx_pm_ops), - .acpi_match_table = ACPI_PTR(wdt87xx_acpi_id), + .acpi_match_table = wdt87xx_acpi_id, }, };module_i2c_driver (wdt87xx_driver);
Ditto.
...
drivers/net/ethernet/apm/xgene-v2/main.c MODULE_DEVICE_TABLE(acpi, xge_acpi_match); · line 737
Quoted 11 lines
drivers/net/ethernet/apm/xgene-v2/main.c +1
-1@@ -731,7 +731,7 @@ MODULE_DEVICE_TABLE(acpi, xge_acpi_match);static struct platform_driver xge_driver = { .driver = { .name ="xgene-enet-v2" , - .acpi_match_table =ACPI_PTR (xge_acpi_match), + .acpi_match_table = xge_acpi_match, }, .probe = xge_probe, .remove_new = xge_remove,
Ditto. And remove forward declaration of the variable as well.
...
drivers/rtc/rtc-fsl-ftm-alarm.c static struct platform_driver ftm_rtc_driver = { · line 325
Quoted 10 lines
drivers/rtc/rtc-fsl-ftm-alarm.c +1
-1@@ -320,7 +320,7 @@ static struct platform_driver ftm_rtc_driver = { .driver = { .name = "ftm-alarm", .of_match_table = ftm_rtc_match, - .acpi_match_table = ACPI_PTR(ftm_imx_acpi_ids), + .acpi_match_table = ftm_imx_acpi_ids, }, };
Ditto.
...
drivers/rtc/rtc-fsl-ftm-alarm.c
Quoted 3 lines
drivers/rtc/rtc-fsl-ftm-alarm.c +0
-0.driver = {drivers/rtc/rtc-fsl-ftm-alarm.c +0
-0.name = "pi433", .owner = THIS_MODULE,
Oh-oh.
Quoted 3 lines
drivers/rtc/rtc-fsl-ftm-alarm.c +1
-1- .of_match_table = of_match_ptr(pi433_dt_ids), + .of_match_table = pi433_dt_ids, },
...
Quoted 12 lines
drivers/tty/serial/amba-pl011.c +1
-1@@ -2948,7 +2948,7 @@ static const struct of_device_id sbsa_uart_of_match[] = { };MODULE_DEVICE_TABLE (of, sbsa_uart_of_match); -static const struct acpi_device_id __maybe_unused sbsa_uart_acpi_match[] = { +static const struct acpi_device_id sbsa_uart_acpi_match[] = { {"ARMH0011" ,0 }, {"ARMHB000" ,0 }, {},
drivers/tty/serial/amba-pl011.c static struct platform_driver arm_sbsa_uart_platform_driver = { · line 2968
Quoted 10 lines
drivers/tty/serial/amba-pl011.c +2
-2@@ -2961,8 +2961,8 @@ static struct platform_driver arm_sbsa_uart_platform_driver = { .driver = { .name = "sbsa-uart", .pm = &pl011_dev_pm_ops, - .of_match_table = of_match_ptr(sbsa_uart_of_match), - .acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match), + .of_match_table = sbsa_uart_of_match, + .acpi_match_table = sbsa_uart_acpi_match, .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011), }, };
Ditto.
...
As mentioned above, I haven't and won't look into of_match_ptr() cases, but you got the idea.
For the above, if addressed as suggested,
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
Quoted 24 lines · Andy Shevchenko
Quoted 22 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When building with
CONFIG_OFand/orCONFIG_ACPIdisabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
drivers/char/tpm/tpm_ftpm_tee.c:356:34: error: unused variable 'of_ftpm_tee_ids' [-Werror,-Wunused-const-variable]drivers/dma/img-mdc-dma.c:863:34: error: unused variable 'mdc_dma_of_match' [-Werror,-Wunused-const-variable]drivers/fpga/versal-fpga.c:62:34: error: unused variable 'versal_fpga_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-ltc4306.c:200:34: error: unused variable 'ltc4306_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-reg.c:242:34: error: unused variable 'i2c_mux_reg_of_match' [-Werror,-Wunused-const-variable]drivers/memory/pl353-smc.c:62:34: error: unused variable 'pl353_smc_supported_children' [-Werror,-Wunused-const-variable]drivers/regulator/pbias-regulator.c:136:34: error: unused variable 'pbias_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl-regulator.c:552:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl6030-regulator.c:645:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/scsi/hisi_sas/hisi_sas_v2_hw.c:3635:36: error: unused variable 'sas_v2_acpi_match' [-Werror,-Wunused-const-variable]drivers/staging/pi433/pi433_if.c:1359:34: error: unused variable 'pi433_dt_ids' [-Werror,-Wunused-const-variable]drivers/tty/serial/amba-pl011.c:2945:34: error: unused variable 'sbsa_uart_of_match' [-Werror,-Wunused-const-variable]The fix is always to just remove the
of_match_ptr()andACPI_PTR()wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.
Quoted 8 lines
Quoted 2 lines
I considered splitting up the large patch into per subsystem patches, but since it's really just the same thing everywhere it feels better to do it all at once.
Can we split to three groups:
- DroppingACPI_PTR()
- Droppingof_match_ptr()(which I won't review in depth, for example)
- Dropping both
?
Why?
-corey
Quoted 147 lines
...
drivers/char/ipmi/ipmb_dev_int.c MODULE_DEVICE_TABLE(acpi, acpi_ipmb_id); · line 370
Quoted 11 lines
drivers/char/ipmi/ipmb_dev_int.c +1
-1@@ -364,7 +364,7 @@ MODULE_DEVICE_TABLE(acpi, acpi_ipmb_id);static struct i2c_driver ipmb_driver = { .driver = { .name ="ipmb-dev" , - .acpi_match_table =ACPI_PTR (acpi_ipmb_id), + .acpi_match_table = acpi_ipmb_id, }, .probe = ipmb_probe, .remove = ipmb_remove,
acpi.h-->mod_devicetable.h....
Quoted 16 lines
drivers/hid/hid-google-hammer.c +0
-2@@ -275,21 +275,19 @@ static const struct acpi_device_id cbas_ec_acpi_ids[] = { };MODULE_DEVICE_TABLE (acpi, cbas_ec_acpi_ids); -#ifdef CONFIG_OF static const struct of_device_id cbas_ec_of_match[] = { { .compatible ="google,cros-cbas" }, { }, };MODULE_DEVICE_TABLE (of, cbas_ec_of_match); -#endif static struct platform_driver cbas_ec_driver = { .probe = cbas_ec_probe,drivers/hid/hid-google-hammer.c static const struct acpi_device_id cbas_ec_acpi_ids[] = { · line 293
Quoted 10 lines
drivers/hid/hid-google-hammer.c +2
-2.remove = cbas_ec_remove, .driver = { .name = "cbas_ec", - .acpi_match_table = ACPI_PTR(cbas_ec_acpi_ids), - .of_match_table = of_match_ptr(cbas_ec_of_match), + .acpi_match_table = cbas_ec_acpi_ids, + .of_match_table = cbas_ec_of_match, .pm = &cbas_ec_pm_ops, }, };Ditto, and likely
of.hcan be also dropped....
drivers/input/touchscreen/wdt87xx_i2c.c static struct i2c_driver wdt87xx_driver = { · line 1172
Quoted 11 lines
drivers/input/touchscreen/wdt87xx_i2c.c +1
-1@@ -1166,7 +1166,7 @@ static struct i2c_driver wdt87xx_driver = { .name = WDT87XX_NAME, .dev_groups = wdt87xx_groups, .pm = pm_sleep_ptr(&wdt87xx_pm_ops), - .acpi_match_table = ACPI_PTR(wdt87xx_acpi_id), + .acpi_match_table = wdt87xx_acpi_id, }, };module_i2c_driver (wdt87xx_driver);Ditto.
...
drivers/net/ethernet/apm/xgene-v2/main.c MODULE_DEVICE_TABLE(acpi, xge_acpi_match); · line 737
Quoted 11 lines
drivers/net/ethernet/apm/xgene-v2/main.c +1
-1@@ -731,7 +731,7 @@ MODULE_DEVICE_TABLE(acpi, xge_acpi_match);static struct platform_driver xge_driver = { .driver = { .name ="xgene-enet-v2" , - .acpi_match_table =ACPI_PTR (xge_acpi_match), + .acpi_match_table = xge_acpi_match, }, .probe = xge_probe, .remove_new = xge_remove,Ditto. And remove forward declaration of the variable as well.
...
drivers/rtc/rtc-fsl-ftm-alarm.c static struct platform_driver ftm_rtc_driver = { · line 325
Quoted 10 lines
drivers/rtc/rtc-fsl-ftm-alarm.c +1
-1@@ -320,7 +320,7 @@ static struct platform_driver ftm_rtc_driver = { .driver = { .name = "ftm-alarm", .of_match_table = ftm_rtc_match, - .acpi_match_table = ACPI_PTR(ftm_imx_acpi_ids), + .acpi_match_table = ftm_imx_acpi_ids, }, };Ditto.
...
drivers/rtc/rtc-fsl-ftm-alarm.c
Quoted 3 lines
drivers/rtc/rtc-fsl-ftm-alarm.c +0
-0.driver = {drivers/rtc/rtc-fsl-ftm-alarm.c +0
-0.name = "pi433", .owner = THIS_MODULE,Oh-oh.
Quoted 3 lines
drivers/rtc/rtc-fsl-ftm-alarm.c +1
-1- .of_match_table = of_match_ptr(pi433_dt_ids), + .of_match_table = pi433_dt_ids, },...
Quoted 12 lines
drivers/tty/serial/amba-pl011.c +1
-1@@ -2948,7 +2948,7 @@ static const struct of_device_id sbsa_uart_of_match[] = { };MODULE_DEVICE_TABLE (of, sbsa_uart_of_match); -static const struct acpi_device_id __maybe_unused sbsa_uart_acpi_match[] = { +static const struct acpi_device_id sbsa_uart_acpi_match[] = { {"ARMH0011" ,0 }, {"ARMHB000" ,0 }, {},drivers/tty/serial/amba-pl011.c static struct platform_driver arm_sbsa_uart_platform_driver = { · line 2968
Quoted 10 lines
drivers/tty/serial/amba-pl011.c +2
-2@@ -2961,8 +2961,8 @@ static struct platform_driver arm_sbsa_uart_platform_driver = { .driver = { .name = "sbsa-uart", .pm = &pl011_dev_pm_ops, - .of_match_table = of_match_ptr(sbsa_uart_of_match), - .acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match), + .of_match_table = sbsa_uart_of_match, + .acpi_match_table = sbsa_uart_acpi_match, .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011), }, };Ditto.
...
As mentioned above, I haven't and won't look into
of_match_ptr()cases, but you got the idea.For the above, if addressed as suggested,
Reviewed-by Andy Shevchenko <[email protected]>Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
Quoted 3 lines · Corey Minyard
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
...
Quoted 10 lines
Quoted 8 lines
Quoted 2 lines
I considered splitting up the large patch into per subsystem patches, but since it's really just the same thing everywhere it feels better to do it all at once.
Can we split to three groups:
- DroppingACPI_PTR()
- Droppingof_match_ptr()(which I won't review in depth, for example)
- Dropping both
?Why?
Easy to review ACPI parts independently on the rest. I think I explained that in above. Besides that some patches might require additional work (don't remember if it is the case for _this_ patch).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
In reply to Arnd BergmannQuoted 19 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When building with
CONFIG_OFand/orCONFIG_ACPIdisabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
drivers/char/tpm/tpm_ftpm_tee.c:356:34: error: unused variable 'of_ftpm_tee_ids' [-Werror,-Wunused-const-variable]drivers/dma/img-mdc-dma.c:863:34: error: unused variable 'mdc_dma_of_match' [-Werror,-Wunused-const-variable]drivers/fpga/versal-fpga.c:62:34: error: unused variable 'versal_fpga_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-ltc4306.c:200:34: error: unused variable 'ltc4306_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-reg.c:242:34: error: unused variable 'i2c_mux_reg_of_match' [-Werror,-Wunused-const-variable]drivers/memory/pl353-smc.c:62:34: error: unused variable 'pl353_smc_supported_children' [-Werror,-Wunused-const-variable]drivers/regulator/pbias-regulator.c:136:34: error: unused variable 'pbias_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl-regulator.c:552:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl6030-regulator.c:645:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/scsi/hisi_sas/hisi_sas_v2_hw.c:3635:36: error: unused variable 'sas_v2_acpi_match' [-Werror,-Wunused-const-variable]drivers/staging/pi433/pi433_if.c:1359:34: error: unused variable 'pi433_dt_ids' [-Werror,-Wunused-const-variable]drivers/tty/serial/amba-pl011.c:2945:34: error: unused variable 'sbsa_uart_of_match' [-Werror,-Wunused-const-variable]
Quoted 8 lines
The fix is always to just remove the
of_match_ptr()andACPI_PTR()wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.I considered splitting up the large patch into per subsystem patches, but since it's really just the same thing everywhere it feels better to do it all at once.
Signed-off-by Arnd Bergmann <[email protected]>
For the IPMI part:
Quoted 312 lines
--- drivers/char/ipmi/ipmb_dev_int.c | 2 +- drivers/char/tpm/tpm_ftpm_tee.c | 2 +- drivers/dma/img-mdc-dma.c | 2 +- drivers/fpga/versal-fpga.c | 2 +- drivers/hid/hid-google-hammer.c | 6 ++---- drivers/i2c/muxes/i2c-mux-ltc4306.c | 2 +- drivers/i2c/muxes/i2c-mux-reg.c | 2 +- drivers/input/touchscreen/wdt87xx_i2c.c | 2 +- drivers/mux/adg792a.c | 2 +- drivers/net/ethernet/apm/xgene-v2/main.c | 2 +- drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +- drivers/regulator/pbias-regulator.c | 2 +- drivers/regulator/twl-regulator.c | 2 +- drivers/regulator/twl6030-regulator.c | 2 +- drivers/rtc/rtc-fsl-ftm-alarm.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/staging/pi433/pi433_if.c | 2 +- drivers/tty/serial/amba-pl011.c | 6 +++--- drivers/tty/serial/ma35d1_serial.c | 2 +- 20 files changed, 23 insertions(+), 25 deletions(-)drivers/char/ipmi/ipmb_dev_int.c +1
-1@@ -364,7 +364,7 @@ MODULE_DEVICE_TABLE(acpi, acpi_ipmb_id);static struct i2c_driver ipmb_driver = { .driver = { .name ="ipmb-dev" , - .acpi_match_table =ACPI_PTR (acpi_ipmb_id), + .acpi_match_table = acpi_ipmb_id, }, .probe = ipmb_probe, .remove = ipmb_remove,drivers/char/tpm/tpm_ftpm_tee.c +1
-1@@ -362,7 +362,7 @@ MODULE_DEVICE_TABLE(of, of_ftpm_tee_ids);static struct platform_driver ftpm_tee_plat_driver = { .driver = { .name ="ftpm-tee" , - .of_match_table =of_match_ptr (of_ftpm_tee_ids), + .of_match_table = of_ftpm_tee_ids, }, .shutdown = ftpm_plat_tee_shutdown, .probe = ftpm_plat_tee_probe,drivers/dma/img-mdc-dma.c +1
-1@@ -1073,7 +1073,7 @@ static struct platform_driver mdc_dma_driver = { .driver = { .name = "img-mdc-dma", .pm = &img_mdc_pm_ops, - .of_match_table = of_match_ptr(mdc_dma_of_match), + .of_match_table = mdc_dma_of_match, }, .probe = mdc_dma_probe, .remove_new = mdc_dma_remove,drivers/fpga/versal-fpga.c +1
-1@@ -69,7 +69,7 @@ static struct platform_driver versal_fpga_driver = { .probe = versal_fpga_probe, .driver = { .name = "versal_fpga_manager", - .of_match_table = of_match_ptr(versal_fpga_of_match), + .of_match_table = versal_fpga_of_match, }, };module_platform_driver (versal_fpga_driver);drivers/hid/hid-google-hammer.c +2
-4@@ -275,21 +275,19 @@ static const struct acpi_device_id cbas_ec_acpi_ids[] = { };MODULE_DEVICE_TABLE (acpi, cbas_ec_acpi_ids); -#ifdef CONFIG_OF static const struct of_device_id cbas_ec_of_match[] = { { .compatible ="google,cros-cbas" }, { }, };MODULE_DEVICE_TABLE (of, cbas_ec_of_match); -#endif static struct platform_driver cbas_ec_driver = { .probe = cbas_ec_probe, .remove = cbas_ec_remove, .driver = { .name ="cbas_ec" , - .acpi_match_table =ACPI_PTR (cbas_ec_acpi_ids), - .of_match_table =of_match_ptr (cbas_ec_of_match), + .acpi_match_table = cbas_ec_acpi_ids, + .of_match_table = cbas_ec_of_match, .pm = &cbas_ec_pm_ops, }, };drivers/i2c/muxes/i2c-mux-ltc4306.c +1
-1@@ -303,7 +303,7 @@ static void ltc4306_remove(struct i2c_client *client)static struct i2c_driver ltc4306_driver = { .driver = { .name ="ltc4306" , - .of_match_table =of_match_ptr (ltc4306_of_match), + .of_match_table = ltc4306_of_match, }, .probe = ltc4306_probe, .remove = ltc4306_remove,drivers/i2c/muxes/i2c-mux-reg.c +1
-1@@ -250,7 +250,7 @@ static struct platform_driver i2c_mux_reg_driver = { .remove_new = i2c_mux_reg_remove, .driver = { .name = "i2c-mux-reg", - .of_match_table = of_match_ptr(i2c_mux_reg_of_match), + .of_match_table = i2c_mux_reg_of_match, }, };drivers/input/touchscreen/wdt87xx_i2c.c +1
-1@@ -1166,7 +1166,7 @@ static struct i2c_driver wdt87xx_driver = { .name = WDT87XX_NAME, .dev_groups = wdt87xx_groups, .pm = pm_sleep_ptr(&wdt87xx_pm_ops), - .acpi_match_table = ACPI_PTR(wdt87xx_acpi_id), + .acpi_match_table = wdt87xx_acpi_id, }, };module_i2c_driver (wdt87xx_driver);drivers/mux/adg792a.c +1
-1@@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(of, adg792a_of_match);static struct i2c_driver adg792a_driver = { .driver = { .name ="adg792a" , - .of_match_table =of_match_ptr (adg792a_of_match), + .of_match_table = adg792a_of_match, }, .probe = adg792a_probe, .id_table = adg792a_id,drivers/net/ethernet/apm/xgene-v2/main.c +1
-1@@ -731,7 +731,7 @@ MODULE_DEVICE_TABLE(acpi, xge_acpi_match);static struct platform_driver xge_driver = { .driver = { .name ="xgene-enet-v2" , - .acpi_match_table =ACPI_PTR (xge_acpi_match), + .acpi_match_table = xge_acpi_match, }, .probe = xge_probe, .remove_new = xge_remove,drivers/net/ethernet/hisilicon/hns_mdio.c +1
-1@@ -639,7 +639,7 @@ static struct platform_driver hns_mdio_driver = { .driver = { .name = MDIO_DRV_NAME, .of_match_table = hns_mdio_match, - .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match), + .acpi_match_table = hns_mdio_acpi_match, }, };drivers/regulator/pbias-regulator.c +1
-1@@ -231,7 +231,7 @@ static struct platform_driver pbias_regulator_driver = { .driver = { .name = "pbias-regulator", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(pbias_of_match), + .of_match_table = pbias_of_match, }, };drivers/regulator/twl-regulator.c +1
-1@@ -656,7 +656,7 @@ static struct platform_driver twlreg_driver = { .driver = { .name = "twl4030_reg", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(twl_of_match), + .of_match_table = twl_of_match, }, };drivers/regulator/twl6030-regulator.c +1
-1@@ -765,7 +765,7 @@ static struct platform_driver twlreg_driver = { .driver = { .name = "twl6030_reg", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(twl_of_match), + .of_match_table = twl_of_match, }, };drivers/rtc/rtc-fsl-ftm-alarm.c +1
-1@@ -320,7 +320,7 @@ static struct platform_driver ftm_rtc_driver = { .driver = { .name = "ftm-alarm", .of_match_table = ftm_rtc_match, - .acpi_match_table = ACPI_PTR(ftm_imx_acpi_ids), + .acpi_match_table = ftm_imx_acpi_ids, }, };drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +1
-1@@ -1788,7 +1788,7 @@ static struct platform_driver hisi_sas_v1_driver = { .driver = { .name = DRV_NAME, .of_match_table = sas_v1_of_match, - .acpi_match_table = ACPI_PTR(sas_v1_acpi_match), + .acpi_match_table = sas_v1_acpi_match, }, };drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1
-1@@ -3635,7 +3635,7 @@ static struct platform_driver hisi_sas_v2_driver = { .driver = { .name = DRV_NAME, .of_match_table = sas_v2_of_match, - .acpi_match_table = ACPI_PTR(sas_v2_acpi_match), + .acpi_match_table = sas_v2_acpi_match, }, };drivers/staging/pi433/pi433_if.c +1
-1@@ -1367,7 +1367,7 @@ static struct spi_driver pi433_spi_driver = { .driver = { .name = "pi433", .owner = THIS_MODULE, - .of_match_table = of_match_ptr(pi433_dt_ids), + .of_match_table = pi433_dt_ids, }, .probe = pi433_probe, .remove = pi433_remove,drivers/tty/serial/amba-pl011.c +3
-3@@ -2948,7 +2948,7 @@ static const struct of_device_id sbsa_uart_of_match[] = { };MODULE_DEVICE_TABLE (of, sbsa_uart_of_match); -static const struct acpi_device_id __maybe_unused sbsa_uart_acpi_match[] = { +static const struct acpi_device_id sbsa_uart_acpi_match[] = { {"ARMH0011" ,0 }, {"ARMHB000" ,0 }, {},@@ -2961,8 +2961,8 @@ static struct platform_driver arm_sbsa_uart_platform_driver = { .driver = { .name = "sbsa-uart", .pm = &pl011_dev_pm_ops, - .of_match_table = of_match_ptr(sbsa_uart_of_match), - .acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match), + .of_match_table = sbsa_uart_of_match, + .acpi_match_table = sbsa_uart_acpi_match, .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011), }, };drivers/tty/serial/ma35d1_serial.c +1
-1@@ -798,7 +798,7 @@ static struct platform_driver ma35d1serial_driver = { .resume = ma35d1serial_resume, .driver = { .name = "ma35d1-uart", - .of_match_table = of_match_ptr(ma35d1_serial_of_match), + .of_match_table = ma35d1_serial_of_match, }, };Signature · 1 line
2.39.2
Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
In reply to Arnd Bergmanndrivers/char/tpm/tpm_ftpm_tee.c MODULE_DEVICE_TABLE(of, of_ftpm_tee_ids); · line 368
Quoted 13 lines · Arnd Bergmann
drivers/char/tpm/tpm_ftpm_tee.c +1
-1@@ -362,7 +362,7 @@ MODULE_DEVICE_TABLE(of, of_ftpm_tee_ids);static struct platform_driver ftpm_tee_plat_driver = { .driver = { .name ="ftpm-tee" , - .of_match_table =of_match_ptr (of_ftpm_tee_ids), + .of_match_table = of_ftpm_tee_ids, }, .shutdown = ftpm_plat_tee_shutdown, .probe = ftpm_plat_tee_probe,
For this portion:
[can be included to possible new revisions if it stays same]
BR, Jarkko
Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
In reply to Arnd BergmannQuoted 19 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When building with
CONFIG_OFand/orCONFIG_ACPIdisabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
drivers/char/tpm/tpm_ftpm_tee.c:356:34: error: unused variable 'of_ftpm_tee_ids' [-Werror,-Wunused-const-variable]drivers/dma/img-mdc-dma.c:863:34: error: unused variable 'mdc_dma_of_match' [-Werror,-Wunused-const-variable]drivers/fpga/versal-fpga.c:62:34: error: unused variable 'versal_fpga_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-ltc4306.c:200:34: error: unused variable 'ltc4306_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-reg.c:242:34: error: unused variable 'i2c_mux_reg_of_match' [-Werror,-Wunused-const-variable]drivers/memory/pl353-smc.c:62:34: error: unused variable 'pl353_smc_supported_children' [-Werror,-Wunused-const-variable]drivers/regulator/pbias-regulator.c:136:34: error: unused variable 'pbias_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl-regulator.c:552:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl6030-regulator.c:645:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/scsi/hisi_sas/hisi_sas_v2_hw.c:3635:36: error: unused variable 'sas_v2_acpi_match' [-Werror,-Wunused-const-variable]drivers/staging/pi433/pi433_if.c:1359:34: error: unused variable 'pi433_dt_ids' [-Werror,-Wunused-const-variable]drivers/tty/serial/amba-pl011.c:2945:34: error: unused variable 'sbsa_uart_of_match' [-Werror,-Wunused-const-variable]
Quoted 8 lines
The fix is always to just remove the
of_match_ptr()andACPI_PTR()wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.I considered splitting up the large patch into per subsystem patches, but since it's really just the same thing everywhere it feels better to do it all at once.
Signed-off-by Arnd Bergmann <[email protected]>
Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
In reply to Arnd Bergmanndrivers/fpga/versal-fpga.c static struct platform_driver versal_fpga_driver = { · line 72
Quoted 10 lines
drivers/fpga/versal-fpga.c +1
-1@@ -69,7 +69,7 @@ static struct platform_driver versal_fpga_driver = { .probe = versal_fpga_probe, .driver = { .name = "versal_fpga_manager", - .of_match_table = of_match_ptr(versal_fpga_of_match), + .of_match_table = versal_fpga_of_match,
For this part
Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
In reply to Arnd BergmannHi!
Quoted 41 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When building with
CONFIG_OFand/orCONFIG_ACPIdisabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
drivers/char/tpm/tpm_ftpm_tee.c:356:34: error: unused variable 'of_ftpm_tee_ids' [-Werror,-Wunused-const-variable]drivers/dma/img-mdc-dma.c:863:34: error: unused variable 'mdc_dma_of_match' [-Werror,-Wunused-const-variable]drivers/fpga/versal-fpga.c:62:34: error: unused variable 'versal_fpga_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-ltc4306.c:200:34: error: unused variable 'ltc4306_of_match' [-Werror,-Wunused-const-variable]drivers/i2c/muxes/i2c-mux-reg.c:242:34: error: unused variable 'i2c_mux_reg_of_match' [-Werror,-Wunused-const-variable]drivers/memory/pl353-smc.c:62:34: error: unused variable 'pl353_smc_supported_children' [-Werror,-Wunused-const-variable]drivers/regulator/pbias-regulator.c:136:34: error: unused variable 'pbias_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl-regulator.c:552:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/regulator/twl6030-regulator.c:645:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable]drivers/scsi/hisi_sas/hisi_sas_v2_hw.c:3635:36: error: unused variable 'sas_v2_acpi_match' [-Werror,-Wunused-const-variable]drivers/staging/pi433/pi433_if.c:1359:34: error: unused variable 'pi433_dt_ids' [-Werror,-Wunused-const-variable]drivers/tty/serial/amba-pl011.c:2945:34: error: unused variable 'sbsa_uart_of_match' [-Werror,-Wunused-const-variable]The fix is always to just remove the
of_match_ptr()andACPI_PTR()wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.I considered splitting up the large patch into per subsystem patches, but since it's really just the same thing everywhere it feels better to do it all at once.
Signed-off-by Arnd Bergmann <[email protected]>--- drivers/char/ipmi/ipmb_dev_int.c | 2 +- drivers/char/tpm/tpm_ftpm_tee.c | 2 +- drivers/dma/img-mdc-dma.c | 2 +- drivers/fpga/versal-fpga.c | 2 +- drivers/hid/hid-google-hammer.c | 6 ++---- drivers/i2c/muxes/i2c-mux-ltc4306.c | 2 +- drivers/i2c/muxes/i2c-mux-reg.c | 2 +- drivers/input/touchscreen/wdt87xx_i2c.c | 2 +- drivers/mux/adg792a.c | 2 +- drivers/net/ethernet/apm/xgene-v2/main.c | 2 +- drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +- drivers/regulator/pbias-regulator.c | 2 +- drivers/regulator/twl-regulator.c | 2 +-
Quoted 8 lines
drivers/regulator/twl6030-regulator.c | 2 +- drivers/rtc/rtc-fsl-ftm-alarm.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/staging/pi433/pi433_if.c | 2 +- drivers/tty/serial/amba-pl011.c | 6 +++--- drivers/tty/serial/ma35d1_serial.c | 2 +- 20 files changed, 23 insertions(+), 25 deletions(-)
As far as I can tell, this triggers unconditional use of the .of_match_table, and the compiler will have a harder time dropping that data. However, the wasted data is negligible for the parts touching "my" drivers:
drivers/i2c/muxes/i2c-mux-ltc4306.cdrivers/i2c/muxes/i2c-mux-reg.cdrivers/mux/adg729a.c
Cheers,
Peter
PATCH 34/34 kbuild: always enable -Wunused-const-variable
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The last such warnings are fixed now, so the option can be enabled by default.
--- scripts/Makefile.extrawarn | 1 - 1 file changed, 1 deletion(-)
scripts/Makefile.extrawarn +0 -1
@@ -96,7 +96,6 @@ else # Some diagnostics enabled by default are noisy. # Suppress them by using -Wno... except for W=1. KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) ifdef CONFIG_CC_IS_GCC
Signature · 1 line
2.39.2
Re: [PATCH 34/34] kbuild: always enable -Wunused-const-variable
scripts/Makefile.extrawarn else · line 100
Quoted 11 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The last such warnings are fixed now, so the option can be enabled by default.
scripts/Makefile.extrawarn +0
-1@@ -96,7 +96,6 @@ else # Some diagnostics enabled by default are noisy. # Suppress them by using -Wno... except for W=1. KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
What about line #43 in this file?
Citing 40-43 below:
# These warnings generated too much noise in a regular build. # Use make W=1 to enable them (see scripts/Makefile.extrawarn) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Arnd Bergmann
maintainerRe: [PATCH 34/34] kbuild: always enable -Wunused-const-variable
Quoted 15 lines · Andy Shevchenko
scripts/Makefile.extrawarn else · line 100
Quoted 11 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The last such warnings are fixed now, so the option can be enabled by default.
scripts/Makefile.extrawarn +0
-1@@ -96,7 +96,6 @@ else # Some diagnostics enabled by default are noisy. # Suppress them by using -Wno... except for W=1. KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)What about line #43 in this file?
Quoted 6 lines
Citing 40-43 below:
# These warnings generated too much noise in a regular build. # Use make W=1 to enable them (see
scripts/Makefile.extrawarn)KBUILD_CFLAGS+= $(call cc-disable-warning, unused-but-set-variable)KBUILD_CFLAGS+= $(call cc-disable-warning, unused-const-variable)
I sent a patch to simplify this earlier, the -Wunused-const-variable series is based on that, but I kept it separate since I think the 33 patches will take a couple of revisions while the first series should make it into v6.10:
https://lore.kernel.org/lkml/[email protected]/
Arnd
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 3 Apr 2024 10:06:18 +0200 you wrote:
From: Arnd Bergmann <[email protected]>
Compilers traditionally warn for unused 'static' variables, but not if they are constant. The reason here is a custom for C++ programmers to define named constants as 'static const' variables in header files instead of using macros or enums.
[...]
Here is the summary with links:
- [05/34] 3c515: remove unused 'mtu' variable
https://git.kernel.org/netdev/net-next/c/17b35355c2c6 - [19/34] sunrpc: suppress warnings for unused procfs functions (no matching commit) - [26/34] isdn: kcapi: don't build unused procfs code https://git.kernel.org/netdev/net-next/c/91188544af06 - [28/34] net: xgbe: remove extraneous #ifdef checks https://git.kernel.org/netdev/net-next/c/0ef416e045ad
- [33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Sebastian Reichel
AppliedRe: (subset) [PATCH 00/34] address all -Wunused-const warnings
In reply to Arnd BergmannQuoted 8 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Compilers traditionally warn for unused 'static' variables, but not if they are constant. The reason here is a custom for C++ programmers to define named constants as 'static const' variables in header files instead of using macros or enums.
[...]
Applied, thanks!
[09/34] power: rt9455: hide unused rt9455_boost_voltage_values
commit: 452d8950db3e839aba1bb13bc5378f4bac11fa04
Best regards,
Signature · 1 line
Sebastian Reichel <[email protected]>
Michael Ellerman
AppliedRe: (subset) [PATCH 00/34] address all -Wunused-const warnings
In reply to Arnd BergmannQuoted 5 lines · Arnd Bergmann
Compilers traditionally warn for unused 'static' variables, but not if they are constant. The reason here is a custom for C++ programmers to define named constants as 'static const' variables in header files instead of using macros or enums.
Quoted 7 lines
In W=1 builds, we get warnings only static const variables in C files, but not in headers, which is a good compromise, but this still produces warning output in at least 30 files. These warnings are almost all harmless, but also trivial to fix, and there is no good reason to warn only about the non-const variables being unused.
[...]
Applied to powerpc/next.
[01/34] powerpc/fsl-soc: hide unused const variable
https://git.kernel.org/powerpc/c/01acaf3aa75e1641442cc23d8fe0a7bb4226efb1
cheers
Quoted 25 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Compilers traditionally warn for unused 'static' variables, but not if they are constant. The reason here is a custom for C++ programmers to define named constants as 'static const' variables in header files instead of using macros or enums.
In W=1 builds, we get warnings only static const variables in C files, but not in headers, which is a good compromise, but this still produces warning output in at least 30 files. These warnings are almost all harmless, but also trivial to fix, and there is no good reason to warn only about the non-const variables being unused.
I've gone through all the files that I found using randconfig and allmodconfig builds and created patches to avoid these warnings, with the goal of retaining a clean build once the option is enabled by default.
Unfortunately, there is one fairly large patch ("drivers: remove incorrect of_match_ptr/ACPI_PTR annotations") that touches 34 individual drivers that all need the same one-line change. If necessary, I can split it up by driver or by subsystem, but at least for reviewing I would keep it as one piece for the moment.
Quoted 4 lines
Please merge the individual patches through subsystem trees. I expect that some of these will have to go through multiple revisions before they are picked up, so anything that gets applied early saves me from resending.
Arnd, can you refresh this one? It seems some misses still... I have got 3+ 0-day reports against one of the mux drivers.
https://lore.kernel.org/all/?q=adg792a.c
Signature · 2 lines
With Best Regards, Andy Shevchenko