Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98732da1 authored by Miquel Raynal's avatar Miquel Raynal
Browse files

mtd: rawnand: do not export nand_scan_[ident|tail]() anymore



Both nand_scan_ident() and nand_scan_tail() helpers used to be called
directly from controller drivers that needed to tweak some ECC-related
parameters before nand_scan_tail(). This separation prevented dynamic
allocations during the phase of NAND identification, which was
inconvenient.

All controller drivers have been moved to use nand_scan(), in
conjunction with the chip->ecc.[attach|detach]_chip() hooks that
actually do the required tweaking sequence between both ident/tail
calls, allowing programmers to use dynamic allocation as they need all
across the scanning sequence.

Declare nand_scan_[ident|tail]() statically now.

Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
parent ee1af829
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -5924,7 +5924,7 @@ static int nand_dt_init(struct nand_chip *chip)
}

/**
 * nand_scan_ident - [NAND Interface] Scan for the NAND device
 * nand_scan_ident - Scan for the NAND device
 * @mtd: MTD device structure
 * @maxchips: number of chips to scan for
 * @table: alternative NAND ID table
@@ -5932,8 +5932,12 @@ static int nand_dt_init(struct nand_chip *chip)
 * This is the first phase of the normal nand_scan() function. It reads the
 * flash ID and sets up MTD fields accordingly.
 *
 * This helper used to be called directly from controller drivers that needed
 * to tweak some ECC-related parameters before nand_scan_tail(). This separation
 * prevented dynamic allocations during this phase which was unconvenient and
 * as been banned for the benefit of the ->init_ecc()/cleanup_ecc() hooks.
 */
int nand_scan_ident(struct mtd_info *mtd, int maxchips,
static int nand_scan_ident(struct mtd_info *mtd, int maxchips,
			   struct nand_flash_dev *table)
{
	int i, nand_maf_id, nand_dev_id;
@@ -6008,7 +6012,6 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,

	return 0;
}
EXPORT_SYMBOL(nand_scan_ident);

static int nand_set_ecc_soft_ops(struct mtd_info *mtd)
{
@@ -6385,14 +6388,14 @@ static bool nand_ecc_strength_good(struct mtd_info *mtd)
}

/**
 * nand_scan_tail - [NAND Interface] Scan for the NAND device
 * nand_scan_tail - Scan for the NAND device
 * @mtd: MTD device structure
 *
 * This is the second phase of the normal nand_scan() function. It fills out
 * all the uninitialized function pointers with the defaults and scans for a
 * bad block table if appropriate.
 */
int nand_scan_tail(struct mtd_info *mtd)
static int nand_scan_tail(struct mtd_info *mtd)
{
	struct nand_chip *chip = mtd_to_nand(mtd);
	struct nand_ecc_ctrl *ecc = &chip->ecc;
@@ -6716,7 +6719,6 @@ int nand_scan_tail(struct mtd_info *mtd)

	return ret;
}
EXPORT_SYMBOL(nand_scan_tail);

static int nand_attach(struct nand_chip *chip)
{
+6 −12
Original line number Diff line number Diff line
@@ -35,17 +35,6 @@ static inline int nand_scan(struct mtd_info *mtd, int max_chips)
	return nand_scan_with_ids(mtd, max_chips, NULL);
}

/*
 * Separate phases of nand_scan(), allowing board driver to intervene
 * and override command or ECC setup according to flash type.
 */
int nand_scan_ident(struct mtd_info *mtd, int max_chips,
			   struct nand_flash_dev *table);
int nand_scan_tail(struct mtd_info *mtd);

/* Unregister the MTD device and free resources held by the NAND device */
void nand_release(struct mtd_info *mtd);

/* Internal helper for board drivers which need to override command function */
void nand_wait_ready(struct mtd_info *mtd);

@@ -1745,8 +1734,13 @@ int nand_read_data_op(struct nand_chip *chip, void *buf, unsigned int len,
int nand_write_data_op(struct nand_chip *chip, const void *buf,
		       unsigned int len, bool force_8bit);

/* Free resources held by the NAND device */
/*
 * Free resources held by the NAND device, must be called on error after a
 * sucessful nand_scan().
 */
void nand_cleanup(struct nand_chip *chip);
/* Unregister the MTD device and calls nand_cleanup() */
void nand_release(struct mtd_info *mtd);

/* Default extended ID decoding function */
void nand_decode_ext_id(struct nand_chip *chip);