Author: hailfinger Date: Sun Oct 10 18:10:49 2010 New Revision: 1209 URL: http://flashrom.org/trac/flashrom/changeset/1209
Log: Simplify calls to inner write functions. No behavioural changes, just equivalence transformations.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: trunk/82802ab.c trunk/jedec.c trunk/m29f400bt.c trunk/sharplhf00l04.c trunk/sst28sf040.c trunk/sst49lfxxxc.c
Modified: trunk/82802ab.c ============================================================================== --- trunk/82802ab.c Sun Oct 10 16:02:27 2010 (r1208) +++ trunk/82802ab.c Sun Oct 10 18:10:49 2010 (r1209) @@ -162,13 +162,7 @@
int write_82802ab(struct flashchip *flash, uint8_t *buf) { - int i; - - for (i = 0; i < flash->total_size; i++) { - write_page_82802ab(flash, buf + i * 1024, i * 1024, 1024); - } - - return 0; + return write_page_82802ab(flash, buf, 0, flash->total_size * 1024); }
int unlock_28f004s5(struct flashchip *flash)
Modified: trunk/jedec.c ============================================================================== --- trunk/jedec.c Sun Oct 10 16:02:27 2010 (r1208) +++ trunk/jedec.c Sun Oct 10 18:10:49 2010 (r1209) @@ -411,16 +411,11 @@
int write_jedec_1(struct flashchip *flash, uint8_t * buf) { - int i; int mask;
mask = getaddrmask(flash);
- for (i = 0; i < flash->total_size; i++) { - write_sector_jedec_common(flash, buf + i * 1024, i * 1024, 1024, mask); - } - - return 0; + return write_sector_jedec_common(flash, buf, 0, flash->total_size * 1024, mask); }
/* erase chip with block_erase() prototype */
Modified: trunk/m29f400bt.c ============================================================================== --- trunk/m29f400bt.c Sun Oct 10 16:02:27 2010 (r1208) +++ trunk/m29f400bt.c Sun Oct 10 18:10:49 2010 (r1209) @@ -142,18 +142,5 @@
int write_m29f400bt(struct flashchip *flash, uint8_t *buf) { - int i; - int total_size = flash->total_size * 1024; - int page_size = flash->page_size; - - for (i = 0; i < (total_size / page_size) - 1; i++) { - write_page_m29f400bt(flash, buf + i * page_size, i * page_size, page_size); - } - - write_page_m29f400bt(flash, buf + 0x70000, 0x70000, 32 * 1024); - write_page_m29f400bt(flash, buf + 0x78000, 0x78000, 8 * 1024); - write_page_m29f400bt(flash, buf + 0x7a000, 0x7a000, 8 * 1024); - write_page_m29f400bt(flash, buf + 0x7c000, 0x7c000, 16 * 1024); - - return 0; + return write_page_m29f400bt(flash, buf, 0, flash->total_size * 1024); }
Modified: trunk/sharplhf00l04.c ============================================================================== --- trunk/sharplhf00l04.c Sun Oct 10 16:02:27 2010 (r1208) +++ trunk/sharplhf00l04.c Sun Oct 10 18:10:49 2010 (r1209) @@ -56,16 +56,3 @@ } return 0; } - -int write_lhf00l04(struct flashchip *flash, uint8_t *buf) -{ - int i; - int total_size = flash->total_size * 1024; - int page_size = flash->page_size; - - for (i = 0; i < total_size / page_size; i++) { - write_page_82802ab(flash, buf + i * page_size, i * page_size, page_size); - } - - return 0; -}
Modified: trunk/sst28sf040.c ============================================================================== --- trunk/sst28sf040.c Sun Oct 10 16:02:27 2010 (r1208) +++ trunk/sst28sf040.c Sun Oct 10 18:10:49 2010 (r1209) @@ -118,15 +118,9 @@
int write_28sf040(struct flashchip *flash, uint8_t *buf) { - int i; - int total_size = flash->total_size * 1024; - int page_size = flash->page_size; - unprotect_28sf040(flash);
- for (i = 0; i < total_size / page_size; i++) { - write_sector_28sf040(flash, buf + i * page_size, i * page_size, page_size); - } + write_sector_28sf040(flash, buf, 0, flash->total_size * 1024);
protect_28sf040(flash);
Modified: trunk/sst49lfxxxc.c ============================================================================== --- trunk/sst49lfxxxc.c Sun Oct 10 16:02:27 2010 (r1208) +++ trunk/sst49lfxxxc.c Sun Oct 10 18:10:49 2010 (r1209) @@ -78,15 +78,10 @@
int write_49lfxxxc(struct flashchip *flash, uint8_t *buf) { - int i; - int total_size = flash->total_size * 1024; - int page_size = flash->page_size; chipaddr bios = flash->virtual_memory;
write_lockbits_49lfxxxc(flash, 0); - for (i = 0; i < total_size / page_size; i++) { - write_page_82802ab(flash, buf + i * page_size, i * page_size, page_size); - } + write_page_82802ab(flash, buf, 0, flash->total_size * 1024);
chip_writeb(0xFF, bios);