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

From: Arnd Bergmann
Date: Tue Dec 02 2025 - 10:57:55 EST


On Tue, Dec 2, 2025, at 16:51, Bean Huo 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>

Looks good to me,

Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>