[PATCH 7/9] mtd: nand: stm_nand_bch: adding BBT header
Brian Norris
computersforpeace at gmail.com
Sun Oct 5 22:07:31 PDT 2014
Hi Lee,
On Wed, Aug 27, 2014 at 01:42:22PM +0100, Lee Jones wrote:
> This header will be used firstly by the BCH main driver, then the
> Bad Block Table (BBT) code which will be added immediately after.
> Doing it this way provides the cleanest method of keeping the
> patch-set bisectable.
>
> Signed-off-by: Lee Jones <lee.jones at linaro.org>
> ---
> include/linux/mtd/stm_nand_bbt.h | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
> create mode 100644 include/linux/mtd/stm_nand_bbt.h
>
> diff --git a/include/linux/mtd/stm_nand_bbt.h b/include/linux/mtd/stm_nand_bbt.h
> new file mode 100644
> index 0000000..bcb33b2
> --- /dev/null
> +++ b/include/linux/mtd/stm_nand_bbt.h
> @@ -0,0 +1,17 @@
> +#include <linux/mtd/stm_nand.h>
> +
> +/* BCH ECC sizes */
> +static int bch_ecc_sizes[] = {
> + [BCH_18BIT_ECC] = 32,
> + [BCH_30BIT_ECC] = 54,
> + [BCH_NO_ECC] = 0,
> +};
> +
> +#if defined(CONFIG_MTD_NAND_STM_BCH_BBT)
> +extern void nandi_dump_bad_blocks(struct nandi_controller *nandi);
> +extern int bch_scan_bbt(struct mtd_info *mtd);
> +extern int bch_block_isbad(struct mtd_info *mtd, loff_t offs, int getchip);
> +extern int bch_block_markbad(struct mtd_info *mtd, loff_t offs);
> +#else
> +inline void nandi_dump_bad_blocks(struct nandi_controller *nandi) {}
This line induces the following failure when everything is built as a
module:
drivers/mtd/nand/stm_nand_bbt.c:579:6: error: redefinition of 'nandi_dump_bad_blocks'
include/linux/mtd/stm_nand_bbt.h:16:84: note: previous definition of 'nandi_dump_bad_blocks' was here
This highlights the fact that:
(1) This should be 'static inline', not just 'inline'
(2) Your code is not modularized properly. You can't build
stm_nand_bbt.o and stm_nand_bch.o as kernel modules properly, since
#if defined() isn't true when CONFIG_MTD_NAND_STM_BCH_BBT=m
(3) You're building 3 separate modules for your STM NAND code, where 2
might suffice (one for NAND support and one for BBT).
Ezequiel has been running through some of the same build problems with
the OMAP NAND + ELM (ECC) driver recently. You might check the recent
MTD archives for this. Or you might just restrict your driver to being
built-in (non-module) if you can't fix this for now.
> +#endif
Brian
More information about the linux-arm-kernel
mailing list