diff mbox series

scsi: esp_scsi: limit build to builtin only

Message ID 20211126032151.15040-1-rdunlap@infradead.org (mailing list archive)
State Changes Requested
Headers show
Series scsi: esp_scsi: limit build to builtin only | expand

Commit Message

Randy Dunlap Nov. 26, 2021, 3:21 a.m. UTC
When CONFIG_SCSI=m and CONFIG_JAZZ_ESP=y, esp_scsi.c cannot reference
the modular SCSI subsytem symbols (this is a partial list):

   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `esp_setsync':
   esp_scsi.c:(.text+0xc04): undefined reference to `spi_display_xfer_agreement'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `scsi_esp_register':
   (.text+0xdec): undefined reference to `scsi_add_host_with_dma'
   mips64-linux-ld: (.text+0xe0c): undefined reference to `scsi_scan_host'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `scsi_esp_unregister':
   (.text+0xf70): undefined reference to `scsi_remove_host'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `esp_set_offset':
   esp_scsi.c:(.text+0xfa8): undefined reference to `scsi_is_host_device'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `esp_slave_configure':
   esp_scsi.c:(.text+0x10bc): undefined reference to `scsi_change_queue_depth'
   mips64-linux-ld: esp_scsi.c:(.text+0x10e8): undefined reference to `spi_dv_device'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `esp_data_bytes_sent':
   esp_scsi.c:(.text+0x15b4): undefined reference to `scsi_kmap_atomic_sg'
   mips64-linux-ld: esp_scsi.c:(.text+0x15cc): undefined reference to `scsi_kunmap_atomic_sg'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `esp_reset_cleanup':
   esp_scsi.c:(.text+0x192c): undefined reference to `scsi_done'
   mips64-linux-ld: esp_scsi.c:(.text+0x1ac0): undefined reference to `scsi_dma_unmap'
   mips64-linux-ld: esp_scsi.c:(.text+0x1b2c): undefined reference to `__starget_for_each_device'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `esp_maybe_execute_command.part.0':
   esp_scsi.c:(.text+0x2108): undefined reference to `spi_populate_tag_msg'
   mips64-linux-ld: esp_scsi.c:(.text+0x2350): undefined reference to `scsi_dma_map'
   mips64-linux-ld: esp_scsi.c:(.text+0x2488): undefined reference to `spi_populate_sync_msg'
   mips64-linux-ld: esp_scsi.c:(.text+0x2798): undefined reference to `spi_populate_width_msg'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `esp_reconnect':
   esp_scsi.c:(.text+0x3010): undefined reference to `__scsi_device_lookup_by_target'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `esp_process_event':
   esp_scsi.c:(.text+0x3f08): undefined reference to `scsi_track_queue_full'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `esp_exit':
   esp_scsi.c:(.exit.text+0x4): undefined reference to `spi_release_transport'
   mips64-linux-ld: drivers/scsi/esp_scsi.o: in function `esp_init':
   esp_scsi.c:(.init.text+0xc): undefined reference to `spi_attach_transport'
   mips64-linux-ld: drivers/scsi/jazz_esp.o: in function `esp_jazz_remove':
   jazz_esp.c:(.text+0x98): undefined reference to `scsi_host_put'
   mips64-linux-ld: drivers/scsi/jazz_esp.o: in function `esp_jazz_probe':
   jazz_esp.c:(.text+0x1e4): undefined reference to `scsi_host_alloc'

Since JAZZ_ESP is a bool Kconfig symbol, make the driver only available
to be built when CONFIG_SCSI=y to eliminate the build errors.

Fixes: f8ab27d96494 ("scsi: esp_scsi: Call scsi_done() directly")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
---
 drivers/scsi/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bart Van Assche Nov. 26, 2021, 10:48 p.m. UTC | #1
On 11/25/21 19:21, Randy Dunlap wrote:
> Fixes: f8ab27d96494 ("scsi: esp_scsi: Call scsi_done() directly")

The build robot reported link failures for many more functions than 
scsi_done() so I do not agree with the above line.

> --- linux-next-20211125.orig/drivers/scsi/Kconfig
> +++ linux-next-20211125/drivers/scsi/Kconfig
> @@ -1296,7 +1296,7 @@ source "drivers/scsi/arm/Kconfig"
>   
>   config JAZZ_ESP
>   	bool "MIPS JAZZ FAS216 SCSI support"
> -	depends on MACH_JAZZ && SCSI
> +	depends on MACH_JAZZ && SCSI=y
>   	select SCSI_SPI_ATTRS
>   	help
>   	  This is the driver for the onboard SCSI host adapter of MIPS Magnum

There are many more similar entries in drivers/scsi. Why to modify only 
one entry instead of modifying them all?

Additionally, to me it seems that the root cause is in the kbuild 
infrastructure instead of in drivers/scsi/Kconfig. From
Documentation/kbuild/kconfig-language.rst about "select <symbol>": "The 
value of the current menu symbol is used as the minimal value <symbol> 
can be set to."

The build errors are the result of the combination JAZZ_ESP=y and 
SCSI_SPI_ATTRS=m. Since that combination is not allowed according to the 
kbuild documention, I think the kbuild infrastructure should be fixed.

Thanks,

Bart.
diff mbox series

Patch

--- linux-next-20211125.orig/drivers/scsi/Kconfig
+++ linux-next-20211125/drivers/scsi/Kconfig
@@ -1296,7 +1296,7 @@  source "drivers/scsi/arm/Kconfig"
 
 config JAZZ_ESP
 	bool "MIPS JAZZ FAS216 SCSI support"
-	depends on MACH_JAZZ && SCSI
+	depends on MACH_JAZZ && SCSI=y
 	select SCSI_SPI_ATTRS
 	help
 	  This is the driver for the onboard SCSI host adapter of MIPS Magnum