diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2008-01-20 11:55:08 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2008-01-20 11:55:08 +0000 |
commit | 137a521f1757a44ca3413b10b4f24f0fad7f4e48 (patch) | |
tree | 1e790e581ec56dd1a72f2477ad981d844c01d1f8 /sys/dev/usb | |
parent | a765cc9480bc8f58af3673cc9075ba6b68438585 (diff) |
Read EEPROM content the other way around (from start to end).
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_upgt.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/dev/usb/if_upgt.c b/sys/dev/usb/if_upgt.c index d5fdf5de994..9362b7a01cb 100644 --- a/sys/dev/usb/if_upgt.c +++ b/sys/dev/usb/if_upgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upgt.c,v 1.22 2008/01/20 10:49:55 mglocker Exp $ */ +/* $OpenBSD: if_upgt.c,v 1.23 2008/01/20 11:55:07 mglocker Exp $ */ /* * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> @@ -866,11 +866,9 @@ upgt_eeprom_read(struct upgt_softc *sc) struct upgt_lmac_eeprom *eeprom; int offset, block, len; + offset = 0; block = UPGT_EEPROM_BLOCK_SIZE; - offset = UPGT_EEPROM_SIZE; - while (offset > 0) { - offset = offset - block; - + while (offset < UPGT_EEPROM_SIZE) { DPRINTF(1, "%s: request EEPROM block (offset=%d, len=%d)\n", sc->sc_dev.dv_xname, offset, block); @@ -914,8 +912,9 @@ upgt_eeprom_read(struct upgt_softc *sc) return (EIO); } - if (offset < block) - block = offset; + offset += block; + if (UPGT_EEPROM_SIZE - offset < block) + block = UPGT_EEPROM_SIZE - offset; } return (0); |