Re: [PATCH v1] scsi: ufs: Fix RPMB link error by reversing Kconfig dependencies
From: Jens Wiklander
Date: Tue Dec 02 2025 - 11:12:06 EST
On Tue, Dec 2, 2025 at 4:52 PM Bean Huo <beanhuo@xxxxxxxx> wrote:
>
> From: Bean Huo <beanhuo@xxxxxxxxxx>
>
> 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@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202511300443.h7sotuL0-lkp@xxxxxxxxx/
> Suggested-by: Arnd Bergmann <arnd@xxxxxxxx>
> Cc: Bart Van Assche <bvanassche@xxxxxxx>
> Cc: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
> Cc: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
> Signed-off-by: Bean Huo <beanhuo@xxxxxxxxxx>
> ---
> drivers/misc/Kconfig | 1 -
> drivers/ufs/Kconfig | 1 +
> 2 files changed, 1 insertion(+), 1 deletion(-)
Looks good:
Reviewed-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
Cheers,
Jens