Re: [PATCH] scsi: hisi_sas: Fix build error without SATA_HOST

From: Yuehaibing
Date: Thu Apr 02 2020 - 04:51:48 EST




On 2020/4/2 15:30, John Garry wrote:
> On 02/04/2020 07:30, YueHaibing wrote:
>
> +
>
>> If SATA_HOST is n, build fails:
>>
>> drivers/scsi/hisi_sas/hisi_sas_main.o: In function `hisi_sas_fill_ata_reset_cmd':
>> hisi_sas_main.c:(.text+0x2500): undefined reference to `ata_tf_to_fis'
>>
>> Select SATA_HOST to fix this.
>>
>> Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
>> Fixes: 7c594f0407de ("scsi: hisi_sas: add softreset function for SATA disk")
>
> That's not right. SATA_HOST was only introduced recently in the ATA code. It would fix those kconfig changes.

Ok, thanks

>
>> Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
>> ---
>> drivers/scsi/hisi_sas/Kconfig | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/scsi/hisi_sas/Kconfig b/drivers/scsi/hisi_sas/Kconfig
>> index 90a17452a50d..13ed9073fc72 100644
>> --- a/drivers/scsi/hisi_sas/Kconfig
>> +++ b/drivers/scsi/hisi_sas/Kconfig
>> @@ -6,6 +6,7 @@ config SCSI_HISI_SAS
>> select SCSI_SAS_LIBSAS
>> select BLK_DEV_INTEGRITY
>> depends on ATA
>> + select SATA_HOST
>
> That does not feel right.
>
> SCSI_HISI_SAS depends on ATA, but SATA_HOST also depends on ATA, so it seems better to just depend on SATA_HOST (and omit explicit ATA dependency), rather than select it.

Depends on SATA_HOST will result int this:

scripts/kconfig/mconf Kconfig
drivers/scsi/hisi_sas/Kconfig:2:error: recursive dependency detected!
drivers/scsi/hisi_sas/Kconfig:2: symbol SCSI_HISI_SAS depends on SATA_HOST
drivers/ata/Kconfig:37: symbol SATA_HOST is selected by SCSI_SAS_ATA
drivers/scsi/libsas/Kconfig:18: symbol SCSI_SAS_ATA depends on SCSI_SAS_LIBSAS
drivers/scsi/libsas/Kconfig:9: symbol SCSI_SAS_LIBSAS is selected by SCSI_HISI_SAS
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"


All users of SATA_HOST have the 'select' statement, so we should do the same here.

>
> Thanks,
> John
>
> .
>