diff options
| author | Marek BehĂșn <[email protected]> | 2024-05-21 09:13:34 +0200 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-06-07 10:48:00 -0600 |
| commit | e5dbc80fe0e87d8a6e5226c4b3329d648fd89386 (patch) | |
| tree | 4a57ebff9989e913a2dc9b57c5f84ab9a8c26ba2 /cmd | |
| parent | e9774afedd20bfe8a18b20a63010c1d18cd16cd7 (diff) | |
cmd: eeprom: Don't read/write whole EEPROM if not necessary
Don't read/write whole EEPROM if not necessary when printing / updating
EEPROM layout fields. Only read/write layout.data_size bytes.
Signed-off-by: Marek BehĂșn <[email protected]>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/eeprom.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/cmd/eeprom.c b/cmd/eeprom.c index c76cf431578..9c4af88738e 100644 --- a/cmd/eeprom.c +++ b/cmd/eeprom.c @@ -311,16 +311,10 @@ static int do_eeprom_rw(struct eeprom_dev_spec *dev, bool read, static int do_eeprom_layout(struct eeprom_dev_spec *dev, int layout_ver, struct eeprom_layout *layout) { - int ret; - - ret = eeprom_read(dev->i2c_addr, 0, eeprom_buf, CONFIG_SYS_EEPROM_SIZE); - if (ret) - return ret; - eeprom_layout_setup(layout, eeprom_buf, CONFIG_SYS_EEPROM_SIZE, layout_ver); - return 0; + return eeprom_read(dev->i2c_addr, 0, eeprom_buf, layout->data_size); } static int do_eeprom_print(struct eeprom_dev_spec *dev, int layout_ver) @@ -351,8 +345,7 @@ static int do_eeprom_update(struct eeprom_dev_spec *dev, int layout_ver, if (ret) return CMD_RET_FAILURE; - return eeprom_write(dev->i2c_addr, 0, layout.data, - CONFIG_SYS_EEPROM_SIZE); + return eeprom_write(dev->i2c_addr, 0, layout.data, layout.data_size); } #endif |
