target/linux/generic/files/drivers/mtd/nand/mtk_bmt_nmbm.c
static bool nmbm_create_info_table(struct nmbm_instance *ni)
{
	uint32_t lb;
	bool success;

	/* Set initial mapping_blocks_top_off  */
	success = nmbm_block_walk(ni, false, ni->signature_ba,
				  &ni->mapping_blocks_top_ba, 1,
				  ni->mgmt_start_ba);
	if (!success) {
		nlog_err(ni, "No room for spare blocks\n");
		return false;
	}

	/* Generate info table cache */
	nmbm_generate_info_table_cache(ni);

	/* Write info table */
	success = nmbm_rebuild_info_table(ni);
	if (!success) {
		nlog_err(ni, "Failed to build info tables\n");
		return false;
	}

	/* Remap bad block(s) at end of data area */
	for (lb = ni->data_block_count; lb < ni->mgmt_start_ba; lb++) {
		success = nmbm_map_block(ni, lb);
		if (!success)
			break;

		ni->data_block_count++;
	}

	/* If state table and/or mapping table changed, update info table. */
	success = nmbm_update_info_table(ni);
	if (!success)
		return false;

	return true;
}
/*
 * nmbm_create_info_table - Create info table(s)
 * @ni: NMBM instance structure
 *
 * This function assumes that the chip has no existing info table(s)
 */
Create info table(s)
@ni: NMBM instance structure

This function assumes that the chip has no existing info table(s)
Create info table ( s ) @ni : NMBM instance structure This function assumes that the chip has no existing info table ( s )
static bool nmbm_create_info_table(struct nmbm_instance *ni)
{
	uint32_t lb;
	bool success;
	success = nmbm_block_walk(ni, false, ni->signature_ba,
				  &ni->mapping_blocks_top_ba, 1,
				  ni->mgmt_start_ba);
	if (!success) {
		nlog_err(ni, "No room for spare blocks\n");
		return false;
	}
	nmbm_generate_info_table_cache(ni);
	success = nmbm_rebuild_info_table(ni);
	if (!success) {
		nlog_err(ni, "Failed to build info tables\n");
		return false;
	}
	for (lb = ni->data_block_count; lb < ni->mgmt_start_ba; lb++) {
		success = nmbm_map_block(ni, lb);
		if (!success)
			break;
		ni->data_block_count++;
	}
	success = nmbm_update_info_table(ni);
	if (!success)
		return false;
	return true;
}
static bool nmbm_create_info_table ( struct nmbm_instance * ni ) { uint32_t lb ; bool success ; success = nmbm_block_walk ( ni , false , ni -> signature_ba , & ni -> mapping_blocks_top_ba , 1 , ni -> mgmt_start_ba ) ; if ( ! success ) { nlog_err ( ni , " \n " ) ; return false ; } nmbm_generate_info_table_cache ( ni ) ; success = nmbm_rebuild_info_table ( ni ) ; if ( ! success ) { nlog_err ( ni , " \n " ) ; return false ; } for ( lb = ni -> data_block_count ; lb < ni -> mgmt_start_ba ; lb ++ ) { success = nmbm_map_block ( ni , lb ) ; if ( ! success ) break ; ni -> data_block_count ++ ; } success = nmbm_update_info_table ( ni ) ; if ( ! success ) return false ; return true ; }
nmbm_create_info_table - Create info table(s)
 @ni: NMBM instance structure
nmbm_create_info_table - Create info table ( s ) @ni : NMBM instance structure
/* Set initial mapping_blocks_top_off  */ /* Generate info table cache */ /* Write info table */ /* Remap bad block(s) at end of data area */ /* If state table and/or mapping table changed, update info table. */