tlv_eeprom: convert local functions to public scope
authorHugo Villeneuve <hvilleneuve@dimonoff.com>
Wed, 5 Nov 2025 05:04:16 +0000 (00:04 -0500)
committerHugo Villeneuve <hvilleneuve@dimonoff.com>
Mon, 17 Nov 2025 15:36:11 +0000 (10:36 -0500)
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
src/tlv_eeprom.c
src/tlv_eeprom.h

index 9481084..6a4c46c 100644 (file)
 
 /* 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;
index 0f66ab1..8e0516a 100644 (file)
@@ -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_ */