linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Yue Haibing <yuehaibing@huawei.com>
Cc: bbrezillon@kernel.org, richard@nod.at,
	linux-kernel@vger.kernel.org, marek.vasut@gmail.com,
	paul.burton@mips.com, linux-mtd@lists.infradead.org,
	miquel.raynal@bootlin.com, computersforpeace@gmail.com
Subject: Re: [PATCH] mtd: nand: Fix build error while CONFIG_MTD_NAND_ECC_SW_BCH is set to module
Date: Wed, 10 Apr 2019 16:10:48 +0200	[thread overview]
Message-ID: <20190410161048.1d6f4c55@collabora.com> (raw)
In-Reply-To: <20190410155856.655122c8@collabora.com>

On Wed, 10 Apr 2019 15:58:56 +0200
Boris Brezillon <boris.brezillon@collabora.com> wrote:

> On Wed, 10 Apr 2019 15:39:28 +0200
> Boris Brezillon <boris.brezillon@collabora.com> wrote:
> 
> > On Wed, 10 Apr 2019 21:07:47 +0800
> > Yue Haibing <yuehaibing@huawei.com> wrote:
> >   
> > > From: YueHaibing <yuehaibing@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@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@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.

This one should do the trick, though imply means MTD_NAND_ECC_SW_BCH will
now be selected by default.

--->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..65c85fc53c41 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -9,18 +9,6 @@ config MTD_NAND_ECC_SW_HAMMING_SMC
          Software ECC according to the Smart Media Specification.
          The original Linux implementation had byte 0 and 1 swapped.
 
-menuconfig MTD_RAW_NAND
-       tristate "Raw/Parallel NAND Device Support"
-       depends on MTD
-       select MTD_NAND_CORE
-       select MTD_NAND_ECC_SW_HAMMING
-       help
-         This enables support for accessing all type of raw/parallel
-         NAND flash devices. For further information see
-         <http://www.linux-mtd.infradead.org/doc/nand.html>.
-
-if MTD_RAW_NAND
-
 config MTD_NAND_ECC_SW_BCH
        tristate "Support software BCH ECC"
        select BCH
@@ -31,6 +19,19 @@ config MTD_NAND_ECC_SW_BCH
          ECC codes. They are used with NAND devices requiring more than 1 bit
          of error correction.
 
+menuconfig MTD_RAW_NAND
+       tristate "Raw/Parallel NAND Device Support"
+       depends on MTD
+       select MTD_NAND_CORE
+       select MTD_NAND_ECC_SW_HAMMING
+       imply MTD_NAND_ECC_SW_BCH
+       help
+         This enables support for accessing all type of raw/parallel
+         NAND flash devices. For further information see
+         <http://www.linux-mtd.infradead.org/doc/nand.html>.
+
+if MTD_RAW_NAND
+
 comment "Raw/parallel NAND flash controllers"
 
 config MTD_NAND_DENALI

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2019-04-10 14:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 13:07 [PATCH] mtd: nand: Fix build error while CONFIG_MTD_NAND_ECC_SW_BCH is set to module Yue Haibing
2019-04-10 13:39 ` Boris Brezillon
2019-04-10 13:58   ` Boris Brezillon
2019-04-10 14:10     ` Boris Brezillon [this message]
2019-04-10 14:22     ` YueHaibing
2019-04-10 14:29       ` Boris Brezillon
2019-04-10 15:03         ` YueHaibing
2019-04-10 16:18           ` Miquel Raynal
2019-04-10 17:03             ` Boris Brezillon
2019-04-12 14:28               ` YueHaibing
2019-04-12 15:04                 ` Boris Brezillon
2019-04-12 15:23                   ` YueHaibing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190410161048.1d6f4c55@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=paul.burton@mips.com \
    --cc=richard@nod.at \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).