[flashrom] [PATCH 1/2] revert flashctx to flashchip in block_eraser helper functions

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Wed Dec 28 01:57:01 CET 2011


Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
---
see 0/2 for a rationale

 flashrom.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/flashrom.c b/flashrom.c
index f1a6165..68b6d97 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -265,7 +265,7 @@ struct shutdown_func_data {
  */
 static int may_register_shutdown = 0;
 
-static int check_block_eraser(const struct flashctx *flash, int k, int log);
+static int check_block_eraser(const struct flashchip *flash, int k, int log);
 
 /* Register a function to be executed on programmer shutdown.
  * The advantage over atexit() is that you can supply a void pointer which will
@@ -522,7 +522,7 @@ char *extract_programmer_param(const char *param_name)
 }
 
 /* Returns the number of well-defined erasers for a chip. */
-static unsigned int count_usable_erasers(const struct flashctx *flash)
+static unsigned int count_usable_erasers(const struct flashchip *flash)
 {
 	unsigned int usable_erasefunctions = 0;
 	int k;
@@ -1283,7 +1283,7 @@ static int walk_eraseregions(struct flashctx *flash, int erasefunction,
 	return 0;
 }
 
-static int check_block_eraser(const struct flashctx *flash, int k, int log)
+static int check_block_eraser(const struct flashchip *flash, int k, int log)
 {
 	struct block_eraser eraser = flash->block_erasers[k];
 
@@ -1313,7 +1313,7 @@ int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents,
 	int k, ret = 1;
 	uint8_t *curcontents;
 	unsigned long size = flash->total_size * 1024;
-	unsigned int usable_erasefunctions = count_usable_erasers(flash);
+	unsigned int usable_erasefunctions = count_usable_erasers((struct flashchip*) flash);
 
 	msg_cinfo("Erasing and writing flash chip... ");
 	curcontents = malloc(size);
@@ -1332,7 +1332,7 @@ int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents,
 			break;
 		}
 		msg_cdbg("Trying erase function %i... ", k);
-		if (check_block_eraser(flash, k, 1))
+		if (check_block_eraser((struct flashchip*) flash, k, 1))
 			continue;
 		usable_erasefunctions--;
 		ret = walk_eraseregions(flash, k, &erase_and_write_block_helper,
@@ -1610,7 +1610,7 @@ void check_chip_supported(const struct flashctx *flash)
 /* FIXME: This function signature needs to be improved once doit() has a better
  * function signature.
  */
-int chip_safety_check(struct flashctx *flash, int force, int read_it,
+int chip_safety_check(struct flashchip *flash, int force, int read_it,
 		      int write_it, int erase_it, int verify_it)
 {
 	if (!programmer_may_write && (write_it || erase_it)) {
@@ -1680,7 +1680,7 @@ int doit(struct flashctx *flash, int force, const char *filename, int read_it,
 	int ret = 0;
 	unsigned long size = flash->total_size * 1024;
 
-	if (chip_safety_check(flash, force, read_it, write_it, erase_it, verify_it)) {
+	if (chip_safety_check((struct flashchip*) flash, force, read_it, write_it, erase_it, verify_it)) {
 		msg_cerr("Aborting.\n");
 		ret = 1;
 		goto out_nofree;
-- 
1.7.1





More information about the flashrom mailing list