Skip to content

Commit

Permalink
mtd: nand: ecc-bch: Drop mtd_nand_has_bch()
Browse files Browse the repository at this point in the history
Like for any other compilation option, use the IS_ENABLED() macro
instead of hardcoding it.

By droping this helper we can get rid of the BCH header in nandsim.c.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-7-miquel.raynal@bootlin.com
  • Loading branch information
Miquel Raynal committed Nov 30, 2020
1 parent e3010bd commit 127aae6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion drivers/mtd/nand/raw/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -5231,7 +5231,7 @@ static int nand_set_ecc_soft_ops(struct nand_chip *chip)

return 0;
case NAND_ECC_ALGO_BCH:
if (!mtd_nand_has_bch()) {
if (!IS_ENABLED(CONFIG_MTD_NAND_ECC_SW_BCH)) {
WARN(1, "CONFIG_MTD_NAND_ECC_SW_BCH not enabled\n");
return -EINVAL;
}
Expand Down
3 changes: 1 addition & 2 deletions drivers/mtd/nand/raw/nandsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <linux/string.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/nand-ecc-sw-bch.h>
#include <linux/mtd/partitions.h>
#include <linux/delay.h>
#include <linux/list.h>
Expand Down Expand Up @@ -2214,7 +2213,7 @@ static int ns_attach_chip(struct nand_chip *chip)
if (!bch)
return 0;

if (!mtd_nand_has_bch()) {
if (!IS_ENABLED(CONFIG_MTD_NAND_ECC_SW_BCH)) {
NS_ERR("BCH ECC support is disabled\n");
return -EINVAL;
}
Expand Down
4 changes: 0 additions & 4 deletions include/linux/mtd/nand-ecc-sw-bch.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ struct nand_chip;

#if IS_ENABLED(CONFIG_MTD_NAND_ECC_SW_BCH)

static inline int mtd_nand_has_bch(void) { return 1; }

/*
* Calculate BCH ecc code
*/
Expand All @@ -37,8 +35,6 @@ void nand_bch_free(struct nand_chip *chip);

#else /* !CONFIG_MTD_NAND_ECC_SW_BCH */

static inline int mtd_nand_has_bch(void) { return 0; }

static inline int
nand_bch_calculate_ecc(struct nand_chip *chip, const u_char *dat,
u_char *ecc_code)
Expand Down

0 comments on commit 127aae6

Please sign in to comment.