mtd:Remove unneeded to comments and call to check_free_sectors in the function, INFTL_formatblock
PATCH 1/3 mtd:Remove unneeded to comments and call to check_free_sectors in the function, INFTL_formatblock
Removes two no longer needed fix mes related to a unnessary call to check_free_sectors in the function,INFTL_formatblock and the unneeded call to check_free_sectors. This call to check_free_sectors is no longer needed as we check if the sectors are free by checking the state of the erase info structure pointer, insr's state to be not equal to MTD_ERASE_FAILED as this is the same as calling check_free_sectors to check for the sectors being no longer allocated or in use.
--- drivers/mtd/inftlmount.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/mtd/inftlmount.c +0 -9
@@ -367,7 +367,6 @@ static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address,* * Return: 0 when succeed, -1 on error. * -* ToDo: 1. Is it necessary to check_free_sector after erasing ?? */ int INFTL_formatblock (struct INFTLrecord *inftl,int block) {
@@ -400,14 +399,6 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block) block); goto fail; } - -/* -* Check the "freeness" of Erase Unit before updating metadata. -* FixMe: is this check really necessary? Since we have check -* the return code after the erase operation. -*/ -if (check_free_sectors (inftl, instr->addr, instr->len,1 ) !=0 ) - goto fail; } uci.EraseMark =cpu_to_le16 (ERASE_MARK );
Signature · 1 line
2.1.0
PATCH 2/3 mtd:Remove no longer required function, check_free_sectors in inftlmount.c
Removes the no longer required function,check_free_sectors as this functions only caller,INFTL_formatblock has removed it's call to check_free_sectors.
--- drivers/mtd/inftlmount.c | 39 --------------------------------------- 1 file changed, 39 deletions(-)
drivers/mtd/inftlmount.c +0 -39
@@ -329,45 +329,6 @@ static int memcmpb(void *a, int c, int n)return 0 ; } -/* -* check_free_sector: check if a free sector is actually FREE, -* i.e. All 0xff in data and oob area. -*/ -static int check_free_sectors (struct INFTLrecord *inftl,unsigned int address, -int len,int check_oob) -{ -u8 buf[SECTORSIZE + inftl->mbd.mtd->oobsize]; -struct mtd_info *mtd = inftl->mbd.mtd; -size_t retlen; -int i; - -for (i =0 ; i < len; i +=SECTORSIZE ) { -if (mtd_read (mtd, address,SECTORSIZE , &retlen, buf)) -return -1 ; -if (memcmpb (buf,0xff ,SECTORSIZE ) !=0 ) -return -1 ; - -if (check_oob) { -if (inftl_read_oob (mtd, address, mtd->oobsize, - &retlen, &buf[SECTORSIZE ]) <0 ) -return -1 ; -if (memcmpb (buf +SECTORSIZE ,0xff , mtd->oobsize) !=0 ) -return -1 ; - } - address +=SECTORSIZE ; - } - -return 0 ; -} - -/* -* INFTL_format: format a Erase Unit by erasing ALL Erase Zones in the Erase -* Unit and Update INFTL metadata. Each erase operation is -* checked with check_free_sectors. -* -* Return: 0 when succeed, -1 on error. -* -*/ int INFTL_formatblock (struct INFTLrecord *inftl,int block) {size_t retlen;
Signature · 1 line
2.1.0
PATCH 3/3 mtd:Remove the no no longer required function, memcmpb in the file inftlmount.c
In reply to Nicholas KrauseRemoves the no required function,memcmpd as it's only caller check_free_sectors as been removed in the previous patch in this patch series.
--- drivers/mtd/inftlmount.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/mtd/inftlmount.c +0 -10
@@ -319,16 +319,6 @@ static int find_boot_record(struct INFTLrecord *inftl)return -1 ; } -static int memcmpb (void *a,int c,int n) -{ -int i; -for (i =0 ; i < n; i++) { -if (c != ((unsigned char *)a)[i]) -return 1 ; - } -return 0 ; -} -int INFTL_formatblock (struct INFTLrecord *inftl,int block) {size_t retlen;
Signature · 1 line
2.1.0