[[PATCH v2] 4/4] cmd: tlv_eeprom: enable 'dev' subcommand before 'read'

Simon Glass sjg at chromium.org
Mon May 8 16:42:34 CEST 2023


Hi,

On Fri, 5 May 2023 at 02:22, Josua Mayer <josua at solid-run.com> wrote:
>
> Move the handler for "tlv_eeprom dev X" command to the beginning of
> do_tlv_eeprom, to allow using it before issuing a "read" command for
> currently selected eeprom.
>
> Also remove the check if eeprom exists, since that can only work after
> the first execution of read_eeprom triggered device lookup.
> Instead accept values up to the defined array size (MAX_TLV_DEVICES).
>
> Signed-off-by: Josua Mayer <josua at solid-run.com>
> Reviewed-by: Stefan Roese <sr at denx.de>
> Cc: Stefan Roese <sr at denx.de>
> Cc: Baruch Siach <baruch at tkos.co.il>
> Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  cmd/tlv_eeprom.c | 26 ++++++++++++++++----------
>  1 file changed, 16 insertions(+), 10 deletions(-)

Can someone take a look at fixing up the driver model code?

For example:
- it maintains its own array of eproms, when it should use driver
model to find them.
- the has_been_read flag seems to track only one EEPROM, but the code
indicates there might be two (should be in the device's private data)
- current_dev should be a pointer to a device
- ideally all state should be either in the device or the uclass, so
it can be used before relocation, etc.

Regards,
Simon


More information about the U-Boot mailing list