[PATCH] Input: adxl34x: Add warning on shared compatible with adxl345

Jorge Marques posted 1 patch 3 weeks, 4 days ago
drivers/input/misc/Kconfig | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
[PATCH] Input: adxl34x: Add warning on shared compatible with adxl345
Posted by Jorge Marques 3 weeks, 4 days ago
INPUT_ADXL34X and ADXL345 share compatibles, previously it
wasn't possible to compile ADXL345 if INPUT_ADXL34X was enabled.
Changed to allow both as modules instead, then the user should blacklist
to block loading one, if his config selects both.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
---
There are two drivers for the compatible:

- adi,adxl345

* IIO:
  drivers/iio/accel/adxl345_core.c
  drivers/iio/accel/adxl345_spi.c
  drivers/iio/accel/adxl345_i2c.c
* Inputs:
  drivers/input/misc/adxl34x-spi.c
  drivers/input/misc/adxl34x-i2c.c

To disallows both being complied, the depends INPUT_ADXL34X=n
was added to ADXL345 symbols. However, it should be possible to compile
both as modules, then blacklist one of them in the /etc/modprobe.d/blacklist.conf
file.
So patch
https://lore.kernel.org/linux-iio/20251112-adxl345-allow-adxl34x-mod-v2-1-5b1561eae5a0@analog.com/T/#u
changes the rule to !(INPUT_ADXL34X) to allow both as modules, but still
disallow INPUT_ADXL34X to be built-in and ADXL345 as module.

Add warning to the input Kconfig to inform users.
---
 drivers/input/misc/Kconfig | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index cc2558630..df5c425c9 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -769,7 +769,9 @@ config INPUT_ADXL34X_I2C
 	  Say Y here if you have ADXL345/6 hooked to an I2C bus.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called adxl34x-i2c.
+	  module will be called adxl34x-i2c. ADXL345 share compatibles
+	  with this driver, choosing Y won't allow to select ADXL345.
+	  Do not add both modules to the kernel.
 
 config INPUT_ADXL34X_SPI
 	tristate "support SPI bus connection"
@@ -779,7 +781,9 @@ config INPUT_ADXL34X_SPI
 	  Say Y here if you have ADXL345/6 hooked to a SPI bus.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called adxl34x-spi.
+	  module will be called adxl34x-spi. ADXL345 share compatibles
+	  with this driver, choosing Y won't allow to select ADXL345.
+	  Do not add both modules to the kernel.
 
 config INPUT_IBM_PANEL
 	tristate "IBM Operation Panel driver"

---
base-commit: a311c777f2987e6ddba2d2dd2f82f2135d65f8aa
change-id: 20251112-input-adxl34x-1972753e2c62
prerequisite-message-id: 20251031-adxl345-allow-adxl34x-mod-v1-1-cd65749ba89c@analog.com
prerequisite-patch-id: ee005752c4daeb450e458f20d9de0ce7b24743ca

Best regards,
-- 
Jorge Marques <jorge.marques@analog.com>