[PATCH] mtd: nand: Fix build error while CONFIG_MTD_NAND_ECC_SW_BCH is set to module

YueHaibing yuehaibing at huawei.com
Wed Apr 10 07:22:16 PDT 2019


On 2019/4/10 21:58, Boris Brezillon wrote:
> On Wed, 10 Apr 2019 15:39:28 +0200
> Boris Brezillon <boris.brezillon at collabora.com> wrote:
> 
>> On Wed, 10 Apr 2019 21:07:47 +0800
>> Yue Haibing <yuehaibing at huawei.com> wrote:
>>
>>> From: YueHaibing <yuehaibing at huawei.com>
>>>
>>> Fix gcc build error while CONFIG_MTD_NAND_ECC_SW_BCH
>>> is set to module:
>>>
>>> drivers/mtd/nand/raw/nand_base.o: In function `nand_cleanup':
>>> (.text+0xef6): undefined reference to `nand_bch_free'
>>> drivers/mtd/nand/raw/nand_base.o: In function `nand_scan_tail':
>>> nand_base.c:(.text+0xa101): undefined reference to `nand_bch_calculate_ecc'
>>> nand_base.c:(.text+0xa120): undefined reference to `nand_bch_correct_data'
>>> nand_base.c:(.text+0xa269): undefined reference to `nand_bch_init'
>>>
>>> CONFIG_MTD_NAND_ECC_SW_BCH should not be set to M,
>>> because MTD_RAW_NAND need it while linked.
>>>
>>> Reported-by: Hulk Robot <hulkci at huawei.com>
>>> Fixes: 193bd4002644 ("mtd: nand: add software BCH ECC support"  
>>
>> Nope, it's not this one that introduced the regression.
>>
>>
>>
>>> Signed-off-by: YueHaibing <yuehaibing at huawei.com>
>>> ---
>>>  drivers/mtd/nand/raw/Kconfig | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
>>> index 615d738..0500c42 100644
>>> --- a/drivers/mtd/nand/raw/Kconfig
>>> +++ b/drivers/mtd/nand/raw/Kconfig
>>> @@ -22,7 +22,7 @@ menuconfig MTD_RAW_NAND
>>>  if MTD_RAW_NAND
>>>  
>>>  config MTD_NAND_ECC_SW_BCH
>>> -	tristate "Support software BCH ECC"
>>> +	bool "Support software BCH ECC"
>>>  	select BCH
>>>  	default n
>>>  	help  
>>
>> Should be fixed with the following diff squashed into:
>>
>> 51ef1d0b2095 ("mtd: nand: Clarify Kconfig entry for software BCH ECC algorithm")
>>
>> --->8---  
>> diff --git a/include/linux/mtd/nand_bch.h b/include/linux/mtd/nand_bch.h
>> index b8106651f807..06ce2b655c13 100644
>> --- a/include/linux/mtd/nand_bch.h
>> +++ b/include/linux/mtd/nand_bch.h
>> @@ -15,7 +15,7 @@ struct mtd_info;
>>  struct nand_chip;
>>  struct nand_bch_control;
>>  
>> -#if defined(CONFIG_MTD_NAND_ECC_BCH)
>> +#if defined(CONFIG_MTD_NAND_ECC_SW_BCH)
>>  
>>  static inline int mtd_nand_has_bch(void) { return 1; }
>>  
>> @@ -39,7 +39,7 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd);
>>   */
>>  void nand_bch_free(struct nand_bch_control *nbc);
>>  
>> -#else /* !CONFIG_MTD_NAND_ECC_BCH */
>> +#else /* !CONFIG_MTD_NAND_ECC_SW_BCH */
>>  
>>  static inline int mtd_nand_has_bch(void) { return 0; }
>>  
>> @@ -64,6 +64,6 @@ static inline struct nand_bch_control *nand_bch_init(struct mtd_info *mtd)
>>  
>>  static inline void nand_bch_free(struct nand_bch_control *nbc) {}
>>  
>> -#endif /* CONFIG_MTD_NAND_ECC_BCH */
>> +#endif /* CONFIG_MTD_NAND_ECC_SW_BCH */
>>  
>>  #endif /* __MTD_NAND_BCH_H__ */
> 
> Sorry, I didn't look at the right branch, this part of the code was
> correct, but we still have a problem to express the RAW_NAND(y) ->
> SW_BCH(y) dependency.

It seems this dependency is not always need,

case MTD_RAW_NAND set to y works well while CONFIG_MTD_NAND_ECC_SW_BCH is not set.

> 
> .
> 




More information about the linux-mtd mailing list