LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/34] address all -Wunused-const warnings
@ 2024-04-03  8:06 Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 01/34] powerpc/fsl-soc: hide unused const variable Arnd Bergmann
                   ` (36 more replies)
  0 siblings, 37 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel
  Cc: Arnd Bergmann, Michael Ellerman, Christophe Leroy, Damien Le Moal,
	Jiri Kosina, Greg Kroah-Hartman, Corey Minyard, Peter Huewe,
	Jarkko Sakkinen, Tero Kristo, Stephen Boyd, Ian Abbott,
	H Hartley Sweeten, Srinivas Pandruvada, Len Brown,
	Rafael J. Wysocki, John Allen, Herbert Xu, Vinod Koul,
	Ard Biesheuvel, Bjorn Andersson, Moritz Fischer, Liviu Dudau,
	Benjamin Tissoires, Andi Shyti, Michael Hennerich, Peter Rosin,
	Lars-Peter Clausen, Jonathan Cameron, Dmitry Torokhov,
	Markuss Broks, Alexandre Torgue, Lee Jones, Jakub Kicinski,
	Shyam Sundar S K, Iyappan Subramanian, Yisen Zhuang,
	Stanislaw Gruszka, Kalle Valo, Sebastian Reichel, Tony Lindgren,
	Mark Brown, Alexandre Belloni, Xiang Chen, Martin K. Petersen,
	Neil Armstrong, Heiko Stuebner, Krzysztof Kozlowski,
	Vaibhav Hiremath, Alex Elder, Jiri Slaby, Jacky Huang,
	Helge Deller, Christoph Hellwig, Robin Murphy, Steven Rostedt,
	Masami Hiramatsu, Andrew Morton, Kees Cook, Trond Myklebust,
	Anna Schumaker, Masahiro Yamada, Nathan Chancellor, Takashi Iwai,
	linuxppc-dev, linux-ide, openipmi-developer, linux-integrity,
	linux-omap, linux-clk, linux-pm, linux-crypto, dmaengine,
	linux-efi, linux-arm-msm, linux-fpga, dri-devel, linux-input,
	linux-i2c, linux-iio, linux-stm32, linux-arm-kernel, netdev,
	linux-leds, linux-wireless, linux-rtc, linux-scsi, linux-spi,
	linux-amlogic, linux-rockchip, linux-samsung-soc, greybus-dev,
	linux-staging, linux-serial, linux-usb, linux-fbdev, iommu,
	linux-trace-kernel, kasan-dev, linux-hardening, linux-nfs,
	linux-kbuild, alsa-devel, linux-sound

From: Arnd Bergmann <arnd@arndb.de>

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(-)

-- 
2.39.2

Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Corey Minyard <minyard@acm.org>
Cc: Peter Huewe <peterhuewe@gmx.de>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Tero Kristo <kristo@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: John Allen <john.allen@amd.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Vinod Koul <vkoul@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Moritz Fischer <mdf@kernel.org>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Andi Shyti <andi.shyti@kernel.org>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Markuss Broks <markuss.broks@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Lee Jones <lee@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Cc: Iyappan Subramanian <iyappan@os.amperecomputing.com>
Cc: Yisen Zhuang <yisen.zhuang@huawei.com>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Xiang Chen <chenxiang66@hisilicon.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com>
Cc: Alex Elder <elder@kernel.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Jacky Huang <ychuang3@nuvoton.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: Anna Schumaker <anna@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: openipmi-developer@lists.sourceforge.net
Cc: linux-integrity@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Cc: linux-clk@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Cc: dmaengine@vger.kernel.org
Cc: linux-efi@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-fpga@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-input@vger.kernel.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-iio@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: netdev@vger.kernel.org
Cc: linux-leds@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: linux-rtc@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: linux-spi@vger.kernel.org
Cc: linux-amlogic@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: greybus-dev@lists.linaro.org
Cc: linux-staging@lists.linux.dev
Cc: linux-serial@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: linux-fbdev@vger.kernel.org
Cc: iommu@lists.linux.dev
Cc: linux-trace-kernel@vger.kernel.org
Cc: kasan-dev@googlegroups.com
Cc: linux-hardening@vger.kernel.org
Cc: linux-nfs@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Cc: alsa-devel@alsa-project.org
Cc: linux-sound@vger.kernel.org

^ permalink raw reply	[flat|nested] 100+ messages in thread

* [PATCH 01/34] powerpc/fsl-soc: hide unused const variable
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:19   ` Christophe Leroy
  2024-04-03  8:06 ` [PATCH 02/34] ubsan: fix unused variable warning in test module Arnd Bergmann
                   ` (35 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Michael Ellerman, Alexander Graf, Stuart Yoder,
	Scott Wood
  Cc: Arnd Bergmann, Nicholas Piggin, Christophe Leroy,
	Aneesh Kumar K.V, Naveen N. Rao, Uwe Kleine-König,
	Rob Herring, linuxppc-dev

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 305bcf26128e ("powerpc/fsl-soc: use CONFIG_EPAPR_PARAVIRT for hcalls")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/sysdev/fsl_msi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 8e6c84df4ca1..e205135ae1fe 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -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[] = {
 	{
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 02/34] ubsan: fix unused variable warning in test module
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 01/34] powerpc/fsl-soc: hide unused const variable Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03 21:36   ` (subset) " Kees Cook
  2024-04-03  8:06 ` [PATCH 03/34] platform: goldfish: remove ACPI_PTR() annotations Arnd Bergmann
                   ` (34 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Kees Cook, Andrew Morton
  Cc: Arnd Bergmann, Marco Elver, Andrey Konovalov, Andrey Ryabinin,
	Justin Stitt, kasan-dev, linux-hardening

From: Arnd Bergmann <arnd@arndb.de>

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]

Fixes: 4a26f49b7b3d ("ubsan: expand tests and reporting")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 lib/test_ubsan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_ubsan.c b/lib/test_ubsan.c
index 276c12140ee2..c288df9372ed 100644
--- a/lib/test_ubsan.c
+++ b/lib/test_ubsan.c
@@ -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,
 };
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 03/34] platform: goldfish: remove ACPI_PTR() annotations
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 01/34] powerpc/fsl-soc: hide unused const variable Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 02/34] ubsan: fix unused variable warning in test module Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:08   ` Andy Shevchenko
  2024-04-03  8:06 ` [PATCH 04/34] i2c: pxa: hide unused icr_bits[] variable Arnd Bergmann
                   ` (33 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Alan Cox, Jason Hu, Greg Kroah-Hartman, Jin Qian
  Cc: Arnd Bergmann, Uwe Kleine-König

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: d62f324b0ac8 ("goldfish: Enable ACPI-based enumeration for android pipe")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/platform/goldfish/goldfish_pipe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
index 061aa9647c19..6a0a42887857 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -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,
 	}
 };
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 04/34] i2c: pxa: hide unused icr_bits[] variable
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (2 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 03/34] platform: goldfish: remove ACPI_PTR() annotations Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03 23:17   ` Andi Shyti
  2024-04-03  8:06 ` [PATCH 05/34] 3c515: remove unused 'mtu' variable Arnd Bergmann
                   ` (32 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Andi Shyti, Russell King, Holger Schurig
  Cc: Arnd Bergmann, Wolfram Sang, Linus Walleij, Geert Uytterhoeven,
	Heiko Stuebner, Yangtao Li, Robert Marko, Uwe Kleine-König,
	Liao Chang, Paul Cercueil, Rob Herring, linux-i2c

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
 drivers/i2c/busses/i2c-pxa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 76f79b68cef8..888ca636f3f3 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 05/34] 3c515: remove unused 'mtu' variable
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (3 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 04/34] i2c: pxa: hide unused icr_bits[] variable Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 06/34] tracing: hide unused ftrace_event_id_fops Arnd Bergmann
                   ` (31 subsequent siblings)
  36 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Arnd Bergmann, netdev

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/3com/3c515.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/3com/3c515.c b/drivers/net/ethernet/3com/3c515.c
index ba3e7aa1a28f..4725a8cfd695 100644
--- a/drivers/net/ethernet/3com/3c515.c
+++ b/drivers/net/ethernet/3com/3c515.c
@@ -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;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 06/34] tracing: hide unused ftrace_event_id_fops
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (4 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 05/34] 3c515: remove unused 'mtu' variable Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused Arnd Bergmann
                   ` (30 subsequent siblings)
  36 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Steven Rostedt, Masami Hiramatsu, Oleg Nesterov
  Cc: Arnd Bergmann, Mathieu Desnoyers, Zheng Yejian, Kees Cook,
	Ajay Kaher, Jinjie Ruan, Clément Léger, Dan Carpenter,
	Tzvetomir Stoyanov (VMware), linux-trace-kernel

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 620a30e97feb ("tracing: Don't pass file_operations array to event_create_dir()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/trace/trace_events.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 7c364b87352e..52f75c36bbca 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (5 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 06/34] tracing: hide unused ftrace_event_id_fops Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:40   ` Andy Shevchenko
  2024-04-03 13:17   ` Uwe Kleine-König
  2024-04-03  8:06 ` [PATCH 08/34] Input: synaptics: hide unused smbus_pnp_ids[] array Arnd Bergmann
                   ` (29 subsequent siblings)
  36 siblings, 2 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Dmitry Torokhov, Maxime Coquelin, Alexandre Torgue
  Cc: Krzysztof Kozlowski, Arnd Bergmann, Uwe Kleine-König,
	linux-input, linux-stm32, linux-arm-kernel

From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

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]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index b204fdb2d22c..022b3e94266d 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -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", },
 	{ },
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 08/34] Input: synaptics: hide unused smbus_pnp_ids[] array
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (6 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 09/34] power: rt9455: hide unused rt9455_boost_voltage_values Arnd Bergmann
                   ` (28 subsequent siblings)
  36 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Dmitry Torokhov, Benjamin Tissoires
  Cc: Arnd Bergmann, José Pekkarinen, Raul Rangel, Jeffery Miller,
	linux-input

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: e839ffab0289 ("Input: synaptics - add support for Intertouch devices")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/input/mouse/synaptics.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 7a303a9d6bf7..bc22b75e64a7 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -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",
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 09/34] power: rt9455: hide unused rt9455_boost_voltage_values
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (7 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 08/34] Input: synaptics: hide unused smbus_pnp_ids[] array Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 10/34] efi: sysfb: don't build when EFI is disabled Arnd Bergmann
                   ` (27 subsequent siblings)
  36 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Sebastian Reichel, Anda-Maria Nicolae,
	Krzysztof Kozlowski
  Cc: Arnd Bergmann, David Lechner, Rob Herring, Uwe Kleine-König,
	linux-pm

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: e86d69dd786e ("power_supply: Add support for Richtek RT9455 battery charger")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/power/supply/rt9455_charger.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/power/supply/rt9455_charger.c b/drivers/power/supply/rt9455_charger.c
index c345a77f9f78..e4dbacd50a43 100644
--- a/drivers/power/supply/rt9455_charger.c
+++ b/drivers/power/supply/rt9455_charger.c
@@ -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[] = {
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 10/34] efi: sysfb: don't build when EFI is disabled
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (8 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 09/34] power: rt9455: hide unused rt9455_boost_voltage_values Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03 13:03   ` Ard Biesheuvel
  2024-04-03  8:06 ` [PATCH 11/34] clk: ti: dpll: fix incorrect #ifdef checks Arnd Bergmann
                   ` (26 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Ard Biesheuvel, Javier Martinez Canillas,
	Randy Dunlap, Daniel Vetter
  Cc: Arnd Bergmann, Ilias Apalodimas, Kirill A. Shutemov, Tom Lendacky,
	Borislav Petkov (AMD), Masahisa Kojima, Rafael J. Wysocki,
	Rob Herring, Saravana Kannan, Greg Kroah-Hartman, linux-efi

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 15d27b15de96 ("efi: sysfb_efi: fix build when EFI is not set")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/firmware/efi/Makefile    | 3 ++-
 drivers/firmware/efi/sysfb_efi.c | 2 --
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
index a2d0009560d0..3baf80d8cf81 100644
--- a/drivers/firmware/efi/Makefile
+++ b/drivers/firmware/efi/Makefile
@@ -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)
diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c
index cc807ed35aed..a8c982475f6b 100644
--- a/drivers/firmware/efi/sysfb_efi.c
+++ b/drivers/firmware/efi/sysfb_efi.c
@@ -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


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 11/34] clk: ti: dpll: fix incorrect #ifdef checks
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (9 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 10/34] efi: sysfb: don't build when EFI is disabled Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:00   ` Tony Lindgren
  2024-04-05 21:13   ` Stephen Boyd
  2024-04-03  8:06 ` [PATCH 12/34] apm-emulation: hide an unused variable Arnd Bergmann
                   ` (25 subsequent siblings)
  36 siblings, 2 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Tero Kristo, Michael Turquette, Stephen Boyd
  Cc: Arnd Bergmann, linux-omap, linux-clk

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/clk/ti/dpll.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c
index 403ec81f561b..3386bd1903df 100644
--- a/drivers/clk/ti/dpll.c
+++ b/drivers/clk/ti/dpll.c
@@ -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
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 12/34] apm-emulation: hide an unused variable
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (10 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 11/34] clk: ti: dpll: fix incorrect #ifdef checks Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03 12:23   ` Jiri Kosina
  2024-04-03  8:06 ` [PATCH 13/34] sisfb: hide unused variables Arnd Bergmann
                   ` (24 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Jiri Kosina, Arnd Bergmann, Greg Kroah-Hartman,
	Ralf Baechle

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 7726942fb15e ("[APM] Add shared version of APM emulation")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/char/apm-emulation.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c
index e795390b070f..53ce352f7197 100644
--- a/drivers/char/apm-emulation.c
+++ b/drivers/char/apm-emulation.c
@@ -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;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 13/34] sisfb: hide unused variables
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (11 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 12/34] apm-emulation: hide an unused variable Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03 12:39   ` Helge Deller
  2024-04-03  8:06 ` [PATCH 14/34] dma/congiguous: avoid warning about unused size_bytes Arnd Bergmann
                   ` (23 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Helge Deller, Arnd Bergmann,
	Bartlomiej Zolnierkiewicz
  Cc: linux-fbdev, dri-devel

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 5908986ef348 ("video: fbdev: sis: avoid mismatched prototypes")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/video/fbdev/sis/init301.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/sis/init301.c b/drivers/video/fbdev/sis/init301.c
index a8fb41f1a258..09329072004f 100644
--- a/drivers/video/fbdev/sis/init301.c
+++ b/drivers/video/fbdev/sis/init301.c
@@ -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 */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 14/34] dma/congiguous: avoid warning about unused size_bytes
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (12 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 13/34] sisfb: hide unused variables Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:42   ` Christoph Hellwig
  2024-04-03  8:06 ` [PATCH 15/34] leds: apu: remove duplicate DMI lookup data Arnd Bergmann
                   ` (22 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Christoph Hellwig, Marek Szyprowski, Arnd Bergmann,
	Kyungmin Park, Michal Nazarewicz
  Cc: Robin Murphy, Yajun Deng, Binglei Wang, Anshuman Khandual,
	Andrew Morton, Zhenhua Huang, iommu

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: c64be2bb1c6e ("drivers: add Contiguous Memory Allocator")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/dma/contiguous.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
index 055da410ac71..c53f4f633f7f 100644
--- a/kernel/dma/contiguous.c
+++ b/kernel/dma/contiguous.c
@@ -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;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 15/34] leds: apu: remove duplicate DMI lookup data
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (13 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 14/34] dma/congiguous: avoid warning about unused size_bytes Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-11 15:51   ` (subset) " Lee Jones
  2024-04-03  8:06 ` [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver Arnd Bergmann
                   ` (21 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Pavel Machek, Lee Jones; +Cc: Arnd Bergmann, linux-leds

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/leds/leds-apu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/leds/leds-apu.c b/drivers/leds/leds-apu.c
index c409b80c236d..1c116aaa9b6e 100644
--- a/drivers/leds/leds-apu.c
+++ b/drivers/leds/leds-apu.c
@@ -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;
 	}
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (14 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 15/34] leds: apu: remove duplicate DMI lookup data Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:36   ` Andy Shevchenko
  2024-04-03  9:55   ` Krzysztof Kozlowski
  2024-04-03  8:06 ` [PATCH 17/34] greybus: arche-ctrl: move device table to its right location Arnd Bergmann
                   ` (20 subsequent siblings)
  36 siblings, 2 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron
  Cc: Arnd Bergmann, linux-iio

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/iio/dac/ad5755.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index 404865e35460..5c1e7f428c25 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 17/34] greybus: arche-ctrl: move device table to its right location
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (15 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-30 23:41   ` Alex Elder
  2024-04-03  8:06 ` [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[] Arnd Bergmann
                   ` (19 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Vaibhav Hiremath, Johan Hovold, Alex Elder,
	Greg Kroah-Hartman, Viresh Kumar
  Cc: Arnd Bergmann, Uwe Kleine-König, Luca Ceresoli, Rob Herring,
	greybus-dev, linux-staging

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 7b62b61c752a ("greybus: arche-ctrl: Don't expose driver internals to arche-platform driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/greybus/arche-apb-ctrl.c | 1 +
 drivers/staging/greybus/arche-platform.c | 9 +--------
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c
index 8541995008da..aa6f266b62a1 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -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,
diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
index 891b75327d7f..b33977ccd527 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[]
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (16 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 17/34] greybus: arche-ctrl: move device table to its right location Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:41   ` Christophe Leroy
  2024-04-03  8:06 ` [PATCH 19/34] sunrpc: suppress warnings for unused procfs functions Arnd Bergmann
                   ` (18 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Andrew Morton, Palmer Dabbelt
  Cc: Arnd Bergmann, Christophe Leroy, Dave Hansen, Noah Goldstein,
	Charlie Jenkins

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: f24a70106dc1 ("lib: checksum: Fix build with CONFIG_NET=n")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 lib/checksum_kunit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/checksum_kunit.c b/lib/checksum_kunit.c
index bf70850035c7..80dd1e1b71ba 100644
--- a/lib/checksum_kunit.c
+++ b/lib/checksum_kunit.c
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 19/34] sunrpc: suppress warnings for unused procfs functions
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (17 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[] Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:59   ` Jeff Layton
  2024-04-03 13:20   ` Chuck Lever
  2024-04-03  8:06 ` [PATCH 20/34] comedi: ni_atmio: avoid warning for unused device_ids[] table Arnd Bergmann
                   ` (17 subsequent siblings)
  36 siblings, 2 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Trond Myklebust, Anna Schumaker, Chuck Lever,
	Jeff Layton, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, NeilBrown, J. Bruce Fields
  Cc: Arnd Bergmann, Olga Kornievskaia, Dai Ngo, Tom Talpey, linux-nfs,
	netdev

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
 net/sunrpc/cache.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 95ff74706104..ab3a57965dc0 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -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)
 {
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 20/34] comedi: ni_atmio: avoid warning for unused device_ids[] table
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (18 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 19/34] sunrpc: suppress warnings for unused procfs functions Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n Arnd Bergmann
                   ` (16 subsequent siblings)
  36 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Ian Abbott, H Hartley Sweeten; +Cc: Arnd Bergmann

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/comedi/drivers/ni_atmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/comedi/drivers/ni_atmio.c b/drivers/comedi/drivers/ni_atmio.c
index 8876a1d24c56..09dece0994c2 100644
--- a/drivers/comedi/drivers/ni_atmio.c
+++ b/drivers/comedi/drivers/ni_atmio.c
@@ -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},
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (19 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 20/34] comedi: ni_atmio: avoid warning for unused device_ids[] table Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:33   ` Andy Shevchenko
  2024-04-03 14:26   ` Jeff Johnson
  2024-04-03  8:06 ` [PATCH 22/34] drm/komeda: don't warn for unused debugfs files Arnd Bergmann
                   ` (15 subsequent siblings)
  36 siblings, 2 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Stanislaw Gruszka, Kalle Valo; +Cc: Arnd Bergmann, linux-wireless

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/wireless/intel/iwlegacy/4965-rs.c | 15 ++-------------
 drivers/net/wireless/intel/iwlegacy/common.h  |  2 --
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/4965-rs.c b/drivers/net/wireless/intel/iwlegacy/4965-rs.c
index 718efb1aa1b0..1aa2cee5d131 100644
--- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c
@@ -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
diff --git a/drivers/net/wireless/intel/iwlegacy/common.h b/drivers/net/wireless/intel/iwlegacy/common.h
index 69687fcf963f..b9f1daf0901b 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.h
+++ b/drivers/net/wireless/intel/iwlegacy/common.h
@@ -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 */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 22/34] drm/komeda: don't warn for unused debugfs files
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (20 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 23/34] firmware: qcom_scm: mark qcom_scm_qseecom_allowlist as __maybe_unused Arnd Bergmann
                   ` (14 subsequent siblings)
  36 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Liviu Dudau, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Daniel Vetter,
	James Qian Wang (Arm Technology China)
  Cc: Arnd Bergmann, Rob Herring, dri-devel

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 576832681891 ("arm/komeda: Compile komeda_debugfs_init() only if CONFIG_DEBUG_FS is enabled")
Fixes: 7d3cfb70a604 ("drm/komeda: Add debugfs node "register" for register dump")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
index 14ee79becacb..5ba62e637a61 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
@@ -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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 23/34] firmware: qcom_scm: mark qcom_scm_qseecom_allowlist as __maybe_unused
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (21 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 22/34] drm/komeda: don't warn for unused debugfs files Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:31   ` Krzysztof Kozlowski
  2024-04-03  8:06 ` [PATCH 24/34] crypto: ccp - drop platform ifdef checks Arnd Bergmann
                   ` (13 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Bjorn Andersson, Konrad Dybcio, Maximilian Luz,
	Johan Hovold
  Cc: Arnd Bergmann, Bartosz Golaszewski, Krzysztof Kozlowski,
	Kathiravan Thirumoorthy, Guru Das Srinagesh, Robert Marko,
	linux-arm-msm

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 00b1248606ba ("firmware: qcom_scm: Add support for Qualcomm Secure Execution Environment SCM interface")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/firmware/qcom/qcom_scm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
index 49ddbcab0680..81c15aeff934 100644
--- a/drivers/firmware/qcom/qcom_scm.c
+++ b/drivers/firmware/qcom/qcom_scm.c
@@ -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", },
 	{ }
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 24/34] crypto: ccp - drop platform ifdef checks
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (22 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 23/34] firmware: qcom_scm: mark qcom_scm_qseecom_allowlist as __maybe_unused Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03 15:17   ` Tom Lendacky
  2024-04-12  7:30   ` Herbert Xu
  2024-04-03  8:06 ` [PATCH 25/34] usb: gadget: omap_udc: remove unused variable Arnd Bergmann
                   ` (12 subsequent siblings)
  36 siblings, 2 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Tom Lendacky, John Allen, Herbert Xu,
	David S. Miller
  Cc: Arnd Bergmann, Uwe Kleine-König, linux-crypto

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 6c5063434098 ("crypto: ccp - Add ACPI support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/crypto/ccp/sp-platform.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c
index 473301237760..ff6ceb4feee0 100644
--- a/drivers/crypto/ccp/sp-platform.c
+++ b/drivers/crypto/ccp/sp-platform.c
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 25/34] usb: gadget: omap_udc: remove unused variable
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (23 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 24/34] crypto: ccp - drop platform ifdef checks Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-05 22:51   ` Aaro Koskinen
  2024-04-03  8:06 ` [PATCH 26/34] isdn: kcapi: don't build unused procfs code Arnd Bergmann
                   ` (11 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Greg Kroah-Hartman
  Cc: Arnd Bergmann, Uwe Kleine-König, Aaro Koskinen, linux-usb

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/gadget/udc/omap_udc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c
index f90eeecf27de..e13b8ec8ef8a 100644
--- a/drivers/usb/gadget/udc/omap_udc.c
+++ b/drivers/usb/gadget/udc/omap_udc.c
@@ -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");
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 26/34] isdn: kcapi: don't build unused procfs code
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (24 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 25/34] usb: gadget: omap_udc: remove unused variable Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 27/34] cpufreq: intel_pstate: hide unused intel_pstate_cpu_oob_ids[] Arnd Bergmann
                   ` (10 subsequent siblings)
  36 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel; +Cc: Arnd Bergmann, Karsten Keil, Kees Cook, Justin Stitt, netdev

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/isdn/capi/Makefile | 3 ++-
 drivers/isdn/capi/kcapi.c  | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/capi/Makefile b/drivers/isdn/capi/Makefile
index 352217ebabd8..4fd3a4d7133f 100644
--- a/drivers/isdn/capi/Makefile
+++ b/drivers/isdn/capi/Makefile
@@ -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
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index 136ba9fe55e0..c5d13bdc239b 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 27/34] cpufreq: intel_pstate: hide unused intel_pstate_cpu_oob_ids[]
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (25 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 26/34] isdn: kcapi: don't build unused procfs code Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03 14:43   ` Rafael J. Wysocki
  2024-04-03  8:06 ` [PATCH 28/34] net: xgbe: remove extraneous #ifdef checks Arnd Bergmann
                   ` (9 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Srinivas Pandruvada, Len Brown, Rafael J. Wysocki,
	Viresh Kumar
  Cc: Arnd Bergmann, Doug Smythies, Zhenguo Yao, Tero Kristo,
	Jiri Slaby (SUSE), linux-pm

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
 drivers/cpufreq/intel_pstate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index dbbf299f4219..29ce9edc6f68 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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),
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 28/34] net: xgbe: remove extraneous #ifdef checks
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (26 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 27/34] cpufreq: intel_pstate: hide unused intel_pstate_cpu_oob_ids[] Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 29/34] Input: imagis - remove incorrect ifdef checks Arnd Bergmann
                   ` (8 subsequent siblings)
  36 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Shyam Sundar S K, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Arnd Bergmann, Uwe Kleine-König, Rob Herring, netdev

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-platform.c b/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
index 9131020d06af..7912b3b45148 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 29/34] Input: imagis - remove incorrect ifdef checks
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (27 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 28/34] net: xgbe: remove extraneous #ifdef checks Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:06 ` [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks Arnd Bergmann
                   ` (7 subsequent siblings)
  36 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Markuss Broks, Dmitry Torokhov, Karel Balej
  Cc: Arnd Bergmann, Duje Mihanović, Uwe Kleine-König,
	linux-input

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 10ad7d7a428f ("input/touchscreen: imagis: Add support for Imagis IST3038B")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/input/touchscreen/imagis.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c
index 074dd6c342ec..d09b10f77a19 100644
--- a/drivers/input/touchscreen/imagis.c
+++ b/drivers/input/touchscreen/imagis.c
@@ -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,
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (28 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 29/34] Input: imagis - remove incorrect ifdef checks Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  8:29   ` Damien Le Moal
                     ` (2 more replies)
  2024-04-03  8:06 ` [PATCH 31/34] spi: remove incorrect of_match_ptr annotations Arnd Bergmann
                   ` (6 subsequent siblings)
  36 siblings, 3 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Damien Le Moal, Niklas Cassel, Saeed Bishara
  Cc: Arnd Bergmann, Ma Ke, Uwe Kleine-König, Sergey Shtylyov,
	Christophe JAILLET, Jeff Garzik, linux-ide

From: Arnd Bergmann <arnd@arndb.de>

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.

Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/ata/sata_mv.c | 64 +++++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index e82786c63fbd..697063890f5d 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -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);
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (29 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:04   ` Andy Shevchenko
                     ` (2 more replies)
  2024-04-03  8:06 ` [PATCH 32/34] ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations Arnd Bergmann
                   ` (5 subsequent siblings)
  36 siblings, 3 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Mark Brown, Neil Armstrong, Kevin Hilman,
	Heiko Stuebner, Andi Shyti, Krzysztof Kozlowski
  Cc: Arnd Bergmann, Jerome Brunet, Martin Blumenstingl, Alim Akhtar,
	Li Zetao, Jonathan Cameron, Rob Herring, Yang Yingliang,
	Andy Shevchenko, Luis de Arquer, Tudor Ambarus, Sam Protsenko,
	Peter Griffin, Jaewon Kim, linux-spi, linux-arm-kernel,
	linux-amlogic, linux-rockchip, linux-samsung-soc

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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(-)

diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c
index 3c9ed412932f..2fc2e7c0daf2 100644
--- a/drivers/spi/spi-armada-3700.c
+++ b/drivers/spi/spi-armada-3700.c
@@ -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,
 };
diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
index d8360f94d3b7..0d7f89301f8d 100644
--- a/drivers/spi/spi-img-spfi.c
+++ b/drivers/spi/spi-img-spfi.c
@@ -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,
diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index fc75492e50ff..4189d4434e37 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -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,
 	},
 };
 
diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c
index fd8b26dd4a79..0c39d59d0af8 100644
--- a/drivers/spi/spi-meson-spifc.c
+++ b/drivers/spi/spi-meson-spifc.c
@@ -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,
 	},
 };
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index eee9ff4bfa5b..a0029e8dc0be 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -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,
diff --git a/drivers/spi/spi-pic32-sqi.c b/drivers/spi/spi-pic32-sqi.c
index 3f1e5b27776b..458c1a8d5719 100644
--- a/drivers/spi/spi-pic32-sqi.c
+++ b/drivers/spi/spi-pic32-sqi.c
@@ -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,
diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
index 709edb70ad7d..e8bd32c1fc7c 100644
--- a/drivers/spi/spi-pic32.c
+++ b/drivers/spi/spi-pic32.c
@@ -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,
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index e1ecd96c7858..4dbb5127a9e5 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -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,
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index f726d8670428..dbb89f6cb3dd 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -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,
diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c
index e064025e2fd6..6d288497c500 100644
--- a/drivers/spi/spi-st-ssc4.c
+++ b/drivers/spi/spi-st-ssc4.c
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 32/34] ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (30 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 31/34] spi: remove incorrect of_match_ptr annotations Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:06   ` Krzysztof Kozlowski
  2024-04-03  9:15   ` Andy Shevchenko
  2024-04-03  8:06 ` [PATCH 33/34] drivers: " Arnd Bergmann
                   ` (4 subsequent siblings)
  36 siblings, 2 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Claudiu Beznea, Nicolas Ferre, Alexandre Belloni,
	Oder Chiou, Srinivas Kandagatla, Banajit Goswami,
	Sylwester Nawrocki
  Cc: Arnd Bergmann, Alper Nebi Yasak, Kuninori Morimoto, Akihiko Odaki,
	Linus Walleij, Yinchuan Guo, Uwe Kleine-König, Rob Herring,
	AngeloGioacchino Del Regno, Krzysztof Kozlowski, linux-sound,
	alsa-devel, linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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(-)

diff --git a/sound/soc/amd/acp3x-rt5682-max9836.c b/sound/soc/amd/acp3x-rt5682-max9836.c
index d6cdb6d9fdd6..ffc105759994 100644
--- a/sound/soc/amd/acp3x-rt5682-max9836.c
+++ b/sound/soc/amd/acp3x-rt5682-max9836.c
@@ -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,
diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c
index d1c1f370a9cd..95c8c37478a3 100644
--- a/sound/soc/atmel/sam9x5_wm8731.c
+++ b/sound/soc/atmel/sam9x5_wm8731.c
@@ -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,
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c
index f475c8cfadae..da397db8d7d5 100644
--- a/sound/soc/codecs/rt5514-spi.c
+++ b/sound/soc/codecs/rt5514-spi.c
@@ -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,
 };
diff --git a/sound/soc/qcom/lpass-sc7280.c b/sound/soc/qcom/lpass-sc7280.c
index 47c622327a8d..c91620128fd4 100644
--- a/sound/soc/qcom/lpass-sc7280.c
+++ b/sound/soc/qcom/lpass-sc7280.c
@@ -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,
diff --git a/sound/soc/samsung/aries_wm8994.c b/sound/soc/samsung/aries_wm8994.c
index a548ac33dd94..9f7318c4ee33 100644
--- a/sound/soc/samsung/aries_wm8994.c
+++ b/sound/soc/samsung/aries_wm8994.c
@@ -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,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (31 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 32/34] ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:13   ` Krzysztof Kozlowski
                     ` (6 more replies)
  2024-04-03  8:06 ` [PATCH 34/34] kbuild: always enable -Wunused-const-variable Arnd Bergmann
                   ` (3 subsequent siblings)
  36 siblings, 7 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Corey Minyard, Peter Huewe, Jarkko Sakkinen,
	Vinod Koul, Moritz Fischer, Wu Hao, Xu Yilun, Jiri Kosina,
	Benjamin Tissoires, Michael Hennerich, Peter Rosin,
	Dmitry Torokhov, Iyappan Subramanian, Keyur Chudgar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Yisen Zhuang, Salil Mehta, Tony Lindgren, Liam Girdwood,
	Mark Brown, Alexandre Belloni, Xiang Chen, James E.J. Bottomley,
	Martin K. Petersen, Greg Kroah-Hartman, Russell King, Jiri Slaby,
	Jacky Huang, Shan-Chun Hung
  Cc: Arnd Bergmann, Jason Gunthorpe, Tom Rix, Uwe Kleine-König,
	Randy Dunlap, Rob Herring, Linus Walleij, openipmi-developer,
	linux-integrity, dmaengine, linux-fpga, linux-input, linux-i2c,
	netdev, linux-omap, linux-rtc, linux-scsi, linux-staging,
	linux-serial, linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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(-)

diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c
index 49100845fcb7..5e7bfc7c26e2 100644
--- a/drivers/char/ipmi/ipmb_dev_int.c
+++ b/drivers/char/ipmi/ipmb_dev_int.c
@@ -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,
diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
index 2ea4882251cf..0c453f3f928d 100644
--- a/drivers/char/tpm/tpm_ftpm_tee.c
+++ b/drivers/char/tpm/tpm_ftpm_tee.c
@@ -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,
diff --git a/drivers/dma/img-mdc-dma.c b/drivers/dma/img-mdc-dma.c
index 0532dd2640dc..6931c8a65415 100644
--- a/drivers/dma/img-mdc-dma.c
+++ b/drivers/dma/img-mdc-dma.c
@@ -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,
diff --git a/drivers/fpga/versal-fpga.c b/drivers/fpga/versal-fpga.c
index 3710e8f01be2..e6189106c468 100644
--- a/drivers/fpga/versal-fpga.c
+++ b/drivers/fpga/versal-fpga.c
@@ -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);
diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
index c6bdb9c4ef3e..886cc5748b7d 100644
--- a/drivers/hid/hid-google-hammer.c
+++ b/drivers/hid/hid-google-hammer.c
@@ -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,
 	},
 };
diff --git a/drivers/i2c/muxes/i2c-mux-ltc4306.c b/drivers/i2c/muxes/i2c-mux-ltc4306.c
index 23766d853e76..c6d70788161a 100644
--- a/drivers/i2c/muxes/i2c-mux-ltc4306.c
+++ b/drivers/i2c/muxes/i2c-mux-ltc4306.c
@@ -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,
diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c
index 8489971babd3..0f1b39964743 100644
--- a/drivers/i2c/muxes/i2c-mux-reg.c
+++ b/drivers/i2c/muxes/i2c-mux-reg.c
@@ -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,
 	},
 };
 
diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c
index 32c7be54434c..9f3a4092e47c 100644
--- a/drivers/input/touchscreen/wdt87xx_i2c.c
+++ b/drivers/input/touchscreen/wdt87xx_i2c.c
@@ -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);
diff --git a/drivers/mux/adg792a.c b/drivers/mux/adg792a.c
index 4da5aecb9fc6..a5afe29e3cf1 100644
--- a/drivers/mux/adg792a.c
+++ b/drivers/mux/adg792a.c
@@ -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,
diff --git a/drivers/net/ethernet/apm/xgene-v2/main.c b/drivers/net/ethernet/apm/xgene-v2/main.c
index 9e90c2381491..64370057ba3d 100644
--- a/drivers/net/ethernet/apm/xgene-v2/main.c
+++ b/drivers/net/ethernet/apm/xgene-v2/main.c
@@ -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,
diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c
index ed73707176c1..f8caf59bd759 100644
--- a/drivers/net/ethernet/hisilicon/hns_mdio.c
+++ b/drivers/net/ethernet/hisilicon/hns_mdio.c
@@ -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,
 		   },
 };
 
diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c
index cd5a0d7e4455..2eeb99e7b850 100644
--- a/drivers/regulator/pbias-regulator.c
+++ b/drivers/regulator/pbias-regulator.c
@@ -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,
 	},
 };
 
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 5bacfcebf59a..4ed91e88e1eb 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -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,
 	},
 };
 
diff --git a/drivers/regulator/twl6030-regulator.c b/drivers/regulator/twl6030-regulator.c
index 6eed0f6e0adb..8a84048a66d7 100644
--- a/drivers/regulator/twl6030-regulator.c
+++ b/drivers/regulator/twl6030-regulator.c
@@ -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,
 	},
 };
 
diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c
index a72c4ad0cec6..12da7d36e520 100644
--- a/drivers/rtc/rtc-fsl-ftm-alarm.c
+++ b/drivers/rtc/rtc-fsl-ftm-alarm.c
@@ -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,
 	},
 };
 
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
index 161feae3acab..c6f313c9605b 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
@@ -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,
 	},
 };
 
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index d89e97e8f5c2..ce3b5e1680f5 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -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,
 	},
 };
 
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 81de98c0245a..30fd6da3e8d8 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -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,
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 2fa3fb30dc6c..dd1d1a2cc5f5 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -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),
 	},
 };
diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c
index 19f0a305cc43..e326d0fb06b2 100644
--- a/drivers/tty/serial/ma35d1_serial.c
+++ b/drivers/tty/serial/ma35d1_serial.c
@@ -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,
 	},
 };
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* [PATCH 34/34] kbuild: always enable -Wunused-const-variable
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (32 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 33/34] drivers: " Arnd Bergmann
@ 2024-04-03  8:06 ` Arnd Bergmann
  2024-04-03  9:19   ` Andy Shevchenko
  2024-04-06  5:20 ` [PATCH 00/34] address all -Wunused-const warnings patchwork-bot+netdevbpf
                   ` (2 subsequent siblings)
  36 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:06 UTC (permalink / raw
  To: linux-kernel, Masahiro Yamada
  Cc: Arnd Bergmann, Nathan Chancellor, Nicolas Schier, linux-kbuild

From: Arnd Bergmann <arnd@arndb.de>

The last such warnings are fixed now, so the option can be enabled by default.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/Makefile.extrawarn | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 24d29e477644..a534aba0b97a 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -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
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 100+ messages in thread

* Re: [PATCH 01/34] powerpc/fsl-soc: hide unused const variable
  2024-04-03  8:06 ` [PATCH 01/34] powerpc/fsl-soc: hide unused const variable Arnd Bergmann
@ 2024-04-03  8:19   ` Christophe Leroy
  0 siblings, 0 replies; 100+ messages in thread
From: Christophe Leroy @ 2024-04-03  8:19 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel@vger.kernel.org, Michael Ellerman,
	Alexander Graf, Stuart Yoder, Scott Wood
  Cc: Arnd Bergmann, Nicholas Piggin, Aneesh Kumar K.V, Naveen N. Rao,
	Uwe Kleine-König, Rob Herring, linuxppc-dev@lists.ozlabs.org



Le 03/04/2024 à 10:06, Arnd Bergmann a écrit :
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Fixes: 305bcf26128e ("powerpc/fsl-soc: use CONFIG_EPAPR_PARAVIRT for hcalls")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
>   arch/powerpc/sysdev/fsl_msi.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
> index 8e6c84df4ca1..e205135ae1fe 100644
> --- a/arch/powerpc/sysdev/fsl_msi.c
> +++ b/arch/powerpc/sysdev/fsl_msi.c
> @@ -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[] = {
>   	{

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
  2024-04-03  8:06 ` [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks Arnd Bergmann
@ 2024-04-03  8:29   ` Damien Le Moal
  2024-04-03  8:32   ` Damien Le Moal
  2024-04-03  9:10   ` Andy Shevchenko
  2 siblings, 0 replies; 100+ messages in thread
From: Damien Le Moal @ 2024-04-03  8:29 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Niklas Cassel, Saeed Bishara
  Cc: Arnd Bergmann, Ma Ke, Uwe Kleine-König, Sergey Shtylyov,
	Christophe JAILLET, Jeff Garzik, linux-ide

On 4/3/24 17:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Building with W=1 shows a warning for an unused variable when CONFIG_PCI
> is diabled:

s/diabled/disabled

> 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.

s/containsn/contains

But no need to resend, I will fix that when applying.

Thanks !

> 
> Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/ata/sata_mv.c | 64 +++++++++++++++++++++----------------------
>  1 file changed, 32 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index e82786c63fbd..697063890f5d 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -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);
>  

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
  2024-04-03  8:06 ` [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks Arnd Bergmann
  2024-04-03  8:29   ` Damien Le Moal
@ 2024-04-03  8:32   ` Damien Le Moal
  2024-04-03  8:50     ` Arnd Bergmann
  2024-04-03  9:10   ` Andy Shevchenko
  2 siblings, 1 reply; 100+ messages in thread
From: Damien Le Moal @ 2024-04-03  8:32 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Niklas Cassel, Saeed Bishara
  Cc: Arnd Bergmann, Ma Ke, Uwe Kleine-König, Sergey Shtylyov,
	Christophe JAILLET, Jeff Garzik, linux-ide

On 4/3/24 17:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

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

?

> ---
>  drivers/ata/sata_mv.c | 64 +++++++++++++++++++++----------------------
>  1 file changed, 32 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index e82786c63fbd..697063890f5d 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -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);
>  

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[]
  2024-04-03  8:06 ` [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[] Arnd Bergmann
@ 2024-04-03  8:41   ` Christophe Leroy
  2024-04-03  8:58     ` Arnd Bergmann
  0 siblings, 1 reply; 100+ messages in thread
From: Christophe Leroy @ 2024-04-03  8:41 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel@vger.kernel.org, Andrew Morton,
	Palmer Dabbelt
  Cc: Arnd Bergmann, Dave Hansen, Noah Goldstein, Charlie Jenkins



Le 03/04/2024 à 10:06, Arnd Bergmann a écrit :
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> 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:

diff --git a/lib/checksum_kunit.c b/lib/checksum_kunit.c
index bf70850035c7..1354953c8942 100644
--- a/lib/checksum_kunit.c
+++ b/lib/checksum_kunit.c
@@ -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[] = {


> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   lib/checksum_kunit.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/lib/checksum_kunit.c b/lib/checksum_kunit.c
> index bf70850035c7..80dd1e1b71ba 100644
> --- a/lib/checksum_kunit.c
> +++ b/lib/checksum_kunit.c
> @@ -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,

^ permalink raw reply related	[flat|nested] 100+ messages in thread

* Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
  2024-04-03  8:32   ` Damien Le Moal
@ 2024-04-03  8:50     ` Arnd Bergmann
  2024-04-04  3:45       ` Damien Le Moal
  0 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:50 UTC (permalink / raw
  To: Damien Le Moal, Arnd Bergmann, linux-kernel, Niklas Cassel,
	Saeed Bishara
  Cc: Ma Ke, Uwe Kleine-König, Sergey Shtylyov, Christophe JAILLET,
	Jeff Garzik, linux-ide

On Wed, Apr 3, 2024, at 10:32, Damien Le Moal wrote:
> On 4/3/24 17:06, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> 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.
>> 
>> Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> 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

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[]
  2024-04-03  8:41   ` Christophe Leroy
@ 2024-04-03  8:58     ` Arnd Bergmann
  2024-04-03  9:03       ` Christophe Leroy
  0 siblings, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  8:58 UTC (permalink / raw
  To: Christophe Leroy, Arnd Bergmann, linux-kernel@vger.kernel.org,
	Andrew Morton, Palmer Dabbelt
  Cc: Dave Hansen, Noah Goldstein, Charlie Jenkins

On Wed, Apr 3, 2024, at 10:41, Christophe Leroy wrote:
> Le 03/04/2024 à 10:06, Arnd Bergmann a écrit :
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> 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.
>> 
>> 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:
>
> +	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.

       Arnd

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 19/34] sunrpc: suppress warnings for unused procfs functions
  2024-04-03  8:06 ` [PATCH 19/34] sunrpc: suppress warnings for unused procfs functions Arnd Bergmann
@ 2024-04-03  8:59   ` Jeff Layton
  2024-04-03 13:20   ` Chuck Lever
  1 sibling, 0 replies; 100+ messages in thread
From: Jeff Layton @ 2024-04-03  8:59 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Trond Myklebust, Anna Schumaker,
	Chuck Lever, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, NeilBrown, J. Bruce Fields
  Cc: Arnd Bergmann, Olga Kornievskaia, Dai Ngo, Tom Talpey, linux-nfs,
	netdev

On Wed, 2024-04-03 at 10:06 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>
> ---
>  net/sunrpc/cache.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
> index 95ff74706104..ab3a57965dc0 100644
> --- a/net/sunrpc/cache.c
> +++ b/net/sunrpc/cache.c
> @@ -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)
>  {

Reviewed-by: Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 11/34] clk: ti: dpll: fix incorrect #ifdef checks
  2024-04-03  8:06 ` [PATCH 11/34] clk: ti: dpll: fix incorrect #ifdef checks Arnd Bergmann
@ 2024-04-03  9:00   ` Tony Lindgren
  2024-04-05 21:13   ` Stephen Boyd
  1 sibling, 0 replies; 100+ messages in thread
From: Tony Lindgren @ 2024-04-03  9:00 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Tero Kristo, Michael Turquette, Stephen Boyd,
	Arnd Bergmann, linux-omap, linux-clk

* Arnd Bergmann <arnd@kernel.org> [240403 08:18]:
> 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:

Reviewed-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[]
  2024-04-03  8:58     ` Arnd Bergmann
@ 2024-04-03  9:03       ` Christophe Leroy
  2024-04-04 11:43         ` Arnd Bergmann
  0 siblings, 1 reply; 100+ messages in thread
From: Christophe Leroy @ 2024-04-03  9:03 UTC (permalink / raw
  To: Arnd Bergmann, Arnd Bergmann, linux-kernel@vger.kernel.org,
	Andrew Morton, Palmer Dabbelt
  Cc: Dave Hansen, Noah Goldstein, Charlie Jenkins



Le 03/04/2024 à 10:58, Arnd Bergmann a écrit :
> On Wed, Apr 3, 2024, at 10:41, Christophe Leroy wrote:
>> Le 03/04/2024 à 10:06, Arnd Bergmann a écrit :
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> 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.
>>>
>>> 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:
>>
>> +	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

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
  2024-04-03  8:06 ` [PATCH 31/34] spi: remove incorrect of_match_ptr annotations Arnd Bergmann
@ 2024-04-03  9:04   ` Andy Shevchenko
  2024-04-03  9:05   ` Krzysztof Kozlowski
  2024-04-03  9:56   ` Mark Brown
  2 siblings, 0 replies; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03  9:04 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Mark Brown, Neil Armstrong, Kevin Hilman,
	Heiko Stuebner, Andi Shyti, Krzysztof Kozlowski, Arnd Bergmann,
	Jerome Brunet, Martin Blumenstingl, Alim Akhtar, Li Zetao,
	Jonathan Cameron, Rob Herring, Yang Yingliang, Luis de Arquer,
	Tudor Ambarus, Sam Protsenko, Peter Griffin, Jaewon Kim,
	linux-spi, linux-arm-kernel, linux-amlogic, linux-rockchip,
	linux-samsung-soc

On Wed, Apr 03, 2024 at 10:06:49AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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]

I would drop these 'drivers/spi/' parts as we know they are all in the same folder.

> 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.

LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
  2024-04-03  8:06 ` [PATCH 31/34] spi: remove incorrect of_match_ptr annotations Arnd Bergmann
  2024-04-03  9:04   ` Andy Shevchenko
@ 2024-04-03  9:05   ` Krzysztof Kozlowski
  2024-04-03  9:56   ` Mark Brown
  2 siblings, 0 replies; 100+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-03  9:05 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Mark Brown, Neil Armstrong,
	Kevin Hilman, Heiko Stuebner, Andi Shyti
  Cc: Arnd Bergmann, Jerome Brunet, Martin Blumenstingl, Alim Akhtar,
	Li Zetao, Jonathan Cameron, Rob Herring, Yang Yingliang,
	Andy Shevchenko, Luis de Arquer, Tudor Ambarus, Sam Protsenko,
	Peter Griffin, Jaewon Kim, linux-spi, linux-arm-kernel,
	linux-amlogic, linux-rockchip, linux-samsung-soc

On 03/04/2024 10:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

I think I already tried to fix all of these, but Mark rejected my patches:

https://lore.kernel.org/all/7a65d775-cf07-4393-8b10-2cef4d5266ab@sirena.org.uk/

All of the changes here look the same as my patchset, I also got there
some Acks.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 32/34] ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 ` [PATCH 32/34] ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations Arnd Bergmann
@ 2024-04-03  9:06   ` Krzysztof Kozlowski
  2024-04-03  9:15   ` Andy Shevchenko
  1 sibling, 0 replies; 100+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-03  9:06 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Claudiu Beznea, Nicolas Ferre,
	Alexandre Belloni, Oder Chiou, Srinivas Kandagatla,
	Banajit Goswami, Sylwester Nawrocki
  Cc: Arnd Bergmann, Alper Nebi Yasak, Kuninori Morimoto, Akihiko Odaki,
	Linus Walleij, Yinchuan Guo, Uwe Kleine-König, Rob Herring,
	AngeloGioacchino Del Regno, linux-sound, alsa-devel,
	linux-arm-kernel

On 03/04/2024 10:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  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/20230310214333.274903-5-krzysztof.kozlowski@linaro.org/

and Mark did not pick it up, I guess for the same reason as SPI.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 03/34] platform: goldfish: remove ACPI_PTR() annotations
  2024-04-03  8:06 ` [PATCH 03/34] platform: goldfish: remove ACPI_PTR() annotations Arnd Bergmann
@ 2024-04-03  9:08   ` Andy Shevchenko
  0 siblings, 0 replies; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03  9:08 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Alan Cox, Jason Hu, Greg Kroah-Hartman, Jin Qian,
	Arnd Bergmann, Uwe Kleine-König

On Wed, Apr 03, 2024 at 10:06:21AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

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
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
  2024-04-03  8:06 ` [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks Arnd Bergmann
  2024-04-03  8:29   ` Damien Le Moal
  2024-04-03  8:32   ` Damien Le Moal
@ 2024-04-03  9:10   ` Andy Shevchenko
  2 siblings, 0 replies; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03  9:10 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Damien Le Moal, Niklas Cassel, Saeed Bishara,
	Arnd Bergmann, Ma Ke, Uwe Kleine-König, Sergey Shtylyov,
	Christophe JAILLET, Jeff Garzik, linux-ide

On Wed, Apr 03, 2024 at 10:06:48AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

...

> +	{ }			/* terminate list */
> +};

> +

Too many blank lines now.

>  
>  static struct pci_driver mv_pci_driver = {
>  	.name			= DRV_NAME,

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 ` [PATCH 33/34] drivers: " Arnd Bergmann
@ 2024-04-03  9:13   ` Krzysztof Kozlowski
  2024-04-03  9:30   ` Andy Shevchenko
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 100+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-03  9:13 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Corey Minyard, Peter Huewe,
	Jarkko Sakkinen, Vinod Koul, Moritz Fischer, Wu Hao, Xu Yilun,
	Jiri Kosina, Benjamin Tissoires, Michael Hennerich, Peter Rosin,
	Dmitry Torokhov, Iyappan Subramanian, Keyur Chudgar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Yisen Zhuang, Salil Mehta, Tony Lindgren, Liam Girdwood,
	Mark Brown, Alexandre Belloni, Xiang Chen, James E.J. Bottomley,
	Martin K. Petersen, Greg Kroah-Hartman, Russell King, Jiri Slaby,
	Jacky Huang, Shan-Chun Hung
  Cc: Arnd Bergmann, Jason Gunthorpe, Tom Rix, Uwe Kleine-König,
	Randy Dunlap, Rob Herring, Linus Walleij, openipmi-developer,
	linux-integrity, dmaengine, linux-fpga, linux-input, linux-i2c,
	netdev, linux-omap, linux-rtc, linux-scsi, linux-staging,
	linux-serial, linux-arm-kernel

On 03/04/2024 10:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  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/20230310214553.275450-5-krzysztof.kozlowski@linaro.org/

but just like SPI and ASoC, Mark did not agree to pick them up.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 32/34] ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 ` [PATCH 32/34] ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations Arnd Bergmann
  2024-04-03  9:06   ` Krzysztof Kozlowski
@ 2024-04-03  9:15   ` Andy Shevchenko
  1 sibling, 0 replies; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03  9:15 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Claudiu Beznea, Nicolas Ferre, Alexandre Belloni,
	Oder Chiou, Srinivas Kandagatla, Banajit Goswami,
	Sylwester Nawrocki, Arnd Bergmann, Alper Nebi Yasak,
	Kuninori Morimoto, Akihiko Odaki, Linus Walleij, Yinchuan Guo,
	Uwe Kleine-König, Rob Herring, AngeloGioacchino Del Regno,
	Krzysztof Kozlowski, linux-sound, alsa-devel, linux-arm-kernel

On Wed, Apr 03, 2024 at 10:06:50AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

...

> index d6cdb6d9fdd6..ffc105759994 100644
> --- a/sound/soc/amd/acp3x-rt5682-max9836.c
> +++ b/sound/soc/amd/acp3x-rt5682-max9836.c
> @@ -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,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

...

The rest I haven't checked, it might be possible to do something similar there
as well.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 34/34] kbuild: always enable -Wunused-const-variable
  2024-04-03  8:06 ` [PATCH 34/34] kbuild: always enable -Wunused-const-variable Arnd Bergmann
@ 2024-04-03  9:19   ` Andy Shevchenko
  2024-04-03  9:26     ` Arnd Bergmann
  0 siblings, 1 reply; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03  9:19 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Masahiro Yamada, Arnd Bergmann, Nathan Chancellor,
	Nicolas Schier, linux-kbuild

On Wed, Apr 03, 2024 at 10:06:52AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The last such warnings are fixed now, so the option can be enabled by default.

> @@ -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)

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 34/34] kbuild: always enable -Wunused-const-variable
  2024-04-03  9:19   ` Andy Shevchenko
@ 2024-04-03  9:26     ` Arnd Bergmann
  0 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03  9:26 UTC (permalink / raw
  To: Andy Shevchenko, Arnd Bergmann
  Cc: linux-kernel, Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
	linux-kbuild

On Wed, Apr 3, 2024, at 11:19, Andy Shevchenko wrote:
> On Wed, Apr 03, 2024 at 10:06:52AM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> The last such warnings are fixed now, so the option can be enabled by default.
>
>> @@ -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)

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/20240326145140.3257163-3-arnd@kernel.org/

      Arnd

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 ` [PATCH 33/34] drivers: " Arnd Bergmann
  2024-04-03  9:13   ` Krzysztof Kozlowski
@ 2024-04-03  9:30   ` Andy Shevchenko
  2024-04-03 12:47     ` Corey Minyard
  2024-04-03 12:47   ` Corey Minyard
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03  9:30 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Corey Minyard, Peter Huewe, Jarkko Sakkinen,
	Vinod Koul, Moritz Fischer, Wu Hao, Xu Yilun, Jiri Kosina,
	Benjamin Tissoires, Michael Hennerich, Peter Rosin,
	Dmitry Torokhov, Iyappan Subramanian, Keyur Chudgar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Yisen Zhuang, Salil Mehta, Tony Lindgren, Liam Girdwood,
	Mark Brown, Alexandre Belloni, Xiang Chen, James E.J. Bottomley,
	Martin K. Petersen, Greg Kroah-Hartman, Russell King, Jiri Slaby,
	Jacky Huang, Shan-Chun Hung, Arnd Bergmann, Jason Gunthorpe,
	Tom Rix, Uwe Kleine-König, Randy Dunlap, Rob Herring,
	Linus Walleij, openipmi-developer, linux-integrity, dmaengine,
	linux-fpga, linux-input, linux-i2c, netdev, linux-omap, linux-rtc,
	linux-scsi, linux-staging, linux-serial, linux-arm-kernel

On Wed, Apr 03, 2024 at 10:06:51AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

Can we split to three groups:
- Dropping ACPI_PTR()
- Dropping of_match_ptr() (which I won't review in depth, for example)
- Dropping both
?

...

> --- a/drivers/char/ipmi/ipmb_dev_int.c
> +++ b/drivers/char/ipmi/ipmb_dev_int.c
> @@ -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.

...

> --- a/drivers/hid/hid-google-hammer.c
> +++ b/drivers/hid/hid-google-hammer.c
> @@ -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,
>  	},
>  };

Ditto, and likely of.h can be also dropped.

...

> --- a/drivers/input/touchscreen/wdt87xx_i2c.c
> +++ b/drivers/input/touchscreen/wdt87xx_i2c.c
> @@ -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.

...

> --- a/drivers/net/ethernet/apm/xgene-v2/main.c
> +++ b/drivers/net/ethernet/apm/xgene-v2/main.c
> @@ -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.

...

> --- a/drivers/rtc/rtc-fsl-ftm-alarm.c
> +++ b/drivers/rtc/rtc-fsl-ftm-alarm.c
> @@ -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.

...

>  	.driver = {
>  		.name =		"pi433",
>  		.owner =	THIS_MODULE,

Oh-oh.

> -		.of_match_table = of_match_ptr(pi433_dt_ids),
> +		.of_match_table = pi433_dt_ids,
>  	},

...

> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -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),
>  	},
>  };

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 <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 23/34] firmware: qcom_scm: mark qcom_scm_qseecom_allowlist as __maybe_unused
  2024-04-03  8:06 ` [PATCH 23/34] firmware: qcom_scm: mark qcom_scm_qseecom_allowlist as __maybe_unused Arnd Bergmann
@ 2024-04-03  9:31   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 100+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-03  9:31 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Bjorn Andersson, Konrad Dybcio,
	Maximilian Luz, Johan Hovold
  Cc: Arnd Bergmann, Bartosz Golaszewski, Kathiravan Thirumoorthy,
	Guru Das Srinagesh, Robert Marko, linux-arm-msm

On 03/04/2024 10:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Fixes: 00b1248606ba ("firmware: qcom_scm: Add support for Qualcomm Secure Execution Environment SCM interface")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

I already fixed this and have an Ack:
https://lore.kernel.org/all/20231120185623.338608-1-krzysztof.kozlowski@linaro.org/

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


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n
  2024-04-03  8:06 ` [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n Arnd Bergmann
@ 2024-04-03  9:33   ` Andy Shevchenko
  2024-04-03 14:26   ` Jeff Johnson
  1 sibling, 0 replies; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03  9:33 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Stanislaw Gruszka, Kalle Valo, Arnd Bergmann,
	linux-wireless

On Wed, Apr 03, 2024 at 10:06:39AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

...

> +	.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?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
  2024-04-03  8:06 ` [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver Arnd Bergmann
@ 2024-04-03  9:36   ` Andy Shevchenko
  2024-04-03  9:55   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03  9:36 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Arnd Bergmann, linux-iio

On Wed, Apr 03, 2024 at 10:06:34AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
  2024-04-03  8:06 ` [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused Arnd Bergmann
@ 2024-04-03  9:40   ` Andy Shevchenko
  2024-04-03  9:52     ` Krzysztof Kozlowski
  2024-04-03 13:17   ` Uwe Kleine-König
  1 sibling, 1 reply; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03  9:40 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Dmitry Torokhov, Maxime Coquelin, Alexandre Torgue,
	Krzysztof Kozlowski, Arnd Bergmann, Uwe Kleine-König,
	linux-input, linux-stm32, linux-arm-kernel

On Wed, Apr 03, 2024 at 10:06:25AM +0200, Arnd Bergmann wrote:
> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> 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]

...

> -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?

>  	{ .compatible = "st,stmpe-ts", },
>  	{ },
>  };

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 14/34] dma/congiguous: avoid warning about unused size_bytes
  2024-04-03  8:06 ` [PATCH 14/34] dma/congiguous: avoid warning about unused size_bytes Arnd Bergmann
@ 2024-04-03  9:42   ` Christoph Hellwig
  0 siblings, 0 replies; 100+ messages in thread
From: Christoph Hellwig @ 2024-04-03  9:42 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Christoph Hellwig, Marek Szyprowski, Arnd Bergmann,
	Kyungmin Park, Michal Nazarewicz, Robin Murphy, Yajun Deng,
	Binglei Wang, Anshuman Khandual, Andrew Morton, Zhenhua Huang,
	iommu

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.

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
  2024-04-03  9:40   ` Andy Shevchenko
@ 2024-04-03  9:52     ` Krzysztof Kozlowski
  2024-04-03 10:03       ` Andy Shevchenko
  0 siblings, 1 reply; 100+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-03  9:52 UTC (permalink / raw
  To: Andy Shevchenko, Arnd Bergmann
  Cc: linux-kernel, Dmitry Torokhov, Maxime Coquelin, Alexandre Torgue,
	Arnd Bergmann, Uwe Kleine-König, linux-input, linux-stm32,
	linux-arm-kernel

On 03/04/2024 11:40, Andy Shevchenko wrote:
> On Wed, Apr 03, 2024 at 10:06:25AM +0200, Arnd Bergmann wrote:
>> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
>> 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]
> 
> ...
> 
>> -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


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
  2024-04-03  8:06 ` [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver Arnd Bergmann
  2024-04-03  9:36   ` Andy Shevchenko
@ 2024-04-03  9:55   ` Krzysztof Kozlowski
  2024-04-03 10:01     ` Arnd Bergmann
  2024-04-06 15:31     ` Jonathan Cameron
  1 sibling, 2 replies; 100+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-03  9:55 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron
  Cc: Arnd Bergmann, linux-iio

On 03/04/2024 10:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/iio/dac/ad5755.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
> index 404865e35460..5c1e7f428c25 100644
> --- a/drivers/iio/dac/ad5755.c
> +++ b/drivers/iio/dac/ad5755.c
> @@ -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


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
  2024-04-03  8:06 ` [PATCH 31/34] spi: remove incorrect of_match_ptr annotations Arnd Bergmann
  2024-04-03  9:04   ` Andy Shevchenko
  2024-04-03  9:05   ` Krzysztof Kozlowski
@ 2024-04-03  9:56   ` Mark Brown
  2024-04-03 21:05     ` Uwe Kleine-König
  2 siblings, 1 reply; 100+ messages in thread
From: Mark Brown @ 2024-04-03  9:56 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Neil Armstrong, Kevin Hilman, Heiko Stuebner,
	Andi Shyti, Krzysztof Kozlowski, Arnd Bergmann, Jerome Brunet,
	Martin Blumenstingl, Alim Akhtar, Li Zetao, Jonathan Cameron,
	Rob Herring, Yang Yingliang, Andy Shevchenko, Luis de Arquer,
	Tudor Ambarus, Sam Protsenko, Peter Griffin, Jaewon Kim,
	linux-spi, linux-arm-kernel, linux-amlogic, linux-rockchip,
	linux-samsung-soc

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

On Wed, Apr 03, 2024 at 10:06:49AM +0200, Arnd Bergmann wrote:

> 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.

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
  2024-04-03  9:55   ` Krzysztof Kozlowski
@ 2024-04-03 10:01     ` Arnd Bergmann
  2024-04-06 15:30       ` Jonathan Cameron
  2024-04-06 15:31     ` Jonathan Cameron
  1 sibling, 1 reply; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03 10:01 UTC (permalink / raw
  To: Krzysztof Kozlowski, Arnd Bergmann, linux-kernel,
	Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron
  Cc: linux-iio

On Wed, Apr 3, 2024, at 11:55, Krzysztof Kozlowski wrote:
> On 03/04/2024 10:06, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> 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.
>> 
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  drivers/iio/dac/ad5755.c | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
>> index 404865e35460..5c1e7f428c25 100644
>> --- a/drivers/iio/dac/ad5755.c
>> +++ b/drivers/iio/dac/ad5755.c
>> @@ -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.

Yes, that looks good as well, though you might need to drop
spi_device_id table if you convert it to using pointers.

     Arnd

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
  2024-04-03  9:52     ` Krzysztof Kozlowski
@ 2024-04-03 10:03       ` Andy Shevchenko
  2024-04-03 10:10         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03 10:03 UTC (permalink / raw
  To: Krzysztof Kozlowski
  Cc: Arnd Bergmann, linux-kernel, Dmitry Torokhov, Maxime Coquelin,
	Alexandre Torgue, Arnd Bergmann, Uwe Kleine-König,
	linux-input, linux-stm32, linux-arm-kernel

On Wed, Apr 03, 2024 at 11:52:12AM +0200, Krzysztof Kozlowski wrote:
> On 03/04/2024 11:40, Andy Shevchenko wrote:
> > On Wed, Apr 03, 2024 at 10:06:25AM +0200, Arnd Bergmann wrote:

...

> >> -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?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
  2024-04-03 10:03       ` Andy Shevchenko
@ 2024-04-03 10:10         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 100+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-03 10:10 UTC (permalink / raw
  To: Andy Shevchenko
  Cc: Arnd Bergmann, linux-kernel, Dmitry Torokhov, Maxime Coquelin,
	Alexandre Torgue, Arnd Bergmann, Uwe Kleine-König,
	linux-input, linux-stm32, linux-arm-kernel

On 03/04/2024 12:03, Andy Shevchenko wrote:
> On Wed, Apr 03, 2024 at 11:52:12AM +0200, Krzysztof Kozlowski wrote:
>> On 03/04/2024 11:40, Andy Shevchenko wrote:
>>> On Wed, Apr 03, 2024 at 10:06:25AM +0200, Arnd Bergmann wrote:
> 
> ...
> 
>>>> -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?

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


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 12/34] apm-emulation: hide an unused variable
  2024-04-03  8:06 ` [PATCH 12/34] apm-emulation: hide an unused variable Arnd Bergmann
@ 2024-04-03 12:23   ` Jiri Kosina
  0 siblings, 0 replies; 100+ messages in thread
From: Jiri Kosina @ 2024-04-03 12:23 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Arnd Bergmann, Greg Kroah-Hartman, Ralf Baechle

On Wed, 3 Apr 2024, Arnd Bergmann wrote:

> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Fixes: 7726942fb15e ("[APM] Add shared version of APM emulation")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/char/apm-emulation.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c
> index e795390b070f..53ce352f7197 100644
> --- a/drivers/char/apm-emulation.c
> +++ b/drivers/char/apm-emulation.c
> @@ -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;

Heh, I really should mark this driver as Orphaned. Anyway, for this 
particular patch:

	Acked-by: Jiri Kosina <jkosina@suse.com>

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 13/34] sisfb: hide unused variables
  2024-04-03  8:06 ` [PATCH 13/34] sisfb: hide unused variables Arnd Bergmann
@ 2024-04-03 12:39   ` Helge Deller
  0 siblings, 0 replies; 100+ messages in thread
From: Helge Deller @ 2024-04-03 12:39 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Arnd Bergmann,
	Bartlomiej Zolnierkiewicz
  Cc: linux-fbdev, dri-devel

On 4/3/24 10:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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=]
> ...
> Fixes: 5908986ef348 ("video: fbdev: sis: avoid mismatched prototypes")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/video/fbdev/sis/init301.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

applied to fbdev git tree.

Thanks!
Helge

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 ` [PATCH 33/34] drivers: " Arnd Bergmann
  2024-04-03  9:13   ` Krzysztof Kozlowski
  2024-04-03  9:30   ` Andy Shevchenko
@ 2024-04-03 12:47   ` Corey Minyard
  2024-04-03 16:09   ` Jarkko Sakkinen
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 100+ messages in thread
From: Corey Minyard @ 2024-04-03 12:47 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Peter Huewe, Jarkko Sakkinen, Vinod Koul,
	Moritz Fischer, Wu Hao, Xu Yilun, Jiri Kosina, Benjamin Tissoires,
	Michael Hennerich, Peter Rosin, Dmitry Torokhov,
	Iyappan Subramanian, Keyur Chudgar, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Yisen Zhuang, Salil Mehta,
	Tony Lindgren, Liam Girdwood, Mark Brown, Alexandre Belloni,
	Xiang Chen, James E.J. Bottomley, Martin K. Petersen,
	Greg Kroah-Hartman, Russell King, Jiri Slaby, Jacky Huang,
	Shan-Chun Hung, Arnd Bergmann, Jason Gunthorpe, Tom Rix,
	Uwe Kleine-König, Randy Dunlap, Rob Herring, Linus Walleij,
	openipmi-developer, linux-integrity, dmaengine, linux-fpga,
	linux-input, linux-i2c, netdev, linux-omap, linux-rtc, linux-scsi,
	linux-staging, linux-serial, linux-arm-kernel

On Wed, Apr 03, 2024 at 10:06:51AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

For the IPMI part:

Acked-by: Corey Minyard <minyard@acm.org>

> ---
>  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(-)
> 
> diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c
> index 49100845fcb7..5e7bfc7c26e2 100644
> --- a/drivers/char/ipmi/ipmb_dev_int.c
> +++ b/drivers/char/ipmi/ipmb_dev_int.c
> @@ -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,
> diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
> index 2ea4882251cf..0c453f3f928d 100644
> --- a/drivers/char/tpm/tpm_ftpm_tee.c
> +++ b/drivers/char/tpm/tpm_ftpm_tee.c
> @@ -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,
> diff --git a/drivers/dma/img-mdc-dma.c b/drivers/dma/img-mdc-dma.c
> index 0532dd2640dc..6931c8a65415 100644
> --- a/drivers/dma/img-mdc-dma.c
> +++ b/drivers/dma/img-mdc-dma.c
> @@ -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,
> diff --git a/drivers/fpga/versal-fpga.c b/drivers/fpga/versal-fpga.c
> index 3710e8f01be2..e6189106c468 100644
> --- a/drivers/fpga/versal-fpga.c
> +++ b/drivers/fpga/versal-fpga.c
> @@ -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);
> diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
> index c6bdb9c4ef3e..886cc5748b7d 100644
> --- a/drivers/hid/hid-google-hammer.c
> +++ b/drivers/hid/hid-google-hammer.c
> @@ -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,
>  	},
>  };
> diff --git a/drivers/i2c/muxes/i2c-mux-ltc4306.c b/drivers/i2c/muxes/i2c-mux-ltc4306.c
> index 23766d853e76..c6d70788161a 100644
> --- a/drivers/i2c/muxes/i2c-mux-ltc4306.c
> +++ b/drivers/i2c/muxes/i2c-mux-ltc4306.c
> @@ -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,
> diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c
> index 8489971babd3..0f1b39964743 100644
> --- a/drivers/i2c/muxes/i2c-mux-reg.c
> +++ b/drivers/i2c/muxes/i2c-mux-reg.c
> @@ -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,
>  	},
>  };
>  
> diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c
> index 32c7be54434c..9f3a4092e47c 100644
> --- a/drivers/input/touchscreen/wdt87xx_i2c.c
> +++ b/drivers/input/touchscreen/wdt87xx_i2c.c
> @@ -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);
> diff --git a/drivers/mux/adg792a.c b/drivers/mux/adg792a.c
> index 4da5aecb9fc6..a5afe29e3cf1 100644
> --- a/drivers/mux/adg792a.c
> +++ b/drivers/mux/adg792a.c
> @@ -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,
> diff --git a/drivers/net/ethernet/apm/xgene-v2/main.c b/drivers/net/ethernet/apm/xgene-v2/main.c
> index 9e90c2381491..64370057ba3d 100644
> --- a/drivers/net/ethernet/apm/xgene-v2/main.c
> +++ b/drivers/net/ethernet/apm/xgene-v2/main.c
> @@ -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,
> diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c
> index ed73707176c1..f8caf59bd759 100644
> --- a/drivers/net/ethernet/hisilicon/hns_mdio.c
> +++ b/drivers/net/ethernet/hisilicon/hns_mdio.c
> @@ -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,
>  		   },
>  };
>  
> diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c
> index cd5a0d7e4455..2eeb99e7b850 100644
> --- a/drivers/regulator/pbias-regulator.c
> +++ b/drivers/regulator/pbias-regulator.c
> @@ -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,
>  	},
>  };
>  
> diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
> index 5bacfcebf59a..4ed91e88e1eb 100644
> --- a/drivers/regulator/twl-regulator.c
> +++ b/drivers/regulator/twl-regulator.c
> @@ -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,
>  	},
>  };
>  
> diff --git a/drivers/regulator/twl6030-regulator.c b/drivers/regulator/twl6030-regulator.c
> index 6eed0f6e0adb..8a84048a66d7 100644
> --- a/drivers/regulator/twl6030-regulator.c
> +++ b/drivers/regulator/twl6030-regulator.c
> @@ -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,
>  	},
>  };
>  
> diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c
> index a72c4ad0cec6..12da7d36e520 100644
> --- a/drivers/rtc/rtc-fsl-ftm-alarm.c
> +++ b/drivers/rtc/rtc-fsl-ftm-alarm.c
> @@ -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,
>  	},
>  };
>  
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
> index 161feae3acab..c6f313c9605b 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
> @@ -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,
>  	},
>  };
>  
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
> index d89e97e8f5c2..ce3b5e1680f5 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
> @@ -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,
>  	},
>  };
>  
> diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
> index 81de98c0245a..30fd6da3e8d8 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -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,
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 2fa3fb30dc6c..dd1d1a2cc5f5 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -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),
>  	},
>  };
> diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c
> index 19f0a305cc43..e326d0fb06b2 100644
> --- a/drivers/tty/serial/ma35d1_serial.c
> +++ b/drivers/tty/serial/ma35d1_serial.c
> @@ -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,
>  	},
>  };
>  
> -- 
> 2.39.2
> 

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  9:30   ` Andy Shevchenko
@ 2024-04-03 12:47     ` Corey Minyard
  2024-04-03 13:23       ` Andy Shevchenko
  0 siblings, 1 reply; 100+ messages in thread
From: Corey Minyard @ 2024-04-03 12:47 UTC (permalink / raw
  To: Andy Shevchenko
  Cc: Arnd Bergmann, linux-kernel, Peter Huewe, Jarkko Sakkinen,
	Vinod Koul, Moritz Fischer, Wu Hao, Xu Yilun, Jiri Kosina,
	Benjamin Tissoires, Michael Hennerich, Peter Rosin,
	Dmitry Torokhov, Iyappan Subramanian, Keyur Chudgar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Yisen Zhuang, Salil Mehta, Tony Lindgren, Liam Girdwood,
	Mark Brown, Alexandre Belloni, Xiang Chen, James E.J. Bottomley,
	Martin K. Petersen, Greg Kroah-Hartman, Russell King, Jiri Slaby,
	Jacky Huang, Shan-Chun Hung, Arnd Bergmann, Jason Gunthorpe,
	Tom Rix, Uwe Kleine-König, Randy Dunlap, Rob Herring,
	Linus Walleij, openipmi-developer, linux-integrity, dmaengine,
	linux-fpga, linux-input, linux-i2c, netdev, linux-omap, linux-rtc,
	linux-scsi, linux-staging, linux-serial, linux-arm-kernel

On Wed, Apr 03, 2024 at 12:30:44PM +0300, Andy Shevchenko wrote:
> On Wed, Apr 03, 2024 at 10:06:51AM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > 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.
> 
> Can we split to three groups:
> - Dropping ACPI_PTR()
> - Dropping of_match_ptr() (which I won't review in depth, for example)
> - Dropping both
> ?

Why?

-corey

> 
> ...
> 
> > --- a/drivers/char/ipmi/ipmb_dev_int.c
> > +++ b/drivers/char/ipmi/ipmb_dev_int.c
> > @@ -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.
> 
> ...
> 
> > --- a/drivers/hid/hid-google-hammer.c
> > +++ b/drivers/hid/hid-google-hammer.c
> > @@ -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,
> >  	},
> >  };
> 
> Ditto, and likely of.h can be also dropped.
> 
> ...
> 
> > --- a/drivers/input/touchscreen/wdt87xx_i2c.c
> > +++ b/drivers/input/touchscreen/wdt87xx_i2c.c
> > @@ -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.
> 
> ...
> 
> > --- a/drivers/net/ethernet/apm/xgene-v2/main.c
> > +++ b/drivers/net/ethernet/apm/xgene-v2/main.c
> > @@ -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.
> 
> ...
> 
> > --- a/drivers/rtc/rtc-fsl-ftm-alarm.c
> > +++ b/drivers/rtc/rtc-fsl-ftm-alarm.c
> > @@ -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.
> 
> ...
> 
> >  	.driver = {
> >  		.name =		"pi433",
> >  		.owner =	THIS_MODULE,
> 
> Oh-oh.
> 
> > -		.of_match_table = of_match_ptr(pi433_dt_ids),
> > +		.of_match_table = pi433_dt_ids,
> >  	},
> 
> ...
> 
> > --- a/drivers/tty/serial/amba-pl011.c
> > +++ b/drivers/tty/serial/amba-pl011.c
> > @@ -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),
> >  	},
> >  };
> 
> 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 <andriy.shevchenko@linux.intel.com>
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 10/34] efi: sysfb: don't build when EFI is disabled
  2024-04-03  8:06 ` [PATCH 10/34] efi: sysfb: don't build when EFI is disabled Arnd Bergmann
@ 2024-04-03 13:03   ` Ard Biesheuvel
  2024-04-03 13:15     ` Javier Martinez Canillas
  0 siblings, 1 reply; 100+ messages in thread
From: Ard Biesheuvel @ 2024-04-03 13:03 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Javier Martinez Canillas, Randy Dunlap,
	Daniel Vetter, Arnd Bergmann, Ilias Apalodimas,
	Kirill A. Shutemov, Tom Lendacky, Borislav Petkov (AMD),
	Masahisa Kojima, Rafael J. Wysocki, Rob Herring, Saravana Kannan,
	Greg Kroah-Hartman, linux-efi

On Wed, 3 Apr 2024 at 11:09, Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
>
> Fixes: 15d27b15de96 ("efi: sysfb_efi: fix build when EFI is not set")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

or I can take it via the EFI tree if you prefer.


> ---
>  drivers/firmware/efi/Makefile    | 3 ++-
>  drivers/firmware/efi/sysfb_efi.c | 2 --
>  2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
> index a2d0009560d0..3baf80d8cf81 100644
> --- a/drivers/firmware/efi/Makefile
> +++ b/drivers/firmware/efi/Makefile
> @@ -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)
> diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c
> index cc807ed35aed..a8c982475f6b 100644
> --- a/drivers/firmware/efi/sysfb_efi.c
> +++ b/drivers/firmware/efi/sysfb_efi.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 10/34] efi: sysfb: don't build when EFI is disabled
  2024-04-03 13:03   ` Ard Biesheuvel
@ 2024-04-03 13:15     ` Javier Martinez Canillas
  0 siblings, 0 replies; 100+ messages in thread
From: Javier Martinez Canillas @ 2024-04-03 13:15 UTC (permalink / raw
  To: Ard Biesheuvel, Arnd Bergmann
  Cc: linux-kernel, Randy Dunlap, Daniel Vetter, Arnd Bergmann,
	Ilias Apalodimas, Kirill A. Shutemov, Tom Lendacky,
	Borislav Petkov (AMD), Masahisa Kojima, Rafael J. Wysocki,
	Rob Herring, Saravana Kannan, Greg Kroah-Hartman, linux-efi

Ard Biesheuvel <ardb@kernel.org> writes:

> On Wed, 3 Apr 2024 at 11:09, Arnd Bergmann <arnd@kernel.org> wrote:
>>
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> 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.
>>
>> Fixes: 15d27b15de96 ("efi: sysfb_efi: fix build when EFI is not set")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
>

Looks good to me too.

Acked-by: Javier Martinez Canillas <javierm@redhat.com>

> or I can take it via the EFI tree if you prefer.
>

I think that could be merged through your EFI tree. Thanks!

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
  2024-04-03  8:06 ` [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused Arnd Bergmann
  2024-04-03  9:40   ` Andy Shevchenko
@ 2024-04-03 13:17   ` Uwe Kleine-König
  2024-04-03 13:27     ` Uwe Kleine-König
  1 sibling, 1 reply; 100+ messages in thread
From: Uwe Kleine-König @ 2024-04-03 13:17 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Dmitry Torokhov, Maxime Coquelin, Alexandre Torgue,
	Krzysztof Kozlowski, Arnd Bergmann, linux-input, linux-stm32,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 2521 bytes --]

Hello,

On Wed, Apr 03, 2024 at 10:06:25AM +0200, Arnd Bergmann wrote:
> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> 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]
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/input/touchscreen/stmpe-ts.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
> index b204fdb2d22c..022b3e94266d 100644
> --- a/drivers/input/touchscreen/stmpe-ts.c
> +++ b/drivers/input/touchscreen/stmpe-ts.c
> @@ -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:

diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index b204fdb2d22c..e1afebc641ec 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -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 <l.fu@pengutronix.de>");
 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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 100+ messages in thread

* Re: [PATCH 19/34] sunrpc: suppress warnings for unused procfs functions
  2024-04-03  8:06 ` [PATCH 19/34] sunrpc: suppress warnings for unused procfs functions Arnd Bergmann
  2024-04-03  8:59   ` Jeff Layton
@ 2024-04-03 13:20   ` Chuck Lever
  1 sibling, 0 replies; 100+ messages in thread
From: Chuck Lever @ 2024-04-03 13:20 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel@vger.kernel.org, Trond Myklebust, Anna Schumaker,
	Jeff Layton, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, NeilBrown, J. Bruce Fields, Arnd Bergmann,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, linux-nfs@vger.kernel.org,
	netdev@vger.kernel.org

On Wed, Apr 03, 2024 at 04:06:37AM -0400, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>

Acked-by: Chuck Lever <chuck.lever@oracle.com>


> ---
>  net/sunrpc/cache.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
> index 95ff74706104..ab3a57965dc0 100644
> --- a/net/sunrpc/cache.c
> +++ b/net/sunrpc/cache.c
> @@ -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)
>  {
> -- 
> 2.39.2
> 

-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03 12:47     ` Corey Minyard
@ 2024-04-03 13:23       ` Andy Shevchenko
  0 siblings, 0 replies; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03 13:23 UTC (permalink / raw
  To: Corey Minyard
  Cc: Arnd Bergmann, linux-kernel, Peter Huewe, Jarkko Sakkinen,
	Vinod Koul, Moritz Fischer, Wu Hao, Xu Yilun, Jiri Kosina,
	Benjamin Tissoires, Michael Hennerich, Peter Rosin,
	Dmitry Torokhov, Iyappan Subramanian, Keyur Chudgar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Yisen Zhuang, Salil Mehta, Tony Lindgren, Liam Girdwood,
	Mark Brown, Alexandre Belloni, Xiang Chen, James E.J. Bottomley,
	Martin K. Petersen, Greg Kroah-Hartman, Russell King, Jiri Slaby,
	Jacky Huang, Shan-Chun Hung, Arnd Bergmann, Jason Gunthorpe,
	Tom Rix, Uwe Kleine-König, Randy Dunlap, Rob Herring,
	Linus Walleij, openipmi-developer, linux-integrity, dmaengine,
	linux-fpga, linux-input, linux-i2c, netdev, linux-omap, linux-rtc,
	linux-scsi, linux-staging, linux-serial, linux-arm-kernel

On Wed, Apr 03, 2024 at 07:47:49AM -0500, Corey Minyard wrote:
> On Wed, Apr 03, 2024 at 12:30:44PM +0300, Andy Shevchenko wrote:
> > On Wed, Apr 03, 2024 at 10:06:51AM +0200, Arnd Bergmann wrote:
> > > From: Arnd Bergmann <arnd@arndb.de>

...

> > > 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
> > ?
> 
> 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).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused
  2024-04-03 13:17   ` Uwe Kleine-König
@ 2024-04-03 13:27     ` Uwe Kleine-König
  0 siblings, 0 replies; 100+ messages in thread
From: Uwe Kleine-König @ 2024-04-03 13:27 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Dmitry Torokhov, Maxime Coquelin, Alexandre Torgue,
	Krzysztof Kozlowski, Arnd Bergmann, linux-input, linux-stm32,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 3145 bytes --]

Hello again,

On Wed, Apr 03, 2024 at 03:17:32PM +0200, Uwe Kleine-König wrote:
> On Wed, Apr 03, 2024 at 10:06:25AM +0200, Arnd Bergmann wrote:
> > From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > 
> > 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]
> > 
> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  drivers/input/touchscreen/stmpe-ts.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
> > index b204fdb2d22c..022b3e94266d 100644
> > --- a/drivers/input/touchscreen/stmpe-ts.c
> > +++ b/drivers/input/touchscreen/stmpe-ts.c
> > @@ -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:
> 
> diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
> index b204fdb2d22c..e1afebc641ec 100644
> --- a/drivers/input/touchscreen/stmpe-ts.c
> +++ b/drivers/input/touchscreen/stmpe-ts.c
> @@ -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 <l.fu@pengutronix.de>");
>  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?!

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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n
  2024-04-03  8:06 ` [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n Arnd Bergmann
  2024-04-03  9:33   ` Andy Shevchenko
@ 2024-04-03 14:26   ` Jeff Johnson
  1 sibling, 0 replies; 100+ messages in thread
From: Jeff Johnson @ 2024-04-03 14:26 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Stanislaw Gruszka, Kalle Valo
  Cc: Arnd Bergmann, linux-wireless

On 4/3/2024 1:06 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/net/wireless/intel/iwlegacy/4965-rs.c | 15 ++-------------
>  drivers/net/wireless/intel/iwlegacy/common.h  |  2 --
>  2 files changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlegacy/4965-rs.c b/drivers/net/wireless/intel/iwlegacy/4965-rs.c
> index 718efb1aa1b0..1aa2cee5d131 100644
> --- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c
> +++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c
> @@ -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
> -

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?

>  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),

CONFIG_DEBUG_FS != CONFIG_MAC80211_DEBUGFS, is that intentional?

> +				  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?

>  };
>  
>  int
> diff --git a/drivers/net/wireless/intel/iwlegacy/common.h b/drivers/net/wireless/intel/iwlegacy/common.h
> index 69687fcf963f..b9f1daf0901b 100644
> --- a/drivers/net/wireless/intel/iwlegacy/common.h
> +++ b/drivers/net/wireless/intel/iwlegacy/common.h
> @@ -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

>  	struct il_priv *drv;
>  
>  	/* used to be in sta_info */


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 27/34] cpufreq: intel_pstate: hide unused intel_pstate_cpu_oob_ids[]
  2024-04-03  8:06 ` [PATCH 27/34] cpufreq: intel_pstate: hide unused intel_pstate_cpu_oob_ids[] Arnd Bergmann
@ 2024-04-03 14:43   ` Rafael J. Wysocki
  0 siblings, 0 replies; 100+ messages in thread
From: Rafael J. Wysocki @ 2024-04-03 14:43 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Srinivas Pandruvada, Len Brown, Rafael J. Wysocki,
	Viresh Kumar, Arnd Bergmann, Doug Smythies, Zhenguo Yao,
	Tero Kristo, Jiri Slaby (SUSE), linux-pm

On Wed, Apr 3, 2024 at 10:11 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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 <arnd@arndb.de>
> ---
>  drivers/cpufreq/intel_pstate.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index dbbf299f4219..29ce9edc6f68 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -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),
> --

Applied as 6.10 material, thanks!

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 24/34] crypto: ccp - drop platform ifdef checks
  2024-04-03  8:06 ` [PATCH 24/34] crypto: ccp - drop platform ifdef checks Arnd Bergmann
@ 2024-04-03 15:17   ` Tom Lendacky
  2024-04-03 15:50     ` Arnd Bergmann
  2024-04-12  7:30   ` Herbert Xu
  1 sibling, 1 reply; 100+ messages in thread
From: Tom Lendacky @ 2024-04-03 15:17 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, John Allen, Herbert Xu,
	David S. Miller
  Cc: Arnd Bergmann, Uwe Kleine-König, linux-crypto

On 4/3/24 03:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Fixes: 6c5063434098 ("crypto: ccp - Add ACPI support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

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:

Acked-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
>   drivers/crypto/ccp/sp-platform.c | 14 ++------------
>   1 file changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c
> index 473301237760..ff6ceb4feee0 100644
> --- a/drivers/crypto/ccp/sp-platform.c
> +++ b/drivers/crypto/ccp/sp-platform.c
> @@ -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,

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 24/34] crypto: ccp - drop platform ifdef checks
  2024-04-03 15:17   ` Tom Lendacky
@ 2024-04-03 15:50     ` Arnd Bergmann
  0 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03 15:50 UTC (permalink / raw
  To: Tom Lendacky, Arnd Bergmann, linux-kernel, John Allen, Herbert Xu,
	David S . Miller
  Cc: Uwe Kleine-König, linux-crypto

On Wed, Apr 3, 2024, at 17:17, Tom Lendacky wrote:
> On 4/3/24 03:06, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> 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.
>> 
>> Fixes: 6c5063434098 ("crypto: ccp - Add ACPI support")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Would using __maybe_unused on dev_vdata be the safer, easier choice?

It's a simpler change, but leaves the extra complexity that
is not needed here.

      Arnd

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 ` [PATCH 33/34] drivers: " Arnd Bergmann
                     ` (2 preceding siblings ...)
  2024-04-03 12:47   ` Corey Minyard
@ 2024-04-03 16:09   ` Jarkko Sakkinen
  2024-04-09 13:48   ` Greg Kroah-Hartman
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 100+ messages in thread
From: Jarkko Sakkinen @ 2024-04-03 16:09 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Corey Minyard, Peter Huewe,
	Vinod Koul, Moritz Fischer, Wu Hao, Xu Yilun, Jiri Kosina,
	Benjamin Tissoires, Michael Hennerich, Peter Rosin,
	Dmitry Torokhov, Iyappan Subramanian, Keyur Chudgar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Yisen Zhuang, Salil Mehta, Tony Lindgren, Liam Girdwood,
	Mark Brown, Alexandre Belloni, Xiang Chen, James E.J. Bottomley,
	Martin K. Petersen, Greg Kroah-Hartman, Russell King, Jiri Slaby,
	Jacky Huang, Shan-Chun Hung
  Cc: Arnd Bergmann, Jason Gunthorpe, Tom Rix, Uwe Kleine-König,
	Randy Dunlap, Rob Herring, Linus Walleij, openipmi-developer,
	linux-integrity, dmaengine, linux-fpga, linux-input, linux-i2c,
	netdev, linux-omap, linux-rtc, linux-scsi, linux-staging,
	linux-serial, linux-arm-kernel

On Wed Apr 3, 2024 at 11:06 AM EEST, Arnd Bergmann wrote:
> diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
> index 2ea4882251cf..0c453f3f928d 100644
> --- a/drivers/char/tpm/tpm_ftpm_tee.c
> +++ b/drivers/char/tpm/tpm_ftpm_tee.c
> @@ -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:

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

[can be included to possible new revisions if it stays same]

BR, Jarkko

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
  2024-04-03  9:56   ` Mark Brown
@ 2024-04-03 21:05     ` Uwe Kleine-König
  2024-04-03 21:13       ` Andy Shevchenko
  0 siblings, 1 reply; 100+ messages in thread
From: Uwe Kleine-König @ 2024-04-03 21:05 UTC (permalink / raw
  To: Mark Brown
  Cc: Arnd Bergmann, linux-kernel, Neil Armstrong, Kevin Hilman,
	Heiko Stuebner, Andi Shyti, Krzysztof Kozlowski, Arnd Bergmann,
	Jerome Brunet, Martin Blumenstingl, Alim Akhtar, Li Zetao,
	Jonathan Cameron, Rob Herring, Yang Yingliang, Andy Shevchenko,
	Luis de Arquer, Tudor Ambarus, Sam Protsenko, Peter Griffin,
	Jaewon Kim, linux-spi, linux-arm-kernel, linux-amlogic,
	linux-rockchip, linux-samsung-soc

[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]

On Wed, Apr 03, 2024 at 10:56:58AM +0100, Mark Brown wrote:
> On Wed, Apr 03, 2024 at 10:06:49AM +0200, Arnd Bergmann wrote:
> 
> > 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.
> 
> 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 =

diff --git a/include/linux/of.h b/include/linux/of.h
index a0bedd038a05..d980bccffda0 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 100+ messages in thread

* Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
  2024-04-03 21:05     ` Uwe Kleine-König
@ 2024-04-03 21:13       ` Andy Shevchenko
  2024-04-03 22:19         ` Arnd Bergmann
  0 siblings, 1 reply; 100+ messages in thread
From: Andy Shevchenko @ 2024-04-03 21:13 UTC (permalink / raw
  To: Uwe Kleine-König
  Cc: Mark Brown, Arnd Bergmann, linux-kernel, Neil Armstrong,
	Kevin Hilman, Heiko Stuebner, Andi Shyti, Krzysztof Kozlowski,
	Arnd Bergmann, Jerome Brunet, Martin Blumenstingl, Alim Akhtar,
	Li Zetao, Jonathan Cameron, Rob Herring, Yang Yingliang,
	Andy Shevchenko, Luis de Arquer, Tudor Ambarus, Sam Protsenko,
	Peter Griffin, Jaewon Kim, linux-spi, linux-arm-kernel,
	linux-amlogic, linux-rockchip, linux-samsung-soc

Wed, Apr 03, 2024 at 11:05:51PM +0200, Uwe Kleine-König kirjoitti:
> On Wed, Apr 03, 2024 at 10:56:58AM +0100, Mark Brown wrote:
> > On Wed, Apr 03, 2024 at 10:06:49AM +0200, Arnd Bergmann wrote:
> > 
> > > 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.
> > 
> > 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 =
> 
> diff --git a/include/linux/of.h b/include/linux/of.h
> index a0bedd038a05..d980bccffda0 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -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).

>  #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.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: (subset) [PATCH 02/34] ubsan: fix unused variable warning in test module
  2024-04-03  8:06 ` [PATCH 02/34] ubsan: fix unused variable warning in test module Arnd Bergmann
@ 2024-04-03 21:36   ` Kees Cook
  0 siblings, 0 replies; 100+ messages in thread
From: Kees Cook @ 2024-04-03 21:36 UTC (permalink / raw
  To: linux-kernel, Andrew Morton, Arnd Bergmann
  Cc: Kees Cook, Arnd Bergmann, Marco Elver, Andrey Konovalov,
	Andrey Ryabinin, Justin Stitt, kasan-dev, linux-hardening

On Wed, 03 Apr 2024 10:06:20 +0200, Arnd Bergmann wrote:
> 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]
> 
> 
> [...]

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,

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
  2024-04-03 21:13       ` Andy Shevchenko
@ 2024-04-03 22:19         ` Arnd Bergmann
  0 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-03 22:19 UTC (permalink / raw
  To: Andy Shevchenko, Uwe Kleine-König
  Cc: Mark Brown, Arnd Bergmann, linux-kernel, Neil Armstrong,
	Kevin Hilman, Heiko Stübner, Andi Shyti, Krzysztof Kozlowski,
	Jerome Brunet, Martin Blumenstingl, Alim Akhtar, Li Zetao,
	Jonathan Cameron, Rob Herring, Yang Yingliang, Andy Shevchenko,
	Luis de Arquer, Tudor Ambarus, Sam Protsenko, Peter Griffin,
	Jaewon Kim, linux-spi, linux-arm-kernel, linux-amlogic,
	linux-rockchip, linux-samsung-soc

On Wed, Apr 3, 2024, at 23:13, Andy Shevchenko wrote:
> Wed, Apr 03, 2024 at 11:05:51PM +0200, Uwe Kleine-König kirjoitti:
>> On Wed, Apr 03, 2024 at 10:56:58AM +0100, Mark Brown wrote:
>> > On Wed, Apr 03, 2024 at 10:06:49AM +0200, Arnd Bergmann wrote:
>> > 
>> > > 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.
>> > 
>> > 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 =
>> 
>> diff --git a/include/linux/of.h b/include/linux/of.h
>> index a0bedd038a05..d980bccffda0 100644
>> --- a/include/linux/of.h
>> +++ b/include/linux/of.h
>> @@ -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)

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.

>>  #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.

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

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 04/34] i2c: pxa: hide unused icr_bits[] variable
  2024-04-03  8:06 ` [PATCH 04/34] i2c: pxa: hide unused icr_bits[] variable Arnd Bergmann
@ 2024-04-03 23:17   ` Andi Shyti
  0 siblings, 0 replies; 100+ messages in thread
From: Andi Shyti @ 2024-04-03 23:17 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Russell King, Holger Schurig, Arnd Bergmann,
	Wolfram Sang, Linus Walleij, Geert Uytterhoeven, Heiko Stuebner,
	Yangtao Li, Robert Marko, Uwe Kleine-König, Liao Chang,
	Paul Cercueil, Rob Herring, linux-i2c

Hi Arnd,

On Wed, Apr 03, 2024 at 10:06:22AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>

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

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks
  2024-04-03  8:50     ` Arnd Bergmann
@ 2024-04-04  3:45       ` Damien Le Moal
  0 siblings, 0 replies; 100+ messages in thread
From: Damien Le Moal @ 2024-04-04  3:45 UTC (permalink / raw
  To: Arnd Bergmann, Arnd Bergmann, linux-kernel, Niklas Cassel,
	Saeed Bishara
  Cc: Ma Ke, Uwe Kleine-König, Sergey Shtylyov, Christophe JAILLET,
	Jeff Garzik, linux-ide

On 4/3/24 17:50, Arnd Bergmann wrote:
> On Wed, Apr 3, 2024, at 10:32, Damien Le Moal wrote:
>> On 4/3/24 17:06, Arnd Bergmann wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> 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.
>>>
>>> Fixes: 7bb3c5290ca0 ("sata_mv: Remove PCI dependency")
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>
>> 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 !

> 
> 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

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[]
  2024-04-03  9:03       ` Christophe Leroy
@ 2024-04-04 11:43         ` Arnd Bergmann
  0 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2024-04-04 11:43 UTC (permalink / raw
  To: Christophe Leroy, Arnd Bergmann, linux-kernel@vger.kernel.org,
	Andrew Morton, Palmer Dabbelt
  Cc: Dave Hansen, Noah Goldstein, Charlie Jenkins

On Wed, Apr 3, 2024, at 11:03, Christophe Leroy wrote:
> Le 03/04/2024 à 10:58, Arnd Bergmann a écrit :
>
>> On Wed, Apr 3, 2024, at 10:41, Christophe Leroy wrote:
>> 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.

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

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 11/34] clk: ti: dpll: fix incorrect #ifdef checks
  2024-04-03  8:06 ` [PATCH 11/34] clk: ti: dpll: fix incorrect #ifdef checks Arnd Bergmann
  2024-04-03  9:00   ` Tony Lindgren
@ 2024-04-05 21:13   ` Stephen Boyd
  1 sibling, 0 replies; 100+ messages in thread
From: Stephen Boyd @ 2024-04-05 21:13 UTC (permalink / raw
  To: Arnd Bergmann, Michael Turquette, Tero Kristo, linux-kernel
  Cc: Arnd Bergmann, linux-omap, linux-clk

Quoting Arnd Bergmann (2024-04-03 01:06:29)
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 25/34] usb: gadget: omap_udc: remove unused variable
  2024-04-03  8:06 ` [PATCH 25/34] usb: gadget: omap_udc: remove unused variable Arnd Bergmann
@ 2024-04-05 22:51   ` Aaro Koskinen
  0 siblings, 0 replies; 100+ messages in thread
From: Aaro Koskinen @ 2024-04-05 22:51 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Greg Kroah-Hartman, Arnd Bergmann,
	Uwe Kleine-König, linux-usb

Hi,

On Wed, Apr 03, 2024 at 10:06:43AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>

A.

> ---
>  drivers/usb/gadget/udc/omap_udc.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c
> index f90eeecf27de..e13b8ec8ef8a 100644
> --- a/drivers/usb/gadget/udc/omap_udc.c
> +++ b/drivers/usb/gadget/udc/omap_udc.c
> @@ -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");
> -- 
> 2.39.2
> 

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 00/34] address all -Wunused-const warnings
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (33 preceding siblings ...)
  2024-04-03  8:06 ` [PATCH 34/34] kbuild: always enable -Wunused-const-variable Arnd Bergmann
@ 2024-04-06  5:20 ` patchwork-bot+netdevbpf
  2024-04-10  8:02 ` (subset) " Sebastian Reichel
  2024-04-22  8:16 ` Michael Ellerman
  36 siblings, 0 replies; 100+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-06  5:20 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, arnd, mpe, christophe.leroy, dlemoal, jikos, gregkh,
	minyard, peterhuewe, jarkko, kristo, sboyd, abbotti, hsweeten,
	srinivas.pandruvada, lenb, rafael, john.allen, herbert, vkoul,
	ardb, andersson, mdf, liviu.dudau, benjamin.tissoires, andi.shyti,
	michael.hennerich, peda, lars, jic23, dmitry.torokhov,
	markuss.broks, alexandre.torgue, lee, kuba, Shyam-sundar.S-k,
	iyappan, yisen.zhuang, stf_xl, kvalo, sre, tony, broonie,
	alexandre.belloni, chenxiang66, martin.petersen, neil.armstrong,
	heiko, krzysztof.kozlowski, hvaibhav.linux, elder, jirislaby,
	ychuang3, deller, hch, robin.murphy, rostedt, mhiramat, akpm,
	keescook, trond.myklebust, anna, masahiroy, nathan, tiwai,
	linuxppc-dev, linux-ide, openipmi-developer, linux-integrity,
	linux-omap, linux-clk, linux-pm, linux-crypto, dmaengine,
	linux-efi, linux-arm-msm, linux-fpga, dri-devel, linux-input,
	linux-i2c, linux-iio, linux-stm32, linux-arm-kernel, netdev,
	linux-leds, linux-wireless, linux-rtc, linux-scsi, linux-spi,
	linux-amlogic, linux-rockchip, linux-samsung-soc, greybus-dev,
	linux-staging, linux-serial, linux-usb, linux-fbdev, iommu,
	linux-trace-kernel, kasan-dev, linux-hardening, linux-nfs,
	linux-kbuild, alsa-devel, linux-sound

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  3 Apr 2024 10:06:18 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
  2024-04-03 10:01     ` Arnd Bergmann
@ 2024-04-06 15:30       ` Jonathan Cameron
  0 siblings, 0 replies; 100+ messages in thread
From: Jonathan Cameron @ 2024-04-06 15:30 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: Krzysztof Kozlowski, Arnd Bergmann, linux-kernel,
	Lars-Peter Clausen, Michael Hennerich, linux-iio

On Wed, 03 Apr 2024 12:01:13 +0200
"Arnd Bergmann" <arnd@arndb.de> wrote:

> On Wed, Apr 3, 2024, at 11:55, Krzysztof Kozlowski wrote:
> > On 03/04/2024 10:06, Arnd Bergmann wrote:  
> >> From: Arnd Bergmann <arnd@arndb.de>
> >> 
> >> 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.
> >> 
> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >> ---
> >>  drivers/iio/dac/ad5755.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >> 
> >> diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
> >> index 404865e35460..5c1e7f428c25 100644
> >> --- a/drivers/iio/dac/ad5755.c
> >> +++ b/drivers/iio/dac/ad5755.c
> >> @@ -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.  
> 
> Yes, that looks good as well, though you might need to drop
> spi_device_id table 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


> 
>      Arnd


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
  2024-04-03  9:55   ` Krzysztof Kozlowski
  2024-04-03 10:01     ` Arnd Bergmann
@ 2024-04-06 15:31     ` Jonathan Cameron
  1 sibling, 0 replies; 100+ messages in thread
From: Jonathan Cameron @ 2024-04-06 15:31 UTC (permalink / raw
  To: Krzysztof Kozlowski
  Cc: Arnd Bergmann, linux-kernel, Lars-Peter Clausen,
	Michael Hennerich, Arnd Bergmann, linux-iio

On Wed, 3 Apr 2024 11:55:06 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> On 03/04/2024 10:06, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > 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.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  drivers/iio/dac/ad5755.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
> > index 404865e35460..5c1e7f428c25 100644
> > --- a/drivers/iio/dac/ad5755.c
> > +++ b/drivers/iio/dac/ad5755.c
> > @@ -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).

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

> 
> Best regards,
> Krzysztof
> 


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 ` [PATCH 33/34] drivers: " Arnd Bergmann
                     ` (3 preceding siblings ...)
  2024-04-03 16:09   ` Jarkko Sakkinen
@ 2024-04-09 13:48   ` Greg Kroah-Hartman
  2024-04-23  7:33   ` Xu Yilun
  2024-04-23  9:52   ` Peter Rosin
  6 siblings, 0 replies; 100+ messages in thread
From: Greg Kroah-Hartman @ 2024-04-09 13:48 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Corey Minyard, Peter Huewe, Jarkko Sakkinen,
	Vinod Koul, Moritz Fischer, Wu Hao, Xu Yilun, Jiri Kosina,
	Benjamin Tissoires, Michael Hennerich, Peter Rosin,
	Dmitry Torokhov, Iyappan Subramanian, Keyur Chudgar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Yisen Zhuang, Salil Mehta, Tony Lindgren, Liam Girdwood,
	Mark Brown, Alexandre Belloni, Xiang Chen, James E.J. Bottomley,
	Martin K. Petersen, Russell King, Jiri Slaby, Jacky Huang,
	Shan-Chun Hung, Arnd Bergmann, Jason Gunthorpe, Tom Rix,
	Uwe Kleine-König, Randy Dunlap, Rob Herring, Linus Walleij,
	openipmi-developer, linux-integrity, dmaengine, linux-fpga,
	linux-input, linux-i2c, netdev, linux-omap, linux-rtc, linux-scsi,
	linux-staging, linux-serial, linux-arm-kernel

On Wed, Apr 03, 2024 at 10:06:51AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: (subset) [PATCH 00/34] address all -Wunused-const warnings
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (34 preceding siblings ...)
  2024-04-06  5:20 ` [PATCH 00/34] address all -Wunused-const warnings patchwork-bot+netdevbpf
@ 2024-04-10  8:02 ` Sebastian Reichel
  2024-04-22  8:16 ` Michael Ellerman
  36 siblings, 0 replies; 100+ messages in thread
From: Sebastian Reichel @ 2024-04-10  8:02 UTC (permalink / raw
  To: linux-kernel, Arnd Bergmann
  Cc: Arnd Bergmann, Michael Ellerman, Christophe Leroy, Damien Le Moal,
	Jiri Kosina, Greg Kroah-Hartman, Corey Minyard, Peter Huewe,
	Jarkko Sakkinen, Tero Kristo, Stephen Boyd, Ian Abbott,
	H Hartley Sweeten, Srinivas Pandruvada, Len Brown,
	Rafael J. Wysocki, John Allen, Herbert Xu, Vinod Koul,
	Ard Biesheuvel, Bjorn Andersson, Moritz Fischer, Liviu Dudau,
	Benjamin Tissoires, Andi Shyti, Michael Hennerich, Peter Rosin,
	Lars-Peter Clausen, Jonathan Cameron, Dmitry Torokhov,
	Markuss Broks, Alexandre Torgue, Lee Jones, Jakub Kicinski,
	Shyam Sundar S K, Iyappan Subramanian, Yisen Zhuang,
	Stanislaw Gruszka, Kalle Valo, Sebastian Reichel, Tony Lindgren,
	Mark Brown, Alexandre Belloni, Xiang Chen, Martin K. Petersen,
	Neil Armstrong, Heiko Stuebner, Krzysztof Kozlowski,
	Vaibhav Hiremath, Alex Elder, Jiri Slaby, Jacky Huang,
	Helge Deller, Christoph Hellwig, Robin Murphy, Steven Rostedt,
	Masami Hiramatsu, Andrew Morton, Kees Cook, Trond Myklebust,
	Anna Schumaker, Masahiro Yamada, Nathan Chancellor, Takashi Iwai,
	linuxppc-dev, linux-ide, openipmi-developer, linux-integrity,
	linux-omap, linux-clk, linux-pm, linux-crypto, dmaengine,
	linux-efi, linux-arm-msm, linux-fpga, dri-devel, linux-input,
	linux-i2c, linux-iio, linux-stm32, linux-arm-kernel, netdev,
	linux-leds, linux-wireless, linux-rtc, linux-scsi, linux-spi,
	linux-amlogic, linux-rockchip, linux-samsung-soc, greybus-dev,
	linux-staging, linux-serial, linux-usb, linux-fbdev, iommu,
	linux-trace-kernel, kasan-dev, linux-hardening, linux-nfs,
	linux-kbuild, alsa-devel, linux-sound


On Wed, 03 Apr 2024 10:06:18 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: (subset) [PATCH 15/34] leds: apu: remove duplicate DMI lookup data
  2024-04-03  8:06 ` [PATCH 15/34] leds: apu: remove duplicate DMI lookup data Arnd Bergmann
@ 2024-04-11 15:51   ` Lee Jones
  0 siblings, 0 replies; 100+ messages in thread
From: Lee Jones @ 2024-04-11 15:51 UTC (permalink / raw
  To: linux-kernel, Pavel Machek, Lee Jones, Arnd Bergmann
  Cc: Arnd Bergmann, linux-leds

On Wed, 03 Apr 2024 10:06:33 +0200, Arnd Bergmann wrote:
> 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.
> 
> [...]

Applied, thanks!

[15/34] leds: apu: remove duplicate DMI lookup data
        commit: 6e37e66058d9c0bfa13d32e2c6ff14439d5e62f9

--
Lee Jones [李琼斯]


^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 24/34] crypto: ccp - drop platform ifdef checks
  2024-04-03  8:06 ` [PATCH 24/34] crypto: ccp - drop platform ifdef checks Arnd Bergmann
  2024-04-03 15:17   ` Tom Lendacky
@ 2024-04-12  7:30   ` Herbert Xu
  1 sibling, 0 replies; 100+ messages in thread
From: Herbert Xu @ 2024-04-12  7:30 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Tom Lendacky, John Allen, David S. Miller,
	Arnd Bergmann, Uwe Kleine-König, linux-crypto

On Wed, Apr 03, 2024 at 10:06:42AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Fixes: 6c5063434098 ("crypto: ccp - Add ACPI support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/crypto/ccp/sp-platform.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: (subset) [PATCH 00/34] address all -Wunused-const warnings
  2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
                   ` (35 preceding siblings ...)
  2024-04-10  8:02 ` (subset) " Sebastian Reichel
@ 2024-04-22  8:16 ` Michael Ellerman
  36 siblings, 0 replies; 100+ messages in thread
From: Michael Ellerman @ 2024-04-22  8:16 UTC (permalink / raw
  To: linux-kernel, Arnd Bergmann
  Cc: Arnd Bergmann, Michael Ellerman, Christophe Leroy, Damien Le Moal,
	Jiri Kosina, Greg Kroah-Hartman, Corey Minyard, Peter Huewe,
	Jarkko Sakkinen, Tero Kristo, Stephen Boyd, Ian Abbott,
	H Hartley Sweeten, Srinivas Pandruvada, Len Brown,
	Rafael J. Wysocki, John Allen, Herbert Xu, Vinod Koul,
	Ard Biesheuvel, Bjorn Andersson, Moritz Fischer, Liviu Dudau,
	Benjamin Tissoires, Andi Shyti, Michael Hennerich

On Wed, 03 Apr 2024 10:06:18 +0200, Arnd Bergmann wrote:
> 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.
> 
> [...]

Applied to powerpc/next.

[01/34] powerpc/fsl-soc: hide unused const variable
        https://git.kernel.org/powerpc/c/01acaf3aa75e1641442cc23d8fe0a7bb4226efb1

cheers

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 ` [PATCH 33/34] drivers: " Arnd Bergmann
                     ` (4 preceding siblings ...)
  2024-04-09 13:48   ` Greg Kroah-Hartman
@ 2024-04-23  7:33   ` Xu Yilun
  2024-04-23  9:52   ` Peter Rosin
  6 siblings, 0 replies; 100+ messages in thread
From: Xu Yilun @ 2024-04-23  7:33 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kernel, Corey Minyard, Peter Huewe, Jarkko Sakkinen,
	Vinod Koul, Moritz Fischer, Wu Hao, Xu Yilun, Jiri Kosina,
	Benjamin Tissoires, Michael Hennerich, Peter Rosin,
	Dmitry Torokhov, Iyappan Subramanian, Keyur Chudgar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Yisen Zhuang, Salil Mehta, Tony Lindgren, Liam Girdwood,
	Mark Brown, Alexandre Belloni, Xiang Chen, James E.J. Bottomley,
	Martin K. Petersen, Greg Kroah-Hartman, Russell King, Jiri Slaby,
	Jacky Huang, Shan-Chun Hung, Arnd Bergmann, Jason Gunthorpe,
	Tom Rix, Uwe Kleine-König, Randy Dunlap, Rob Herring,
	Linus Walleij, openipmi-developer, linux-integrity, dmaengine,
	linux-fpga, linux-input, linux-i2c, netdev, linux-omap, linux-rtc,
	linux-scsi, linux-staging, linux-serial, linux-arm-kernel

> diff --git a/drivers/fpga/versal-fpga.c b/drivers/fpga/versal-fpga.c
> index 3710e8f01be2..e6189106c468 100644
> --- a/drivers/fpga/versal-fpga.c
> +++ b/drivers/fpga/versal-fpga.c
> @@ -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

Acked-by: Xu Yilun <yilun.xu@intel.com>

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
  2024-04-03  8:06 ` [PATCH 33/34] drivers: " Arnd Bergmann
                     ` (5 preceding siblings ...)
  2024-04-23  7:33   ` Xu Yilun
@ 2024-04-23  9:52   ` Peter Rosin
  6 siblings, 0 replies; 100+ messages in thread
From: Peter Rosin @ 2024-04-23  9:52 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Corey Minyard, Peter Huewe,
	Jarkko Sakkinen, Vinod Koul, Moritz Fischer, Wu Hao, Xu Yilun,
	Jiri Kosina, Benjamin Tissoires, Michael Hennerich,
	Dmitry Torokhov, Iyappan Subramanian, Keyur Chudgar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Yisen Zhuang, Salil Mehta, Tony Lindgren, Liam Girdwood,
	Mark Brown, Alexandre Belloni, Xiang Chen, James E.J. Bottomley,
	Martin K. Petersen, Greg Kroah-Hartman, Russell King, Jiri Slaby,
	Jacky Huang, Shan-Chun Hung
  Cc: Arnd Bergmann, Jason Gunthorpe, Tom Rix, Uwe Kleine-König,
	Randy Dunlap, Rob Herring, Linus Walleij, openipmi-developer,
	linux-integrity, dmaengine, linux-fpga, linux-input, linux-i2c,
	netdev, linux-omap, linux-rtc, linux-scsi, linux-staging,
	linux-serial, linux-arm-kernel

Hi!

2024-04-03 at 10:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  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(-)

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.c
drivers/i2c/muxes/i2c-mux-reg.c
drivers/mux/adg729a.c

Acked-by: Peter Rosin <peda@axentia.se>

Cheers,
Peter

^ permalink raw reply	[flat|nested] 100+ messages in thread

* Re: [PATCH 17/34] greybus: arche-ctrl: move device table to its right location
  2024-04-03  8:06 ` [PATCH 17/34] greybus: arche-ctrl: move device table to its right location Arnd Bergmann
@ 2024-04-30 23:41   ` Alex Elder
  0 siblings, 0 replies; 100+ messages in thread
From: Alex Elder @ 2024-04-30 23:41 UTC (permalink / raw
  To: Arnd Bergmann, linux-kernel, Vaibhav Hiremath, Johan Hovold,
	Alex Elder, Greg Kroah-Hartman, Viresh Kumar
  Cc: Arnd Bergmann, Uwe Kleine-König, Luca Ceresoli, Rob Herring,
	greybus-dev, linux-staging

On 4/3/24 3:06 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.

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.

Reviewed-by: Alex Elder <elder@linaro.org>

> 
> Fixes: 7b62b61c752a ("greybus: arche-ctrl: Don't expose driver internals to arche-platform driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/staging/greybus/arche-apb-ctrl.c | 1 +
>   drivers/staging/greybus/arche-platform.c | 9 +--------
>   2 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c
> index 8541995008da..aa6f266b62a1 100644
> --- a/drivers/staging/greybus/arche-apb-ctrl.c
> +++ b/drivers/staging/greybus/arche-apb-ctrl.c
> @@ -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,
> diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
> index 891b75327d7f..b33977ccd527 100644
> --- a/drivers/staging/greybus/arche-platform.c
> +++ b/drivers/staging/greybus/arche-platform.c
> @@ -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,


^ permalink raw reply	[flat|nested] 100+ messages in thread

end of thread, other threads:[~2024-04-30 23:41 UTC | newest]

Thread overview: 100+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03  8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
2024-04-03  8:06 ` [PATCH 01/34] powerpc/fsl-soc: hide unused const variable Arnd Bergmann
2024-04-03  8:19   ` Christophe Leroy
2024-04-03  8:06 ` [PATCH 02/34] ubsan: fix unused variable warning in test module Arnd Bergmann
2024-04-03 21:36   ` (subset) " Kees Cook
2024-04-03  8:06 ` [PATCH 03/34] platform: goldfish: remove ACPI_PTR() annotations Arnd Bergmann
2024-04-03  9:08   ` Andy Shevchenko
2024-04-03  8:06 ` [PATCH 04/34] i2c: pxa: hide unused icr_bits[] variable Arnd Bergmann
2024-04-03 23:17   ` Andi Shyti
2024-04-03  8:06 ` [PATCH 05/34] 3c515: remove unused 'mtu' variable Arnd Bergmann
2024-04-03  8:06 ` [PATCH 06/34] tracing: hide unused ftrace_event_id_fops Arnd Bergmann
2024-04-03  8:06 ` [PATCH 07/34] Input: stmpe-ts - mark OF related data as maybe unused Arnd Bergmann
2024-04-03  9:40   ` Andy Shevchenko
2024-04-03  9:52     ` Krzysztof Kozlowski
2024-04-03 10:03       ` Andy Shevchenko
2024-04-03 10:10         ` Krzysztof Kozlowski
2024-04-03 13:17   ` Uwe Kleine-König
2024-04-03 13:27     ` Uwe Kleine-König
2024-04-03  8:06 ` [PATCH 08/34] Input: synaptics: hide unused smbus_pnp_ids[] array Arnd Bergmann
2024-04-03  8:06 ` [PATCH 09/34] power: rt9455: hide unused rt9455_boost_voltage_values Arnd Bergmann
2024-04-03  8:06 ` [PATCH 10/34] efi: sysfb: don't build when EFI is disabled Arnd Bergmann
2024-04-03 13:03   ` Ard Biesheuvel
2024-04-03 13:15     ` Javier Martinez Canillas
2024-04-03  8:06 ` [PATCH 11/34] clk: ti: dpll: fix incorrect #ifdef checks Arnd Bergmann
2024-04-03  9:00   ` Tony Lindgren
2024-04-05 21:13   ` Stephen Boyd
2024-04-03  8:06 ` [PATCH 12/34] apm-emulation: hide an unused variable Arnd Bergmann
2024-04-03 12:23   ` Jiri Kosina
2024-04-03  8:06 ` [PATCH 13/34] sisfb: hide unused variables Arnd Bergmann
2024-04-03 12:39   ` Helge Deller
2024-04-03  8:06 ` [PATCH 14/34] dma/congiguous: avoid warning about unused size_bytes Arnd Bergmann
2024-04-03  9:42   ` Christoph Hellwig
2024-04-03  8:06 ` [PATCH 15/34] leds: apu: remove duplicate DMI lookup data Arnd Bergmann
2024-04-11 15:51   ` (subset) " Lee Jones
2024-04-03  8:06 ` [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver Arnd Bergmann
2024-04-03  9:36   ` Andy Shevchenko
2024-04-03  9:55   ` Krzysztof Kozlowski
2024-04-03 10:01     ` Arnd Bergmann
2024-04-06 15:30       ` Jonathan Cameron
2024-04-06 15:31     ` Jonathan Cameron
2024-04-03  8:06 ` [PATCH 17/34] greybus: arche-ctrl: move device table to its right location Arnd Bergmann
2024-04-30 23:41   ` Alex Elder
2024-04-03  8:06 ` [PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[] Arnd Bergmann
2024-04-03  8:41   ` Christophe Leroy
2024-04-03  8:58     ` Arnd Bergmann
2024-04-03  9:03       ` Christophe Leroy
2024-04-04 11:43         ` Arnd Bergmann
2024-04-03  8:06 ` [PATCH 19/34] sunrpc: suppress warnings for unused procfs functions Arnd Bergmann
2024-04-03  8:59   ` Jeff Layton
2024-04-03 13:20   ` Chuck Lever
2024-04-03  8:06 ` [PATCH 20/34] comedi: ni_atmio: avoid warning for unused device_ids[] table Arnd Bergmann
2024-04-03  8:06 ` [PATCH 21/34] iwlegacy: don't warn for unused variables with DEBUG_FS=n Arnd Bergmann
2024-04-03  9:33   ` Andy Shevchenko
2024-04-03 14:26   ` Jeff Johnson
2024-04-03  8:06 ` [PATCH 22/34] drm/komeda: don't warn for unused debugfs files Arnd Bergmann
2024-04-03  8:06 ` [PATCH 23/34] firmware: qcom_scm: mark qcom_scm_qseecom_allowlist as __maybe_unused Arnd Bergmann
2024-04-03  9:31   ` Krzysztof Kozlowski
2024-04-03  8:06 ` [PATCH 24/34] crypto: ccp - drop platform ifdef checks Arnd Bergmann
2024-04-03 15:17   ` Tom Lendacky
2024-04-03 15:50     ` Arnd Bergmann
2024-04-12  7:30   ` Herbert Xu
2024-04-03  8:06 ` [PATCH 25/34] usb: gadget: omap_udc: remove unused variable Arnd Bergmann
2024-04-05 22:51   ` Aaro Koskinen
2024-04-03  8:06 ` [PATCH 26/34] isdn: kcapi: don't build unused procfs code Arnd Bergmann
2024-04-03  8:06 ` [PATCH 27/34] cpufreq: intel_pstate: hide unused intel_pstate_cpu_oob_ids[] Arnd Bergmann
2024-04-03 14:43   ` Rafael J. Wysocki
2024-04-03  8:06 ` [PATCH 28/34] net: xgbe: remove extraneous #ifdef checks Arnd Bergmann
2024-04-03  8:06 ` [PATCH 29/34] Input: imagis - remove incorrect ifdef checks Arnd Bergmann
2024-04-03  8:06 ` [PATCH 30/34] sata: mv: drop unnecessary #ifdef checks Arnd Bergmann
2024-04-03  8:29   ` Damien Le Moal
2024-04-03  8:32   ` Damien Le Moal
2024-04-03  8:50     ` Arnd Bergmann
2024-04-04  3:45       ` Damien Le Moal
2024-04-03  9:10   ` Andy Shevchenko
2024-04-03  8:06 ` [PATCH 31/34] spi: remove incorrect of_match_ptr annotations Arnd Bergmann
2024-04-03  9:04   ` Andy Shevchenko
2024-04-03  9:05   ` Krzysztof Kozlowski
2024-04-03  9:56   ` Mark Brown
2024-04-03 21:05     ` Uwe Kleine-König
2024-04-03 21:13       ` Andy Shevchenko
2024-04-03 22:19         ` Arnd Bergmann
2024-04-03  8:06 ` [PATCH 32/34] ASoC: remove incorrect of_match_ptr/ACPI_PTR annotations Arnd Bergmann
2024-04-03  9:06   ` Krzysztof Kozlowski
2024-04-03  9:15   ` Andy Shevchenko
2024-04-03  8:06 ` [PATCH 33/34] drivers: " Arnd Bergmann
2024-04-03  9:13   ` Krzysztof Kozlowski
2024-04-03  9:30   ` Andy Shevchenko
2024-04-03 12:47     ` Corey Minyard
2024-04-03 13:23       ` Andy Shevchenko
2024-04-03 12:47   ` Corey Minyard
2024-04-03 16:09   ` Jarkko Sakkinen
2024-04-09 13:48   ` Greg Kroah-Hartman
2024-04-23  7:33   ` Xu Yilun
2024-04-23  9:52   ` Peter Rosin
2024-04-03  8:06 ` [PATCH 34/34] kbuild: always enable -Wunused-const-variable Arnd Bergmann
2024-04-03  9:19   ` Andy Shevchenko
2024-04-03  9:26     ` Arnd Bergmann
2024-04-06  5:20 ` [PATCH 00/34] address all -Wunused-const warnings patchwork-bot+netdevbpf
2024-04-10  8:02 ` (subset) " Sebastian Reichel
2024-04-22  8:16 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).