Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5131314yba; Wed, 10 Apr 2019 12:03:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwA5GlzgCREpUZqUFsX7xEDITlcGAAxh5zYwzdye3pbY2TkVRggGNGgBcFb00+ImaZaukRJ X-Received: by 2002:a65:4341:: with SMTP id k1mr43184807pgq.88.1554922997535; Wed, 10 Apr 2019 12:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554922997; cv=none; d=google.com; s=arc-20160816; b=qkbNwFbMfY3un5nRrJTwBNwwiQiJNaxnymrcONTeg2YKRnv80/VP+Pywygt1A9PTOl Y9bEkj4b6DfDM6EC8JPM6pyt456qUMGma1WAdMDKRBHYx4R7tdU3QYMIghvjkbTfqIOP CoXVcro34Y0Z4HzaI7bMVRVOQE6PyN3tX06o4DUwSzFCr0YREJxNkAMpHLN7j71eMzD1 NXzJiTT+vmUZ16N1DQ/eftydWFpFQy54WyHxhIn2YbSEQboWApS56Z3nAloKdiBuTuZd GPeMHj2yEYEtJudYTXlP77ATr4vr7ijRqCeWeUZ2r9QAtlcUCsBDw/9GfXnCwxZdZPwv b1Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=cjmdzvp6N6YulsxtvqeNAdEo2CliEeGFKIL8TCenvZI=; b=ByA0nRjnOPB45C+Z7XisspLd0CGxZKBB6gti83okR/ECzpo4vGAganUFLuNNYbWfFr 0UzEcaAqxPkKmJw9r9deuHUR9e0pCSRqJQdNUenKMlyCNmBkOM8tobDc7BKaYIZSJdI8 47tzj9Ne5rtN/YZvwEYta9fGn4B8l6+fT5Mzn5V+NJAig3YbYXWiR1iWPnlHxh5SXb/A op7TDb/46sc7WxuybwIKj2dvO0WZO6urh27KTwgNh67jWjecGVFexf+iAmt1Q+KmJ7Rs H5grMkvpZqvkUdASvn08x4O5WSUskpWBCsoZgVquPzgBd9XVMP4VTZ0xxK5DQnpIYqlB VfpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z64si33246268pgd.106.2019.04.10.12.03.01; Wed, 10 Apr 2019 12:03:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728642AbfDJRDe (ORCPT + 99 others); Wed, 10 Apr 2019 13:03:34 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:55154 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727364AbfDJRDe (ORCPT ); Wed, 10 Apr 2019 13:03:34 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 56C922610F4; Wed, 10 Apr 2019 18:03:31 +0100 (BST) Date: Wed, 10 Apr 2019 19:03:28 +0200 From: Boris Brezillon To: Miquel Raynal Cc: YueHaibing , , , , , , , Subject: Re: [PATCH] mtd: nand: Fix build error while CONFIG_MTD_NAND_ECC_SW_BCH is set to module Message-ID: <20190410190328.433a954f@collabora.com> In-Reply-To: <20190410181843.489a4e33@xps13> References: <20190410130747.35692-1-yuehaibing@huawei.com> <20190410153920.68267a1a@collabora.com> <20190410155856.655122c8@collabora.com> <8b020124-4008-6081-c04c-eaefb7875878@huawei.com> <20190410162927.17ea678b@collabora.com> <41165c39-da0c-0f15-87f9-4fb588b77dcc@huawei.com> <20190410181843.489a4e33@xps13> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 10 Apr 2019 18:18:43 +0200 Miquel Raynal wrote: > Hi YueHaibing, > > YueHaibing wrote on Wed, 10 Apr 2019 23:03:24 > +0800: > > > On 2019/4/10 22:29, Boris Brezillon wrote: > > > On Wed, 10 Apr 2019 22:22:16 +0800 > > > YueHaibing wrote: > > > > > >> On 2019/4/10 21:58, Boris Brezillon wrote: > > >>> On Wed, 10 Apr 2019 15:39:28 +0200 > > >>> Boris Brezillon wrote: > > >>> > > >>>> On Wed, 10 Apr 2019 21:07:47 +0800 > > >>>> Yue Haibing wrote: > > >>>> > > >>>>> From: YueHaibing > > >>>>> > > >>>>> 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 > > >>>>> Fixes: 193bd4002644 ("mtd: nand: add software BCH ECC support" > > >>>> > > >>>> Nope, it's not this one that introduced the regression. > > >>>> > > >>>> > > >>>> > > >>>>> Signed-off-by: YueHaibing > > >>>>> --- > > >>>>> 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. > > > > > > Yes, I know, but forcing nand_bch to a be a boolean is not the right > > > solution either, hence my suggestion to use 'imply'. > > Why exactly? SW BCH is going to be converted to the generic ECC engine > abstraction and IIRC you told me that it would not be problematic to > turn it into a boolean? Yes, I told you we should turn it into a boolean and embed the code in the nandcore.o object which can itself be linked as a module or embedded in the kernel image (see above for a version adapted for nand.o). That's not exactly what Yue proposed. --->8--- diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig index 7fcdaf6c279d..f9258d666846 100644 --- a/drivers/mtd/devices/Kconfig +++ b/drivers/mtd/devices/Kconfig @@ -207,7 +207,7 @@ comment "Disk-On-Chip Device Drivers" config MTD_DOCG3 tristate "M-Systems Disk-On-Chip G3" select BCH - select BCH_CONST_PARAMS if !CONFIG_MTD_NAND_ECC_SW_BCH + select BCH_CONST_PARAMS if !MTD_NAND_ECC_SW_BCH select BITREVERSE help This provides an MTD device driver for the M-Systems DiskOnChip diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig index 615d738be411..0500c42f31cb 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 diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile index 8bc6faaa3bc7..d644185fa18d 100644 --- a/drivers/mtd/nand/raw/Makefile +++ b/drivers/mtd/nand/raw/Makefile @@ -2,7 +2,6 @@ obj-$(CONFIG_MTD_RAW_NAND) += nand.o obj-$(CONFIG_MTD_NAND_ECC_SW_HAMMING) += nand_ecc.o -obj-$(CONFIG_MTD_NAND_ECC_SW_BCH) += nand_bch.o obj-$(CONFIG_MTD_SM_COMMON) += sm_common.o obj-$(CONFIG_MTD_NAND_CAFE) += cafe_nand.o @@ -68,3 +67,5 @@ nand-objs += nand_macronix.o nand-objs += nand_micron.o nand-objs += nand_samsung.o nand-objs += nand_toshiba.o +nand-objs-$(CONFIG_MTD_NAND_ECC_SW_BCH) += nand_bch.o +nand-objs += $(nand-objs-y)