diff mbox series

[v2,1/3] common: add prototype & rename populate_serial_number()

Message ID 20230926163510.219804-2-artur@conclusive.pl
State Superseded
Delegated to: Eugen Hristev
Headers show
Series Conclusive KSTR-SAMA5D27 support | expand

Commit Message

Artur Rojek Sept. 26, 2023, 4:35 p.m. UTC
Rename populate_serial_number() to a more descriptive
eeprom_read_serial() and provide the missing function prototype.

This is useful for boards that wish to read their serial number from
EEPROM at init.

Signed-off-by: Artur Rojek <artur@conclusive.pl>
---

v2: - rename the function
    - move function documentation from .c file to the prototype location

 cmd/tlv_eeprom.c | 14 +-------------
 include/init.h   | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 13 deletions(-)

Comments

Simon Glass Oct. 2, 2023, 1:17 a.m. UTC | #1
On Tue, 26 Sept 2023 at 10:36, Artur Rojek <artur@conclusive.pl> wrote:
>
> Rename populate_serial_number() to a more descriptive
> eeprom_read_serial() and provide the missing function prototype.
>
> This is useful for boards that wish to read their serial number from
> EEPROM at init.
>
> Signed-off-by: Artur Rojek <artur@conclusive.pl>
> ---
>
> v2: - rename the function
>     - move function documentation from .c file to the prototype location
>
>  cmd/tlv_eeprom.c | 14 +-------------
>  include/init.h   | 14 ++++++++++++++
>  2 files changed, 15 insertions(+), 13 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c
index 79796394c5c8..47c127ca4950 100644
--- a/cmd/tlv_eeprom.c
+++ b/cmd/tlv_eeprom.c
@@ -1088,19 +1088,7 @@  int mac_read_from_eeprom(void)
 	return 0;
 }
 
-/**
- *  populate_serial_number - read the serial number from EEPROM
- *
- *  This function reads the serial number from the EEPROM and sets the
- *  appropriate environment variable.
- *
- *  The environment variable is only set if it has not been set
- *  already.  This ensures that any user-saved variables are never
- *  overwritten.
- *
- *  This function must be called after relocation.
- */
-int populate_serial_number(int devnum)
+int eeprom_read_serial(int devnum)
 {
 	char serialstr[257];
 	int eeprom_index;
diff --git a/include/init.h b/include/init.h
index 3bf30476a2e0..f18f3b9961d8 100644
--- a/include/init.h
+++ b/include/init.h
@@ -283,6 +283,20 @@  void board_init_r(struct global_data *id, ulong dest_addr)
 int cpu_init_r(void);
 int last_stage_init(void);
 int mac_read_from_eeprom(void);
+
+/**
+ *  eeprom_read_serial - read the serial number from EEPROM
+ *
+ *  This function reads the serial number from the EEPROM and sets the
+ *  appropriate environment variable.
+ *
+ *  The environment variable is only set if it has not been set
+ *  already.  This ensures that any user-saved variables are never
+ *  overwritten.
+ *
+ *  This function must be called after relocation.
+ */
+int eeprom_read_serial(int devnum);
 int set_cpu_clk_info(void);
 int update_flash_size(int flash_size);
 int arch_early_init_r(void);