From b8df88a36959bc00dc858c1b9a491422e390571e Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Wed, 5 Nov 2025 00:04:16 -0500 Subject: [PATCH] tlv_eeprom: convert local functions to public scope Signed-off-by: Hugo Villeneuve --- src/tlv_eeprom.c | 18 ++++++------------ src/tlv_eeprom.h | 8 ++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/tlv_eeprom.c b/src/tlv_eeprom.c index 9481084..6a4c46c 100644 --- a/src/tlv_eeprom.c +++ b/src/tlv_eeprom.c @@ -24,14 +24,8 @@ /* File scope function prototypes */ static bool is_checksum_valid(u8 *eeprom); -static int read_eeprom(int devnum, u8 *eeprom); -static void show_eeprom(int devnum, u8 *eeprom); static void decode_tlv(struct tlvinfo_tlv *tlv); static void update_crc(u8 *eeprom); -static int prog_eeprom(int devnum, u8 *eeprom); -static bool tlvinfo_find_tlv(u8 *eeprom, u8 tcode, int *eeprom_index); -static bool tlvinfo_delete_tlv(u8 *eeprom, u8 code); -static bool tlvinfo_add_tlv(u8 *eeprom, int tcode, char *strval); static int set_mac(char *buf, const char *string); static int set_date(char *buf, const char *string); static int set_bytes(char *buf, const char *string, int *converted_accum); @@ -111,7 +105,7 @@ static bool is_checksum_valid(u8 *eeprom) * * Read the EEPROM into memory, if it hasn't already been read. */ -static int read_eeprom(int devnum, u8 *eeprom) +int read_eeprom(int devnum, u8 *eeprom) { int ret; struct tlvinfo_header *eeprom_hdr = to_header(eeprom); @@ -143,7 +137,7 @@ static int read_eeprom(int devnum, u8 *eeprom) * * Display the contents of the EEPROM */ -static void show_eeprom(int devnum, u8 *eeprom) +void show_eeprom(int devnum, u8 *eeprom) { int tlv_end; int curr_tlv; @@ -367,7 +361,7 @@ static void update_crc(u8 *eeprom) * * Write the EEPROM data from CPU memory to the hardware. */ -static int prog_eeprom(int devnum, u8 *eeprom) +int prog_eeprom(int devnum, u8 *eeprom) { int ret = 0; struct tlvinfo_header *eeprom_hdr = to_header(eeprom); @@ -409,7 +403,7 @@ void show_tlv_code_list(void) * An offset from the beginning of the EEPROM is returned in the * eeprom_index parameter if the TLV is found. */ -static bool tlvinfo_find_tlv(u8 *eeprom, u8 tcode, int *eeprom_index) +bool tlvinfo_find_tlv(u8 *eeprom, u8 tcode, int *eeprom_index) { struct tlvinfo_header *eeprom_hdr = to_header(eeprom); struct tlvinfo_tlv *eeprom_tlv; @@ -436,7 +430,7 @@ static bool tlvinfo_find_tlv(u8 *eeprom, u8 tcode, int *eeprom_index) * This function deletes the TLV with the specified type code from the * EEPROM. */ -static bool tlvinfo_delete_tlv(u8 *eeprom, u8 code) +bool tlvinfo_delete_tlv(u8 *eeprom, u8 code) { int eeprom_index; int tlength; @@ -467,7 +461,7 @@ static bool tlvinfo_delete_tlv(u8 *eeprom, u8 code) * the format in which it will be stored in the EEPROM. */ #define MAX_TLV_VALUE_LEN 256 -static bool tlvinfo_add_tlv(u8 *eeprom, int tcode, char *strval) +bool tlvinfo_add_tlv(u8 *eeprom, int tcode, char *strval) { struct tlvinfo_header *eeprom_hdr = to_header(eeprom); struct tlvinfo_tlv *eeprom_tlv; diff --git a/src/tlv_eeprom.h b/src/tlv_eeprom.h index 0f66ab1..8e0516a 100644 --- a/src/tlv_eeprom.h +++ b/src/tlv_eeprom.h @@ -129,4 +129,12 @@ static inline bool is_valid_tlvinfo_header(struct tlvinfo_header *hdr) (be16_to_cpu(hdr->totallen) <= TLV_TOTAL_LEN_MAX)); } +void show_eeprom(int devnum, u8 *eeprom); +bool tlvinfo_find_tlv(u8 *eeprom, u8 tcode, int *eeprom_index); +bool tlvinfo_delete_tlv(u8 *eeprom, u8 code); +bool tlvinfo_add_tlv(u8 *eeprom, int tcode, char *strval); +int prog_eeprom(int devnum, u8 *eeprom); +int read_eeprom(int devnum, u8 *eeprom); +void show_tlv_code_list(void); + #endif /* __TLV_EEPROM_H_ */ -- 2.20.1