All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mtd:Remove unneeded to comments and call to check_free_sectors in the function, INFTL_formatblock
@ 2015-03-04  5:01 Nicholas Krause
  2015-03-04  5:01 ` [PATCH 2/3] mtd:Remove no longer required function, check_free_sectors in inftlmount.c Nicholas Krause
  2015-03-04  5:01 ` [PATCH 3/3] mtd:Remove the no no longer required function, memcmpb in the file inftlmount.c Nicholas Krause
  0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Krause @ 2015-03-04  5:01 UTC (permalink / raw)
  To: dwmw2; +Cc: computersforpeace, linux-mtd, linux-kernel

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.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 drivers/mtd/inftlmount.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index 1388c8d..8f16de1 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -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);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] mtd:Remove no longer required function, check_free_sectors in inftlmount.c
  2015-03-04  5:01 [PATCH 1/3] mtd:Remove unneeded to comments and call to check_free_sectors in the function, INFTL_formatblock Nicholas Krause
@ 2015-03-04  5:01 ` Nicholas Krause
  2015-03-04  5:01 ` [PATCH 3/3] mtd:Remove the no no longer required function, memcmpb in the file inftlmount.c Nicholas Krause
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Krause @ 2015-03-04  5:01 UTC (permalink / raw)
  To: dwmw2; +Cc: computersforpeace, linux-mtd, linux-kernel

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.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 drivers/mtd/inftlmount.c | 39 ---------------------------------------
 1 file changed, 39 deletions(-)

diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index 8f16de1..f9f1511 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -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;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] mtd:Remove the no no longer required function, memcmpb in the file inftlmount.c
  2015-03-04  5:01 [PATCH 1/3] mtd:Remove unneeded to comments and call to check_free_sectors in the function, INFTL_formatblock Nicholas Krause
  2015-03-04  5:01 ` [PATCH 2/3] mtd:Remove no longer required function, check_free_sectors in inftlmount.c Nicholas Krause
@ 2015-03-04  5:01 ` Nicholas Krause
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Krause @ 2015-03-04  5:01 UTC (permalink / raw)
  To: dwmw2; +Cc: computersforpeace, linux-mtd, linux-kernel

Removes the no required function,memcmpd as it's only caller check_free_sectors
as been removed in the previous patch in this patch series.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 drivers/mtd/inftlmount.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index f9f1511..734d318 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -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;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-04  5:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04  5:01 [PATCH 1/3] mtd:Remove unneeded to comments and call to check_free_sectors in the function, INFTL_formatblock Nicholas Krause
2015-03-04  5:01 ` [PATCH 2/3] mtd:Remove no longer required function, check_free_sectors in inftlmount.c Nicholas Krause
2015-03-04  5:01 ` [PATCH 3/3] mtd:Remove the no no longer required function, memcmpb in the file inftlmount.c Nicholas Krause

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.