cxl: fix CONFIG_FW_LOADER dependency

Message ID 20230703112928.332321-1-arnd@kernel.org
State New
Headers
Series cxl: fix CONFIG_FW_LOADER dependency |

Commit Message

Arnd Bergmann July 3, 2023, 11:29 a.m. UTC
  From: Arnd Bergmann <arnd@arndb.de>

When FW_LOADER is disabled, cxl fails to link:

arm-linux-gnueabi-ld: drivers/cxl/core/memdev.o: in function `cxl_memdev_setup_fw_upload':
memdev.c:(.text+0x90e): undefined reference to `firmware_upload_register'
memdev.c:(.text+0x93c): undefined reference to `firmware_upload_unregister'

In order to use the firmware_upload_register() function, both FW_LOADER
and FW_UPLOAD have to be enabled, which is a bit confusing. In addition,
the dependency is on the wrong symbol, as the caller is part of the
cxl_core.ko module, not the cxl_mem.ko module.

Fixes: 9521875bbe005 ("cxl: add a firmware update mechanism using the sysfs firmware loader")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/cxl/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Dave Jiang July 5, 2023, 3:54 p.m. UTC | #1
On 7/3/23 04:29, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When FW_LOADER is disabled, cxl fails to link:
> 
> arm-linux-gnueabi-ld: drivers/cxl/core/memdev.o: in function `cxl_memdev_setup_fw_upload':
> memdev.c:(.text+0x90e): undefined reference to `firmware_upload_register'
> memdev.c:(.text+0x93c): undefined reference to `firmware_upload_unregister'
> 
> In order to use the firmware_upload_register() function, both FW_LOADER
> and FW_UPLOAD have to be enabled, which is a bit confusing. In addition,
> the dependency is on the wrong symbol, as the caller is part of the
> cxl_core.ko module, not the cxl_mem.ko module.
> 
> Fixes: 9521875bbe005 ("cxl: add a firmware update mechanism using the sysfs firmware loader")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>   drivers/cxl/Kconfig | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/Kconfig b/drivers/cxl/Kconfig
> index fcbf8295fde37..8ea1d340e4385 100644
> --- a/drivers/cxl/Kconfig
> +++ b/drivers/cxl/Kconfig
> @@ -2,6 +2,8 @@
>   menuconfig CXL_BUS
>   	tristate "CXL (Compute Express Link) Devices Support"
>   	depends on PCI
> +	select FW_LOADER
> +	select FW_UPLOAD
>   	select PCI_DOE
>   	help
>   	  CXL is a bus that is electrically compatible with PCI Express, but
> @@ -82,7 +84,6 @@ config CXL_PMEM
>   config CXL_MEM
>   	tristate "CXL: Memory Expansion"
>   	depends on CXL_PCI
> -	select FW_UPLOAD
>   	default CXL_BUS
>   	help
>   	  The CXL.mem protocol allows a device to act as a provider of "System
  
Xiao Yang July 6, 2023, 10:50 a.m. UTC | #2
On 2023/7/3 19:29, Arnd Bergmann wrote:
> From: Arnd Bergmann<arnd@arndb.de>
> 
> When FW_LOADER is disabled, cxl fails to link:
> 
> arm-linux-gnueabi-ld: drivers/cxl/core/memdev.o: in function `cxl_memdev_setup_fw_upload':
> memdev.c:(.text+0x90e): undefined reference to `firmware_upload_register'
> memdev.c:(.text+0x93c): undefined reference to `firmware_upload_unregister'
> 
> In order to use the firmware_upload_register() function, both FW_LOADER
> and FW_UPLOAD have to be enabled, which is a bit confusing. In addition,
> the dependency is on the wrong symbol, as the caller is part of the
> cxl_core.ko module, not the cxl_mem.ko module.
> 
> Fixes: 9521875bbe005 ("cxl: add a firmware update mechanism using the sysfs firmware loader")
> Signed-off-by: Arnd Bergmann<arnd@arndb.de>

Hi Arnd,

It makes sense.

Reviewed-by: Xiao Yang <yangx.jy@fujitsu.com>

Best Regards,
Xiao Yang
  

Patch

diff --git a/drivers/cxl/Kconfig b/drivers/cxl/Kconfig
index fcbf8295fde37..8ea1d340e4385 100644
--- a/drivers/cxl/Kconfig
+++ b/drivers/cxl/Kconfig
@@ -2,6 +2,8 @@ 
 menuconfig CXL_BUS
 	tristate "CXL (Compute Express Link) Devices Support"
 	depends on PCI
+	select FW_LOADER
+	select FW_UPLOAD
 	select PCI_DOE
 	help
 	  CXL is a bus that is electrically compatible with PCI Express, but
@@ -82,7 +84,6 @@  config CXL_PMEM
 config CXL_MEM
 	tristate "CXL: Memory Expansion"
 	depends on CXL_PCI
-	select FW_UPLOAD
 	default CXL_BUS
 	help
 	  The CXL.mem protocol allows a device to act as a provider of "System