target/linux/generic/files/drivers/mtd/nand/mtk_bmt_nmbm.c
static int nmbm_read_phys_page(struct nmbm_instance *ni, uint64_t addr,
			       void *data, void *oob)
{
	int tries, ret;

	for (tries = 0; tries < NMBM_TRY_COUNT; tries++) {
		struct mtd_oob_ops ops = {
			.mode = MTD_OPS_PLACE_OOB,
			.oobbuf = oob,
			.datbuf = data,
		};

		if (data)
			ops.len = bmtd.pg_size;
		if (oob)
			ops.ooblen = mtd_oobavail(bmtd.mtd, &ops);

		ret = bmtd._read_oob(bmtd.mtd, addr, &ops);
		if (ret == -EUCLEAN)
			return min_t(u32, bmtd.mtd->bitflip_threshold + 1,
				     bmtd.mtd->ecc_strength);
		if (ret >= 0)
			return 0;
	}

	if (ret != -EBADMSG)
		nlog_err(ni, "Page read failed at address 0x%08llx\n", addr);

	return ret;
}
/*
 * nmbm_read_phys_page - Read page with retry
 * @ni: NMBM instance structure
 * @addr: linear address where the data will be read from
 * @data: the main data to be read
 * @oob: the oob data to be read
 *
 * Read a page for at most NMBM_TRY_COUNT times.
 *
 * Return 0 for success, positive value for corrected bitflip count,
 * -EBADMSG for ecc error, other negative values for other errors
 */
Read page with retry
@ni: NMBM instance structure
@addr: linear address where the data will be read from
@data: the main data to be read
@oob: the oob data to be read

Read a page for at most NMBM_TRY_COUNT times.

Return 0 for success, positive value for corrected bitflip count,
-EBADMSG for ecc error, other negative values for other errors
Read page with retry @ni : NMBM instance structure @addr : linear address where the data will be read from @data : the main data to be read @oob : the oob data to be read Read a page for at most NMBM_TRY_COUNT times . Return 0 for success positive value for corrected bitflip count - EBADMSG for ecc error other negative values for other errors
static int nmbm_read_phys_page(struct nmbm_instance *ni, uint64_t addr,
			       void *data, void *oob)
{
	int tries, ret;
	for (tries = 0; tries < NMBM_TRY_COUNT; tries++) {
		struct mtd_oob_ops ops = {
			.mode = MTD_OPS_PLACE_OOB,
			.oobbuf = oob,
			.datbuf = data,
		};
		if (data)
			ops.len = bmtd.pg_size;
		if (oob)
			ops.ooblen = mtd_oobavail(bmtd.mtd, &ops);
		ret = bmtd._read_oob(bmtd.mtd, addr, &ops);
		if (ret == -EUCLEAN)
			return min_t(u32, bmtd.mtd->bitflip_threshold + 1,
				     bmtd.mtd->ecc_strength);
		if (ret >= 0)
			return 0;
	}
	if (ret != -EBADMSG)
		nlog_err(ni, "Page read failed at address 0x%08llx\n", addr);
	return ret;
}
static int nmbm_read_phys_page ( struct nmbm_instance * ni , uint64_t addr , void * data , void * oob ) { int tries , ret ; for ( tries = 0 ; tries < NMBM_TRY_COUNT ; tries ++ ) { struct mtd_oob_ops ops = { . mode = MTD_OPS_PLACE_OOB , . oobbuf = oob , . datbuf = data , } ; if ( data ) ops . len = bmtd . pg_size ; if ( oob ) ops . ooblen = mtd_oobavail ( bmtd . mtd , & ops ) ; ret = bmtd . _read_oob ( bmtd . mtd , addr , & ops ) ; if ( ret == - EUCLEAN ) return min_t ( u32 , bmtd . mtd -> bitflip_threshold + 1 , bmtd . mtd -> ecc_strength ) ; if ( ret >= 0 ) return 0 ; } if ( ret != - EBADMSG ) nlog_err ( ni , " \n " , addr ) ; return ret ; }
nmbm_read_phys_page - Read page with retry
 @ni: NMBM instance structure
 @addr: linear address where the data will be read from
 @data: the main data to be read
 @oob: the oob data to be read
nmbm_read_phys_page - Read page with retry @ni : NMBM instance structure @addr : linear address where the data will be read from @data : the main data to be read @oob : the oob data to be read