[PATCH] cmd: tlv_eeprom: fix signature for populate_serial_number function

Heinrich Schuchardt xypron.glpk at gmx.de
Tue May 16 13:21:05 CEST 2023


On 5/16/23 10:27, Josua Mayer wrote:
> populate_serial_number is not used internally for the tlv_eeprom
> command, but rather provided as a library function for external use..
> Remove the devnum that had recently been added by mistake, returning the
> function to its original signature.
>
> Instead place a 0-initialised member variable inside the function to
> same purpose, along with a node that it only supports reading from the

%s/node/note/

> first EEPROM in the system.
>
> Fixes: dfda0c0 ("cmd: tlv_eeprom: remove use of global variable current_dev")
> Signed-off-by: Josua Mayer <josua at solid-run.com>
> 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 | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c
> index 79796394c5c..0ca4d714645 100644
> --- a/cmd/tlv_eeprom.c
> +++ b/cmd/tlv_eeprom.c
> @@ -1100,11 +1100,12 @@ int mac_read_from_eeprom(void)
>    *
>    *  This function must be called after relocation.
>    */
> -int populate_serial_number(int devnum)
> +int populate_serial_number(void)

If populate_serial_number() is to be used as a library function, it
should live in lib/ or possibly in drivers/misc/. The definition needs
to be provided in an include file. Otherwise the function should be deleted.

Where will this library function be used?

Shouldn't the EEPROM with the serial number be identified via the
device-tree?

Best regards

Heinrich

>   {
>   	char serialstr[257];
>   	int eeprom_index;
>   	struct tlvinfo_tlv *eeprom_tlv;
> +	int devnum = 0; // TODO: support multiple EEPROMs
>
>   	if (env_get("serial#"))
>   		return 0;



More information about the U-Boot mailing list