diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-05-12 15:38:55 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2009-05-12 15:38:55 +0000 |
commit | 8f287a3e2bc9ea841e36611742d61cf1b33422ab (patch) | |
tree | 5ef84e3f82ae6d3d7643bc85faafe63eff3256a9 /jedec.c | |
parent | 7fbc3c8cd6582d812b0e536cf302e9b747a29e28 (diff) | |
download | flashrom-8f287a3e2bc9ea841e36611742d61cf1b33422ab.zip flashrom-8f287a3e2bc9ea841e36611742d61cf1b33422ab.tar.gz |
Use helper functions chip_{read,write}[bwl] to access flash chips
The semantic patch I used in r418 to make the original conversion to
accessor functions was missing one isomorphism:
a[b] <=> *(a+b)
The semantic patcher Coccinelle was used to create this patch. Semantic
patch follows:
@@
typedef uint8_t;
expression a;
volatile uint8_t *b;
@@
- b[a]
+ *(b + a)
@@
expression a;
volatile uint8_t *b;
@@
- *(b) = (a);
+ chip_writeb(a, b);
@@
volatile uint8_t *b;
@@
- *(b)
+ chip_readb(b)
@@
type T;
T b;
@@
(
chip_readb
|
chip_writeb
)
(...,
- (T)
- (b)
+ b
)
Corresponding to flashrom svn r498.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Diffstat (limited to 'jedec.c')
-rw-r--r-- | jedec.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -331,8 +331,8 @@ int write_jedec(struct flashchip *flash, uint8_t *buf) erase_chip_jedec(flash); // dumb check if erase was successful. for (i = 0; i < total_size; i++) { - if (bios[i] != (uint8_t) 0xff) { - printf("ERASE FAILED @%d, val %02x!\n", i, bios[i]); + if (chip_readb(bios + i) != (uint8_t) 0xff) { + printf("ERASE FAILED @%d, val %02x!\n", i, chip_readb(bios + i)); return -1; } } |