From c2bda1f468882f6d23628651458b0baf8495fad7 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sat, 28 Feb 2009 10:07:01 +0000 Subject: [PATCH] * avr910.c (avr910_read_byte_flash): Eliminate a static variable that hasn't been in use for 5 years. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@814 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 5 +++++ avr910.c | 35 +++++++++++------------------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index f23c253e..9974b862 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-02-28 Joerg Wunsch + + * avr910.c (avr910_read_byte_flash): Eliminate a static variable that + hasn't been in use for 5 years. + 2009-02-27 Joerg Wunsch * configure.ac: Post-release 5.6. diff --git a/avr910.c b/avr910.c index 9314b290..9b3642ef 100644 --- a/avr910.c +++ b/avr910.c @@ -457,33 +457,20 @@ static int avr910_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, static int avr910_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned long addr, unsigned char * value) { - static int cached = 0; - static unsigned char cvalue; - static unsigned long caddr; + char buf[2]; - if (cached && ((caddr + 1) == addr)) { - *value = cvalue; - cached = 0; + avr910_set_addr(pgm, addr >> 1); + + avr910_send(pgm, "R", 1); + + /* Read back the program mem word (MSB first) */ + avr910_recv(pgm, buf, sizeof(buf)); + + if ((addr & 0x01) == 0) { + *value = buf[1]; } else { - char buf[2]; - - avr910_set_addr(pgm, addr >> 1); - - avr910_send(pgm, "R", 1); - - /* Read back the program mem word (MSB first) */ - avr910_recv(pgm, buf, sizeof(buf)); - - if ((addr & 0x01) == 0) { - *value = buf[1]; - // cached = 1; - cvalue = buf[0]; - caddr = addr; - } - else { - *value = buf[0]; - } + *value = buf[0]; } return 0;