* [PATCH] serial: max310x: fix compile errors if CONFIG_SPI_MASTER is disabled
@ 2026-05-12 15:27 Hugo Villeneuve
2026-05-15 10:05 ` kernel test robot
0 siblings, 1 reply; 2+ messages in thread
From: Hugo Villeneuve @ 2026-05-12 15:27 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve
Cc: hugo, linux-serial, kernel test robot, linux-kernel
From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Since commit 20ffe4b3330a8 ("serial: max310x: allow driver to be built with
SPI or I2C"), if I2C is enabled and SPI_MASTER is disabled, we have these
compile errors:
drivers/tty/serial/max310x.c: In function 'max310x_uart_init':
drivers/tty/serial/max310x.c: error: 'max310x_spi_driver' undeclared...
drivers/tty/serial/max310x.c: In function ‘max310x_uart_init’:
drivers/tty/serial/max310x.c: error: label ‘err_spi_register’
defined but not used...
drivers/tty/serial/max310x.c: error: ‘regcfg’ defined but not used
Fix by properly encapsulating i2c/spi code/variables in their respective
context with CONFIG_I2C and CONFIG_SPI_MASTER.
Fixes: 20ffe4b3330a8 ("serial: max310x: allow driver to be built with SPI or I2C")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202605121847.N9DVLNg2-lkp@intel.com/
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
note: not Cc-ing stable as the commit is still in tty-next, and even if the
errors originate from original commit that added I2C support, they were not
trigerred because the driver could not be selected/compiled if
CONFIG_SPI_MASTER was disabled.
---
drivers/tty/serial/max310x.c | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 9f423b3b4201d..8380fa1b0c0eb 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1507,6 +1507,21 @@ static const struct of_device_id __maybe_unused max310x_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, max310x_dt_ids);
+static const char *max310x_regmap_name(u8 port_id)
+{
+ switch (port_id) {
+ case 0: return "port0";
+ case 1: return "port1";
+ case 2: return "port2";
+ case 3: return "port3";
+ default:
+ WARN_ON(true);
+ return NULL;
+ }
+}
+
+#ifdef CONFIG_SPI_MASTER
+
static struct regmap_config regcfg = {
.reg_bits = 8,
.val_bits = 8,
@@ -1522,20 +1537,6 @@ static struct regmap_config regcfg = {
.max_raw_write = MAX310X_FIFO_SIZE,
};
-static const char *max310x_regmap_name(u8 port_id)
-{
- switch (port_id) {
- case 0: return "port0";
- case 1: return "port1";
- case 2: return "port2";
- case 3: return "port3";
- default:
- WARN_ON(true);
- return NULL;
- }
-}
-
-#ifdef CONFIG_SPI_MASTER
static int max310x_spi_extended_reg_enable(struct device *dev, bool enable)
{
struct max310x_port *s = dev_get_drvdata(dev);
@@ -1742,10 +1743,11 @@ static int __init max310x_uart_init(void)
#ifdef CONFIG_I2C
err_i2c_register:
- spi_unregister_driver(&max310x_spi_driver);
#endif
-
+#ifdef CONFIG_SPI_MASTER
+ spi_unregister_driver(&max310x_spi_driver);
err_spi_register:
+#endif
uart_unregister_driver(&max310x_uart);
return ret;
base-commit: 16e95bfb79b5d9d01dc7651d98caf3c2ace331cd
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] serial: max310x: fix compile errors if CONFIG_SPI_MASTER is disabled
2026-05-12 15:27 [PATCH] serial: max310x: fix compile errors if CONFIG_SPI_MASTER is disabled Hugo Villeneuve
@ 2026-05-15 10:05 ` kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-05-15 10:05 UTC (permalink / raw)
To: Hugo Villeneuve, Greg Kroah-Hartman, Jiri Slaby, Hugo Villeneuve
Cc: oe-kbuild-all, hugo, linux-serial, kernel test robot,
linux-kernel
Hi Hugo,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 16e95bfb79b5d9d01dc7651d98caf3c2ace331cd]
url: https://github.com/intel-lab-lkp/linux/commits/Hugo-Villeneuve/serial-max310x-fix-compile-errors-if-CONFIG_SPI_MASTER-is-disabled/20260515-014130
base: 16e95bfb79b5d9d01dc7651d98caf3c2ace331cd
patch link: https://lore.kernel.org/r/20260512152749.1767622-1-hugo%40hugovil.com
patch subject: [PATCH] serial: max310x: fix compile errors if CONFIG_SPI_MASTER is disabled
config: alpha-randconfig-r063-20260515 (https://download.01.org/0day-ci/archive/20260515/202605151854.fLunCPPN-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 14.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260515/202605151854.fLunCPPN-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605151854.fLunCPPN-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/tty/serial/max310x.c:1510:20: warning: 'max310x_regmap_name' defined but not used [-Wunused-function]
1510 | static const char *max310x_regmap_name(u8 port_id)
| ^~~~~~~~~~~~~~~~~~~
drivers/tty/serial/max310x.c:1482:13: warning: 'max310x_remove' defined but not used [-Wunused-function]
1482 | static void max310x_remove(struct device *dev)
| ^~~~~~~~~~~~~~
drivers/tty/serial/max310x.c:1298:12: warning: 'max310x_probe' defined but not used [-Wunused-function]
1298 | static int max310x_probe(struct device *dev, const struct max310x_devtype *devtype,
| ^~~~~~~~~~~~~
>> drivers/tty/serial/max310x.c:515:13: warning: 'max310x_reg_noinc' defined but not used [-Wunused-function]
515 | static bool max310x_reg_noinc(struct device *dev, unsigned int reg)
| ^~~~~~~~~~~~~~~~~
>> drivers/tty/serial/max310x.c:502:13: warning: 'max310x_reg_precious' defined but not used [-Wunused-function]
502 | static bool max310x_reg_precious(struct device *dev, unsigned int reg)
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/tty/serial/max310x.c:482:13: warning: 'max310x_reg_volatile' defined but not used [-Wunused-function]
482 | static bool max310x_reg_volatile(struct device *dev, unsigned int reg)
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/tty/serial/max310x.c:467:13: warning: 'max310x_reg_writeable' defined but not used [-Wunused-function]
467 | static bool max310x_reg_writeable(struct device *dev, unsigned int reg)
| ^~~~~~~~~~~~~~~~~~~~~
vim +/max310x_reg_noinc +515 drivers/tty/serial/max310x.c
003236d9ac4d027 Alexander Shiyan 2013-06-29 466
10d8b34a421716d Alexander Shiyan 2013-06-29 @467 static bool max310x_reg_writeable(struct device *dev, unsigned int reg)
f65444187a66bf5 Alexander Shiyan 2012-08-06 468 {
6ef281daf020592 Cosmin Tanislav 2022-06-05 469 switch (reg) {
f65444187a66bf5 Alexander Shiyan 2012-08-06 470 case MAX310X_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 471 case MAX310X_LSR_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 472 case MAX310X_SPCHR_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 473 case MAX310X_STS_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 474 case MAX310X_TXFIFOLVL_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 475 case MAX310X_RXFIFOLVL_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 476 return false;
f65444187a66bf5 Alexander Shiyan 2012-08-06 477 default:
f65444187a66bf5 Alexander Shiyan 2012-08-06 478 return true;
f65444187a66bf5 Alexander Shiyan 2012-08-06 479 }
d5dd265cda8083c Hugo Villeneuve 2024-01-18 480 }
f65444187a66bf5 Alexander Shiyan 2012-08-06 481
f65444187a66bf5 Alexander Shiyan 2012-08-06 @482 static bool max310x_reg_volatile(struct device *dev, unsigned int reg)
f65444187a66bf5 Alexander Shiyan 2012-08-06 483 {
6ef281daf020592 Cosmin Tanislav 2022-06-05 484 switch (reg) {
f65444187a66bf5 Alexander Shiyan 2012-08-06 485 case MAX310X_RHR_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 486 case MAX310X_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 487 case MAX310X_LSR_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 488 case MAX310X_SPCHR_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 489 case MAX310X_STS_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 490 case MAX310X_TXFIFOLVL_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 491 case MAX310X_RXFIFOLVL_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 492 case MAX310X_GPIODATA_REG:
10d8b34a421716d Alexander Shiyan 2013-06-29 493 case MAX310X_BRGDIVLSB_REG:
10d8b34a421716d Alexander Shiyan 2013-06-29 494 case MAX310X_REG_05:
10d8b34a421716d Alexander Shiyan 2013-06-29 495 case MAX310X_REG_1F:
f65444187a66bf5 Alexander Shiyan 2012-08-06 496 return true;
f65444187a66bf5 Alexander Shiyan 2012-08-06 497 default:
f65444187a66bf5 Alexander Shiyan 2012-08-06 498 return false;
f65444187a66bf5 Alexander Shiyan 2012-08-06 499 }
d5dd265cda8083c Hugo Villeneuve 2024-01-18 500 }
f65444187a66bf5 Alexander Shiyan 2012-08-06 501
f65444187a66bf5 Alexander Shiyan 2012-08-06 @502 static bool max310x_reg_precious(struct device *dev, unsigned int reg)
f65444187a66bf5 Alexander Shiyan 2012-08-06 503 {
6ef281daf020592 Cosmin Tanislav 2022-06-05 504 switch (reg) {
f65444187a66bf5 Alexander Shiyan 2012-08-06 505 case MAX310X_RHR_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 506 case MAX310X_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 507 case MAX310X_SPCHR_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 508 case MAX310X_STS_IRQSTS_REG:
f65444187a66bf5 Alexander Shiyan 2012-08-06 509 return true;
f65444187a66bf5 Alexander Shiyan 2012-08-06 510 default:
f65444187a66bf5 Alexander Shiyan 2012-08-06 511 return false;
f65444187a66bf5 Alexander Shiyan 2012-08-06 512 }
d5dd265cda8083c Hugo Villeneuve 2024-01-18 513 }
f65444187a66bf5 Alexander Shiyan 2012-08-06 514
3f42b142ea11719 Jan Kundrát 2023-04-05 @515 static bool max310x_reg_noinc(struct device *dev, unsigned int reg)
3f42b142ea11719 Jan Kundrát 2023-04-05 516 {
3f42b142ea11719 Jan Kundrát 2023-04-05 517 return reg == MAX310X_RHR_REG;
3f42b142ea11719 Jan Kundrát 2023-04-05 518 }
3f42b142ea11719 Jan Kundrát 2023-04-05 519
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-15 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 15:27 [PATCH] serial: max310x: fix compile errors if CONFIG_SPI_MASTER is disabled Hugo Villeneuve
2026-05-15 10:05 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox