public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: ingenic: fix ingenic_ecc dependency
Date: Mon, 17 Jun 2019 13:24:04 +0200	[thread overview]
Message-ID: <1560770644.1774.0@crapouillou.net> (raw)
In-Reply-To: <20190617111110.2103786-1-arnd@arndb.de>

Hi Arnd,


Le lun. 17 juin 2019 à 13:10, Arnd Bergmann <arnd@arndb.de> a écrit :
> The ecc code is called from the main ingenic_nand module, but the
> Kconfig symbol gets selected by the dependent ones.
> 
> If the child drivers are loadable modules, this leads to a link
> error:
> 
> drivers/mtd/nand/raw/ingenic/ingenic_nand.o: In function 
> `ingenic_nand_remove':
> ingenic_nand.c:(.text+0x1a1): undefined reference to 
> `ingenic_ecc_release'
> drivers/mtd/nand/raw/ingenic/ingenic_nand.o: In function 
> `ingenic_nand_ecc_correct':
> ingenic_nand.c:(.text+0x1fa): undefined reference to 
> `ingenic_ecc_correct'
> drivers/mtd/nand/raw/ingenic/ingenic_nand.o: In function 
> `ingenic_nand_ecc_calculate':
> ingenic_nand.c:(.text+0x255): undefined reference to 
> `ingenic_ecc_calculate'
> drivers/mtd/nand/raw/ingenic/ingenic_nand.o: In function 
> `ingenic_nand_probe':
> ingenic_nand.c:(.text+0x3ca): undefined reference to 
> `of_ingenic_ecc_get'
> ingenic_nand.c:(.text+0x685): undefined reference to 
> `ingenic_ecc_release'
> 
> Rearrange this to have the ecc code linked the same way as the main
> driver.

I think there's a better way to fix it, only in Kconfig.

* Add a bool symbol MTD_NAND_INGENIC_USE_HW_ECC
* Have the three ECC/BCH drivers select this symbol instead of
  MTD_NAND_INGENIC_ECC
* Add the following to the MTD_NAND_JZ4780 config option:
  "select MTD_NAND_INGENIC_ECC if MTD_NAND_INGENIC_USE_HW_ECC"


> Fixes: 15de8c6efd0e ("mtd: rawnand: ingenic: Separate top-level and 
> SoC specific code")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/mtd/nand/raw/ingenic/Kconfig  | 2 +-
>  drivers/mtd/nand/raw/ingenic/Makefile | 5 ++++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/ingenic/Kconfig 
> b/drivers/mtd/nand/raw/ingenic/Kconfig
> index 19a96ce515c1..66b7cffdb0c2 100644
> --- a/drivers/mtd/nand/raw/ingenic/Kconfig
> +++ b/drivers/mtd/nand/raw/ingenic/Kconfig
> @@ -16,7 +16,7 @@ config MTD_NAND_JZ4780
>  if MTD_NAND_JZ4780
> 
>  config MTD_NAND_INGENIC_ECC
> -	tristate
> +	bool
> 
>  config MTD_NAND_JZ4740_ECC
>  	tristate "Hardware BCH support for JZ4740 SoC"
> diff --git a/drivers/mtd/nand/raw/ingenic/Makefile 
> b/drivers/mtd/nand/raw/ingenic/Makefile
> index 1ac4f455baea..5a55efc5d9bb 100644
> --- a/drivers/mtd/nand/raw/ingenic/Makefile
> +++ b/drivers/mtd/nand/raw/ingenic/Makefile
> @@ -2,7 +2,10 @@
>  obj-$(CONFIG_MTD_NAND_JZ4740) += jz4740_nand.o
>  obj-$(CONFIG_MTD_NAND_JZ4780) += ingenic_nand.o
> 
> -obj-$(CONFIG_MTD_NAND_INGENIC_ECC) += ingenic_ecc.o
> +ifdef CONFIG_MTD_NAND_INGENIC_ECC
> +obj-$(CONFIG_MTD_NAND_JZ4780) += ingenic_ecc.o
> +endif
> +
>  obj-$(CONFIG_MTD_NAND_JZ4740_ECC) += jz4740_ecc.o
>  obj-$(CONFIG_MTD_NAND_JZ4725B_BCH) += jz4725b_bch.o
>  obj-$(CONFIG_MTD_NAND_JZ4780_BCH) += jz4780_bch.o
> --
> 2.20.0
> 



  reply	other threads:[~2019-06-17 11:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 11:10 [PATCH] mtd: rawnand: ingenic: fix ingenic_ecc dependency Arnd Bergmann
2019-06-17 11:24 ` Paul Cercueil [this message]
2019-06-17 12:12   ` Arnd Bergmann
2019-06-17 12:16     ` Miquel Raynal
2019-06-27 16:40       ` Miquel Raynal
2019-06-28 19:53         ` Paul Cercueil
2019-07-01 15:01           ` Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2019-06-29  1:22 [PATCH] mtd: rawnand: ingenic: Fix " Paul Cercueil
2019-07-01 12:28 ` Miquel Raynal
2019-07-01 12:34   ` Paul Cercueil
2019-07-05 21:00 ` Miquel Raynal

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=1560770644.1774.0@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=arnd@arndb.de \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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