[PATCH v1] scsi: ufs: Fix RPMB link error by reversing Kconfig dependencies

Bean Huo posted 1 patch 2 weeks, 3 days ago
drivers/misc/Kconfig | 1 -
drivers/ufs/Kconfig  | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
[PATCH v1] scsi: ufs: Fix RPMB link error by reversing Kconfig dependencies
Posted by Bean Huo 2 weeks, 3 days ago
From: Bean Huo <beanhuo@micron.com>

When CONFIG_SCSI_UFSHCD=y and CONFIG_RPMB=m, the kernel fails to link
with undefined references to ufs_rpmb_probe() and ufs_rpmb_remove():

ld: drivers/ufs/core/ufshcd.c:8950: undefined reference to `ufs_rpmb_probe'
ld: drivers/ufs/core/ufshcd.c:10505: undefined reference to `ufs_rpmb_remove'

The issue is that RPMB depends on its consumers (MMC, UFS) in Kconfig, which
is backwards. This prevents proper module dependency handling when the library
is modular but consumers are built-in.

Fix by reversing the dependency:
- Remove 'depends on MMC || SCSI_UFSHCD' from RPMB Kconfig
- Add 'depends on RPMB || !RPMB' to SCSI_UFSHCD Kconfig

This allows RPMB to be an independent library while ensuring correct
linking in all module/built-in combinations.

Fixes: b06b8c421485 ("scsi: ufs: core: Add OP-TEE based RPMB driver for UFS devices")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202511300443.h7sotuL0-lkp@intel.com/
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/misc/Kconfig | 1 -
 drivers/ufs/Kconfig  | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 9d1de68dee27..d7d41b054b98 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -106,7 +106,6 @@ config PHANTOM
 
 config RPMB
 	tristate "RPMB partition interface"
-	depends on MMC || SCSI_UFSHCD
 	help
 	  Unified RPMB unit interface for RPMB capable devices such as eMMC and
 	  UFS. Provides interface for in-kernel security controllers to access
diff --git a/drivers/ufs/Kconfig b/drivers/ufs/Kconfig
index 90226f72c158..f662e7ce71f1 100644
--- a/drivers/ufs/Kconfig
+++ b/drivers/ufs/Kconfig
@@ -6,6 +6,7 @@
 menuconfig SCSI_UFSHCD
 	tristate "Universal Flash Storage Controller"
 	depends on SCSI && SCSI_DMA
+	depends on RPMB || !RPMB
 	select PM_DEVFREQ
 	select DEVFREQ_GOV_SIMPLE_ONDEMAND
 	select NLS
-- 
2.34.1
Re: [PATCH v1] scsi: ufs: Fix RPMB link error by reversing Kconfig dependencies
Posted by Martin K. Petersen 1 week, 3 days ago
On Tue, 02 Dec 2025 16:51:38 +0100, Bean Huo wrote:

> When CONFIG_SCSI_UFSHCD=y and CONFIG_RPMB=m, the kernel fails to link
> with undefined references to ufs_rpmb_probe() and ufs_rpmb_remove():
> 
> ld: drivers/ufs/core/ufshcd.c:8950: undefined reference to `ufs_rpmb_probe'
> ld: drivers/ufs/core/ufshcd.c:10505: undefined reference to `ufs_rpmb_remove'
> 
> The issue is that RPMB depends on its consumers (MMC, UFS) in Kconfig, which
> is backwards. This prevents proper module dependency handling when the library
> is modular but consumers are built-in.
> 
> [...]

Applied to 6.19/scsi-queue, thanks!

[1/1] scsi: ufs: Fix RPMB link error by reversing Kconfig dependencies
      https://git.kernel.org/mkp/scsi/c/d98b4d52bff0

-- 
Martin K. Petersen
Re: [PATCH v1] scsi: ufs: Fix RPMB link error by reversing Kconfig dependencies
Posted by Martin K. Petersen 2 weeks, 2 days ago
Bean,

> When CONFIG_SCSI_UFSHCD=y and CONFIG_RPMB=m, the kernel fails to link
> with undefined references to ufs_rpmb_probe() and ufs_rpmb_remove():

Applied to 6.19/scsi-staging, thanks!

-- 
Martin K. Petersen
Re: [PATCH v1] scsi: ufs: Fix RPMB link error by reversing Kconfig dependencies
Posted by Bart Van Assche 2 weeks, 2 days ago
On 12/2/25 5:51 AM, Bean Huo wrote:
> Fix by reversing the dependency:
> - Remove 'depends on MMC || SCSI_UFSHCD' from RPMB Kconfig
> - Add 'depends on RPMB || !RPMB' to SCSI_UFSHCD Kconfig

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Re: [PATCH v1] scsi: ufs: Fix RPMB link error by reversing Kconfig dependencies
Posted by Jens Wiklander 2 weeks, 3 days ago
On Tue, Dec 2, 2025 at 4:52 PM Bean Huo <beanhuo@iokpp.de> wrote:
>
> From: Bean Huo <beanhuo@micron.com>
>
> When CONFIG_SCSI_UFSHCD=y and CONFIG_RPMB=m, the kernel fails to link
> with undefined references to ufs_rpmb_probe() and ufs_rpmb_remove():
>
> ld: drivers/ufs/core/ufshcd.c:8950: undefined reference to `ufs_rpmb_probe'
> ld: drivers/ufs/core/ufshcd.c:10505: undefined reference to `ufs_rpmb_remove'
>
> The issue is that RPMB depends on its consumers (MMC, UFS) in Kconfig, which
> is backwards. This prevents proper module dependency handling when the library
> is modular but consumers are built-in.
>
> Fix by reversing the dependency:
> - Remove 'depends on MMC || SCSI_UFSHCD' from RPMB Kconfig
> - Add 'depends on RPMB || !RPMB' to SCSI_UFSHCD Kconfig
>
> This allows RPMB to be an independent library while ensuring correct
> linking in all module/built-in combinations.
>
> Fixes: b06b8c421485 ("scsi: ufs: core: Add OP-TEE based RPMB driver for UFS devices")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202511300443.h7sotuL0-lkp@intel.com/
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Bart Van Assche <bvanassche@acm.org>
> Cc: Jens Wiklander <jens.wiklander@linaro.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
>  drivers/misc/Kconfig | 1 -
>  drivers/ufs/Kconfig  | 1 +
>  2 files changed, 1 insertion(+), 1 deletion(-)

Looks good:
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

Cheers,
Jens
Re: [PATCH v1] scsi: ufs: Fix RPMB link error by reversing Kconfig dependencies
Posted by Arnd Bergmann 2 weeks, 3 days ago
On Tue, Dec 2, 2025, at 16:51, Bean Huo wrote:
> From: Bean Huo <beanhuo@micron.com>
>
> When CONFIG_SCSI_UFSHCD=y and CONFIG_RPMB=m, the kernel fails to link
> with undefined references to ufs_rpmb_probe() and ufs_rpmb_remove():
>
> ld: drivers/ufs/core/ufshcd.c:8950: undefined reference to `ufs_rpmb_probe'
> ld: drivers/ufs/core/ufshcd.c:10505: undefined reference to `ufs_rpmb_remove'
>
> The issue is that RPMB depends on its consumers (MMC, UFS) in Kconfig, which
> is backwards. This prevents proper module dependency handling when the library
> is modular but consumers are built-in.
>
> Fix by reversing the dependency:
> - Remove 'depends on MMC || SCSI_UFSHCD' from RPMB Kconfig
> - Add 'depends on RPMB || !RPMB' to SCSI_UFSHCD Kconfig
>
> This allows RPMB to be an independent library while ensuring correct
> linking in all module/built-in combinations.
>
> Fixes: b06b8c421485 ("scsi: ufs: core: Add OP-TEE based RPMB driver for 
> UFS devices")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: 
> https://lore.kernel.org/oe-kbuild-all/202511300443.h7sotuL0-lkp@intel.com/
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Bart Van Assche <bvanassche@acm.org>
> Cc: Jens Wiklander <jens.wiklander@linaro.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Bean Huo <beanhuo@micron.com>

Looks good to me,

Reviewed-by: Arnd Bergmann <arnd@arndb.de>