mtd: rawnand: ingenic: fix ingenic_ecc dependency
Subsystems (4)
PATCH 1/1 mtd: rawnand: ingenic: fix ingenic_ecc dependency
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.
--- drivers/mtd/nand/raw/ingenic/Kconfig | 2 +- drivers/mtd/nand/raw/ingenic/Makefile | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/ingenic/Kconfig +1 -1
@@ -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"
drivers/mtd/nand/raw/ingenic/Makefile +4 -1
@@ -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
Signature · 6 lines
2.20.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Paul Cercueil
maintainerHi Arnd,
Quoted 16 lines · Arnd Bergmann
The ecc code is called from the main
ingenic_nandmodule, but theKconfigsymbol 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 toingenic_ecc_release' drivers/mtd/nand/raw/ingenic/ingenic_nand.o: In functioningenic_nand_ecc_correct':
ingenic_nand.c:(.text+0x1fa): undefined reference toingenic_ecc_correct' drivers/mtd/nand/raw/ingenic/ingenic_nand.o: In functioningenic_nand_ecc_calculate':
ingenic_nand.c:(.text+0x255): undefined reference toingenic_ecc_calculate' drivers/mtd/nand/raw/ingenic/ingenic_nand.o: In functioningenic_nand_probe':
ingenic_nand.c:(.text+0x3ca): undefined reference toof_ingenic_ecc_get' ingenic_nand.c:(.text+0x685): undefined reference toingenic_ecc_release'
Quoted 2 lines
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"
Quoted 39 lines
Fixes 15de8c6efd0e ("mtd: rawnand: ingenic: Separate top-level and SoC specific code")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/mtd/nand/raw/ingenic/Kconfig | 2 +- drivers/mtd/nand/raw/ingenic/Makefile | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)drivers/mtd/nand/raw/ingenic/Kconfig +1
-1@@ -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"drivers/mtd/nand/raw/ingenic/Makefile +4
-2@@ -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
Quoted 7 lines · Paul Cercueil
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 ofMTD_NAND_INGENIC_ECC
* Add the following to theMTD_NAND_JZ4780config option:
"selectMTD_NAND_INGENIC_ECCifMTD_NAND_INGENIC_USE_HW_ECC"
I don't see much difference to my approach here, but if you want to submit that version with 'Reported-by: Arnd Bergmann <[email protected]>', please do so.
Yet another option would be to use Makefile code to link both files into one module, and remove the EXPORT_SYMBOL statements:
obj-$(CONFIG_MTD_NAND_JZ4780) += jz4780_nand.o jz4780_nand-y += ingenic_nand.o jz4780_nand-$(CONFIG_MTD_NAND_INGENIC_ECC) += ingenic_ecc.o
Arnd
Miquel Raynal
maintainerHello,
Arnd Bergmann <[email protected]> wrote on Mon, 17 Jun 2019 14:12:48 +0200:
Quoted 14 lines · Paul Cercueil
Quoted 8 lines
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 ofMTD_NAND_INGENIC_ECC
* Add the following to theMTD_NAND_JZ4780config option:
"selectMTD_NAND_INGENIC_ECCifMTD_NAND_INGENIC_USE_HW_ECC"I don't see much difference to my approach here, but if you want to submit that version with 'Reported-by: Arnd Bergmann <[email protected]>', please do so.
Quoted 7 lines
Yet another option would be to use
Makefilecode to link both files into one module, and remove theEXPORT_SYMBOLstatements:obj-$(CONFIG_MTD_NAND_JZ4780) += jz4780_nand.o jz4780_nand-y += ingenic_nand.o jz4780_nand-$(CONFIG_MTD_NAND_INGENIC_ECC) += ingenic_ecc.o
I personally have a preference for this one.
Thanks,
Miquèl
Miquel Raynal
maintainerHi Paul,
Miquel Raynal <[email protected]> wrote on Mon, 17 Jun 2019 14:16:59 +0200:
Quoted 21 lines
Hello,
Arnd Bergmann <[email protected]> wrote on Mon, 17 Jun 2019 14:12:48 +0200:
Quoted 17 lines · Paul Cercueil
Quoted 8 lines
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 ofMTD_NAND_INGENIC_ECC
* Add the following to theMTD_NAND_JZ4780config option:
"selectMTD_NAND_INGENIC_ECCifMTD_NAND_INGENIC_USE_HW_ECC"I don't see much difference to my approach here, but if you want to submit that version with 'Reported-by: Arnd Bergmann <[email protected]>', please do so.
Yet another option would be to use
Makefilecode to link both files into one module, and remove theEXPORT_SYMBOLstatements:
Quoted 6 lines
Quoted 4 lines
obj-$(CONFIG_MTD_NAND_JZ4780) += jz4780_nand.o jz4780_nand-y += ingenic_nand.o jz4780_nand-$(CONFIG_MTD_NAND_INGENIC_ECC) += ingenic_ecc.o
I personally have a preference for this one.
Would you mind sending the above change? I forgot about it but I would like to queue it for the next release. Preferably the last version Arnd proposed.
Thanks,
Miquèl
Paul Cercueil
maintainerQuoted 34 lines · Miquel Raynal
Hi Paul,
Miquel Raynal <[email protected]> wrote on Mon, 17 Jun 2019 14:16:59 +0200:
Quoted 29 lines
Hello,
Arnd Bergmann <[email protected]> wrote on Mon, 17 Jun 2019 14:12:48
+0200:Quoted 1 line
On Mon, Jun 17, 2019 at 1:24 PM Paul Cercueil
Quoted 11 lines · <[email protected]> wrote:
Quoted 8 lines
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 ofMTD_NAND_INGENIC_ECC
* Add the following to theMTD_NAND_JZ4780config option:
"selectMTD_NAND_INGENIC_ECCifMTD_NAND_INGENIC_USE_HW_ECC"I don't see much difference to my approach here, but if you want to submit that version with 'Reported-by: Arnd Bergmann
Quoted 9 lines
please do so.
Yet another option would be to use
Makefilecode to link both files into one module, and remove theEXPORT_SYMBOLstatements:obj-$(CONFIG_MTD_NAND_JZ4780) += jz4780_nand.o jz4780_nand-y += ingenic_nand.o jz4780_nand-$(CONFIG_MTD_NAND_INGENIC_ECC) += ingenic_ecc.o
Quoted 5 lines
Quoted 1 line
I personally have a preference for this one.
Would you mind sending the above change? I forgot about it but I would like to queue it for the next release. Preferably the last version Arnd proposed.
It does change the module name from 'ingenic_nand' to 'jz4780_nand', though. That's not really ideal...
Quoted 3 lines
Thanks,
Miquèl
Quoted 7 lines · Paul Cercueil
Quoted 4 lines · Miquel Raynal
Miquel Raynal <[email protected]> wrote on Mon, 17 Jun 2019 14:16:59 +0200:
Quoted 1 line
I personally have a preference for this one.
Quoted 8 lines
Quoted 4 lines
Would you mind sending the above change? I forgot about it but I would like to queue it for the next release. Preferably the last version Arnd
proposed.It does change the module name from '
ingenic_nand' to 'jz4780_nand', though.
That's not really ideal...
Any other suggestion for the name? If the module keeps getting called ingeneric_nand.ko, then the source file has to get renamed to something else instead.
Arnd