target: declare local symbols as static
authorAntonio Borneo <borneo.antonio@gmail.com>
Wed, 28 Oct 2020 23:23:13 +0000 (00:23 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Wed, 4 Nov 2020 17:39:17 +0000 (17:39 +0000)
Functions and variables that are not used outside the file should
be declared as static.

Change-Id: I9f97571a528f0cb3c3c26f873577ab16fdec3cdc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5895
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 files changed:
src/target/arm926ejs.c
src/target/arm946e.c
src/target/armv7a.c
src/target/armv7a_cache.c
src/target/armv8.c
src/target/avr32_ap7k.c
src/target/avr32_jtag.c
src/target/cortex_a.c
src/target/dsp5680xx.c
src/target/mips32_pracc.c
src/target/mips_ejtag.c
src/target/nds32_tlb.c
src/target/nds32_v3.c
src/target/nds32_v3m.c
src/target/openrisc/jsp_server.c
src/target/openrisc/or1k.c
src/target/quark_d20xx.c
src/target/stm8.c
src/target/target.c

index 95a4f7ca0611264685aae743e1d50e6f098cf99b..21fd6897ef2532678e24d1e2a11038c74d4cf8b6 100644 (file)
@@ -723,7 +723,7 @@ static int arm926ejs_target_create(struct target *target, Jim_Interp *interp)
        return arm926ejs_init_arch_info(target, arm926ejs, target->tap);
 }
 
-void arm926ejs_deinit_target(struct target *target)
+static void arm926ejs_deinit_target(struct target *target)
 {
        struct arm *arm = target_to_arm(target);
        struct arm926ejs_common *arm926ejs = target_to_arm926(target);
index 8754c861ced25c5affd32f9a8d06aee2aa1e8575..036e8bad7f44c7c866e08cc6dffcb1425d8f39cb 100644 (file)
@@ -51,8 +51,8 @@
  */
 static uint8_t arm946e_preserve_cache;
 
-int arm946e_post_debug_entry(struct target *target);
-void arm946e_pre_restore_context(struct target *target);
+static int arm946e_post_debug_entry(struct target *target);
+static void arm946e_pre_restore_context(struct target *target);
 static int arm946e_read_cp15(struct target *target, int reg_addr, uint32_t *value);
 
 int arm946e_init_arch_info(struct target *target,
@@ -250,7 +250,7 @@ static uint32_t arm946e_cp15_get_csize(struct target *target, int idsel)
        return csize ? 1 << (12 + (csize-3)) : 0;
 }
 
-uint32_t arm946e_invalidate_whole_dcache(struct target *target)
+static uint32_t arm946e_invalidate_whole_dcache(struct target *target)
 {
        uint32_t csize = arm946e_cp15_get_csize(target, GET_DCACHE_SIZE);
        if (csize == 0)
@@ -306,7 +306,7 @@ uint32_t arm946e_invalidate_whole_dcache(struct target *target)
        return ERROR_OK;
 }
 
-uint32_t arm946e_invalidate_whole_icache(struct target *target)
+static uint32_t arm946e_invalidate_whole_icache(struct target *target)
 {
        /* Check cache presence before flushing - avoid undefined behavior */
        uint32_t csize = arm946e_cp15_get_csize(target, GET_ICACHE_SIZE);
@@ -327,7 +327,7 @@ uint32_t arm946e_invalidate_whole_icache(struct target *target)
        return ERROR_OK;
 }
 
-int arm946e_post_debug_entry(struct target *target)
+static int arm946e_post_debug_entry(struct target *target)
 {
        uint32_t ctr_reg = 0x0;
        uint32_t retval = ERROR_OK;
@@ -368,7 +368,7 @@ int arm946e_post_debug_entry(struct target *target)
        return ERROR_OK;
 }
 
-void arm946e_pre_restore_context(struct target *target)
+static void arm946e_pre_restore_context(struct target *target)
 {
        uint32_t ctr_reg = 0x0;
        uint32_t retval;
@@ -393,7 +393,7 @@ void arm946e_pre_restore_context(struct target *target)
        }       /* if preserve_cache */
 }
 
-uint32_t arm946e_invalidate_dcache(struct target *target, uint32_t address,
+static uint32_t arm946e_invalidate_dcache(struct target *target, uint32_t address,
        uint32_t size, uint32_t count)
 {
        uint32_t cur_addr = 0x0;
@@ -458,7 +458,7 @@ uint32_t arm946e_invalidate_dcache(struct target *target, uint32_t address,
        return ERROR_OK;
 }
 
-uint32_t arm946e_invalidate_icache(struct target *target, uint32_t address,
+static uint32_t arm946e_invalidate_icache(struct target *target, uint32_t address,
        uint32_t size, uint32_t count)
 {
        uint32_t cur_addr = 0x0;
@@ -509,7 +509,7 @@ uint32_t arm946e_invalidate_icache(struct target *target, uint32_t address,
 }
 
 /** Writes a buffer, in the specified word size, with current MMU settings. */
-int arm946e_write_memory(struct target *target, target_addr_t address,
+static int arm946e_write_memory(struct target *target, target_addr_t address,
        uint32_t size, uint32_t count, const uint8_t *buffer)
 {
        int retval;
@@ -557,7 +557,7 @@ int arm946e_write_memory(struct target *target, target_addr_t address,
 
 }
 
-int arm946e_read_memory(struct target *target, target_addr_t address,
+static int arm946e_read_memory(struct target *target, target_addr_t address,
        uint32_t size, uint32_t count, uint8_t *buffer)
 {
        int retval;
index c36744ddfef4f9ec55f6c61179098d5093d16e89..abca3358f383e96889687d280c3f8f30be6f72df 100644 (file)
@@ -589,7 +589,7 @@ static const struct command_registration l2_cache_commands[] = {
 
 };
 
-const struct command_registration l2x_cache_command_handlers[] = {
+static const struct command_registration l2x_cache_command_handlers[] = {
        {
                .name = "cache_config",
                .mode = COMMAND_EXEC,
index e5f1fb06024db914a67fbf832522b47c5dd3c623..fa6df2a273c2582bd673c9113761b0f2de85aa3d 100644 (file)
@@ -572,7 +572,7 @@ static const struct command_registration arm7a_l1_i_cache_commands[] = {
        COMMAND_REGISTRATION_DONE
 };
 
-const struct command_registration arm7a_l1_di_cache_group_handlers[] = {
+static const struct command_registration arm7a_l1_di_cache_group_handlers[] = {
        {
                .name = "info",
                .handler = arm7a_l1_cache_info_cmd,
@@ -597,7 +597,7 @@ const struct command_registration arm7a_l1_di_cache_group_handlers[] = {
        COMMAND_REGISTRATION_DONE
 };
 
-const struct command_registration arm7a_cache_group_handlers[] = {
+static const struct command_registration arm7a_cache_group_handlers[] = {
        {
                .name = "auto",
                .handler = arm7a_cache_disable_auto_cmd,
index ab60cd371ba613fa058888ef7ffc4a1250ed066f..95efdc90bbd71e2220c3090feb800175019b1bbd 100644 (file)
@@ -1126,7 +1126,7 @@ int armv8_init_arch_info(struct target *target, struct armv8_common *armv8)
        return ERROR_OK;
 }
 
-int armv8_aarch64_state(struct target *target)
+static int armv8_aarch64_state(struct target *target)
 {
        struct arm *arm = target_to_arm(target);
 
index 62210591300455a3b03b66dc0ac37416f72e58c6..b0c08752d1305942ef60491edc37cc8f400acc5a 100644 (file)
@@ -63,7 +63,7 @@ static const struct avr32_core_reg
 static int avr32_read_core_reg(struct target *target, int num);
 static int avr32_write_core_reg(struct target *target, int num);
 
-int avr32_ap7k_save_context(struct target *target)
+static int avr32_ap7k_save_context(struct target *target)
 {
        int retval, i;
        struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
@@ -80,7 +80,7 @@ int avr32_ap7k_save_context(struct target *target)
        return ERROR_OK;
 }
 
-int avr32_ap7k_restore_context(struct target *target)
+static int avr32_ap7k_restore_context(struct target *target)
 {
        int i;
 
@@ -555,7 +555,7 @@ static int avr32_ap7k_examine(struct target *target)
        return ERROR_OK;
 }
 
-int avr32_ap7k_arch_state(struct target *target)
+static int avr32_ap7k_arch_state(struct target *target)
 {
        struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
 
@@ -565,7 +565,7 @@ int avr32_ap7k_arch_state(struct target *target)
        return ERROR_OK;
 }
 
-int avr32_ap7k_get_gdb_reg_list(struct target *target, struct reg **reg_list[],
+static int avr32_ap7k_get_gdb_reg_list(struct target *target, struct reg **reg_list[],
                int *reg_list_size, enum target_register_class reg_class)
 {
 #if 0
index 64ebf12ba34cc67f213a91c3cebe0106ecb0c0a3..62c8f98ca4433959a0f3fae47919cceacc62c2a5 100644 (file)
@@ -55,7 +55,7 @@ static int avr32_jtag_set_instr(struct avr32_jtag *jtag_info, int new_instr)
        return ERROR_OK;
 }
 
-int avr32_jtag_nexus_set_address(struct avr32_jtag *jtag_info,
+static int avr32_jtag_nexus_set_address(struct avr32_jtag *jtag_info,
                uint32_t addr, int mode)
 {
        struct scan_field fields[2];
@@ -92,7 +92,7 @@ int avr32_jtag_nexus_set_address(struct avr32_jtag *jtag_info,
 }
 
 
-int avr32_jtag_nexus_read_data(struct avr32_jtag *jtag_info,
+static int avr32_jtag_nexus_read_data(struct avr32_jtag *jtag_info,
        uint32_t *pdata)
 {
 
@@ -129,7 +129,7 @@ int avr32_jtag_nexus_read_data(struct avr32_jtag *jtag_info,
        return ERROR_OK;
 }
 
-int avr32_jtag_nexus_write_data(struct avr32_jtag *jtag_info,
+static int avr32_jtag_nexus_write_data(struct avr32_jtag *jtag_info,
                uint32_t data)
 {
 
@@ -184,7 +184,7 @@ int avr32_jtag_nexus_write(struct avr32_jtag *jtag_info,
        return avr32_jtag_nexus_write_data(jtag_info, value);
 }
 
-int avr32_jtag_mwa_set_address(struct avr32_jtag *jtag_info, int slave,
+static int avr32_jtag_mwa_set_address(struct avr32_jtag *jtag_info, int slave,
                uint32_t addr, int mode)
 {
        struct scan_field fields[2];
@@ -223,7 +223,7 @@ int avr32_jtag_mwa_set_address(struct avr32_jtag *jtag_info, int slave,
        return ERROR_OK;
 }
 
-int avr32_jtag_mwa_read_data(struct avr32_jtag *jtag_info,
+static int avr32_jtag_mwa_read_data(struct avr32_jtag *jtag_info,
        uint32_t *pdata)
 {
 
@@ -260,7 +260,7 @@ int avr32_jtag_mwa_read_data(struct avr32_jtag *jtag_info,
        return ERROR_OK;
 }
 
-int avr32_jtag_mwa_write_data(struct avr32_jtag *jtag_info,
+static int avr32_jtag_mwa_write_data(struct avr32_jtag *jtag_info,
        uint32_t data)
 {
 
index bd8e49fd9e5c0d990a1adfec71003e819de7613a..f39fd9b2b70c6b738b004c635fc1c09caabe196b 100644 (file)
@@ -1115,7 +1115,8 @@ static int cortex_a_post_debug_entry(struct target *target)
        return ERROR_OK;
 }
 
-int cortex_a_set_dscr_bits(struct target *target, unsigned long bit_mask, unsigned long value)
+static int cortex_a_set_dscr_bits(struct target *target,
+               unsigned long bit_mask, unsigned long value)
 {
        struct armv7a_common *armv7a = target_to_armv7a(target);
        uint32_t dscr;
index d6107abc6ffa41309399e4b80f82327c4c81d7da..ee26d24acfc75ceebc349c466d169deb2a8b317b 100644 (file)
@@ -40,7 +40,7 @@ struct dsp5680xx_common dsp5680xx_context;
 #define CHECK_HALT(target) if (target->state != TARGET_HALTED) HALT_FAIL
 #define check_halt_and_debug(target) { CHECK_HALT(target); CHECK_DBG; }
 
-int dsp5680xx_execute_queue(void)
+static int dsp5680xx_execute_queue(void)
 {
        int retval;
 
@@ -892,12 +892,6 @@ static int dsp5680xx_arch_state(struct target *target)
        return ERROR_OK;
 }
 
-int dsp5680xx_target_status(struct target *target, uint8_t *jtag_st,
-                           uint16_t *eonce_st)
-{
-       return target->state;
-}
-
 static int dsp5680xx_assert_reset(struct target *target)
 {
        target->state = TARGET_RESET;
@@ -1555,7 +1549,7 @@ static int perl_crc(const uint8_t *buff8, uint32_t word_count)
  *
  * @return
  */
-int dsp5680xx_f_SIM_reset(struct target *target)
+static int dsp5680xx_f_SIM_reset(struct target *target)
 {
        int retval = ERROR_OK;
 
@@ -1978,7 +1972,8 @@ int dsp5680xx_f_erase(struct target *target, int first, int last)
  * 0x0000001E  0xA961           bra     *-30
  */
 
-const uint16_t pgm_write_pflash[] = { 0x8A46, 0x0013, 0x807D, 0xE700,
+static const uint16_t pgm_write_pflash[] = {
+               0x8A46, 0x0013, 0x807D, 0xE700,
                0xE700, 0x8A44, 0xFFFE, 0x017B,
                0xE700, 0xF514, 0x8563, 0x8646,
                0x0020, 0x0014, 0x8646, 0x0080,
@@ -1988,7 +1983,7 @@ const uint16_t pgm_write_pflash[] = { 0x8A46, 0x0013, 0x807D, 0xE700,
                0x0013, 0x0010, 0xA961
 };
 
-const uint32_t pgm_write_pflash_length = 31;
+static const uint32_t pgm_write_pflash_length = 31;
 
 int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t count,
                   int is_flash_lock)
index 9bac40eb0cfdf11c270ecc2ce8dde52f67d7f1e6..d6bd1c58a504c59fdebe4fa4f55012ad86a05a55 100644 (file)
@@ -120,7 +120,7 @@ static void mips32_pracc_finish(struct mips_ejtag *ejtag_info)
        mips_ejtag_drscan_32_out(ejtag_info, ctrl);
 }
 
-int mips32_pracc_clean_text_jump(struct mips_ejtag *ejtag_info)
+static int mips32_pracc_clean_text_jump(struct mips_ejtag *ejtag_info)
 {
        uint32_t jt_code = MIPS32_J(ejtag_info->isa, MIPS32_PRACC_TEXT);
        pracc_swap16_array(ejtag_info, &jt_code, 1);
@@ -453,7 +453,7 @@ exit:
        return retval;
 }
 
-int mips32_pracc_read_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf)
+static int mips32_pracc_read_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf)
 {
        struct pracc_queue_info ctx = {.ejtag_info = ejtag_info};
        pracc_queue_init(&ctx);
index 7544afe52d4711b376126bed1369212e114139ad..4b049fb4e468d5ae41ec5635a975effa3f7b3454 100644 (file)
@@ -58,7 +58,7 @@ int mips_ejtag_get_idcode(struct mips_ejtag *ejtag_info)
        return mips_ejtag_drscan_32(ejtag_info, &ejtag_info->idcode);
 }
 
-int mips_ejtag_get_impcode(struct mips_ejtag *ejtag_info)
+static int mips_ejtag_get_impcode(struct mips_ejtag *ejtag_info)
 {
        mips_ejtag_set_instr(ejtag_info, EJTAG_INST_IMPCODE);
 
@@ -119,7 +119,8 @@ int mips_ejtag_drscan_64(struct mips_ejtag *ejtag_info, uint64_t *data)
        return ERROR_OK;
 }
 
-void mips_ejtag_drscan_32_queued(struct mips_ejtag *ejtag_info, uint32_t data_out, uint8_t *data_in)
+static void mips_ejtag_drscan_32_queued(struct mips_ejtag *ejtag_info,
+               uint32_t data_out, uint8_t *data_in)
 {
        assert(ejtag_info->tap != NULL);
        struct jtag_tap *tap = ejtag_info->tap;
index c4bce1a6a2a619468fd3522b3cf65329c72d728a..93a9241091e0eff912240192da8d605cf374d346 100644 (file)
@@ -31,7 +31,7 @@ int nds32_probe_tlb(struct nds32 *nds32, const target_addr_t virtual_address,
        return aice_read_tlb(aice, virtual_address, physical_address);
 }
 
-struct page_table_walker_info_s page_table_info[PAGE_SIZE_NUM] = {
+static struct page_table_walker_info_s page_table_info[PAGE_SIZE_NUM] = {
        /* 4K page */
        {0xFFC00000, 20, 0x003FF000, 10, 0x00000FFF, 0xFFFFF000, 0xFFFFF000, 0xFFFFF000},
        /* 8K page */
index e5d146bb6a639ba07778ba60aa6512de8028ad34..f9cd47a40a8fd60ea33c5ded8bb4451d2c13fb3d 100644 (file)
@@ -404,7 +404,7 @@ static int nds32_v3_remove_watchpoint(struct target *target,
        return ERROR_OK;
 }
 
-struct nds32_v3_common_callback nds32_v3_common_callback = {
+static struct nds32_v3_common_callback nds32_v3_common_callback = {
        .check_interrupt_stack = nds32_v3_check_interrupt_stack,
        .restore_interrupt_stack = nds32_v3_restore_interrupt_stack,
        .activate_hardware_breakpoint = nds32_v3_activate_hardware_breakpoint,
index 86903a51ba6ee75e61ef6884ed03b79aaea6da06..952d0ebb4202a6673149e7822744caec909e0f4b 100644 (file)
@@ -379,7 +379,7 @@ static int nds32_v3m_remove_watchpoint(struct target *target,
        return ERROR_OK;
 }
 
-struct nds32_v3_common_callback nds32_v3m_common_callback = {
+static struct nds32_v3_common_callback nds32_v3m_common_callback = {
        .check_interrupt_stack = nds32_v3m_check_interrupt_stack,
        .restore_interrupt_stack = nds32_v3m_restore_interrupt_stack,
        .activate_hardware_breakpoint = nds32_v3m_activate_hardware_breakpoint,
index 1d05944bc73fc4149d0054323b7f8d292264a3a4..4dbe63527da639d6aa1819e8df13cfbc7883fcdb 100644 (file)
@@ -57,7 +57,7 @@ static int telnet_write(struct connection *connection, const void *data, int len
        return ERROR_SERVER_REMOTE_CLOSED;
 }
 
-int jsp_poll_read(void *priv)
+static int jsp_poll_read(void *priv)
 {
        struct jsp_service *jsp_service = (struct jsp_service *)priv;
        unsigned char out_buffer[10];
index d685359be0c0640f4bf57c97ab36feb96dd34d10..5b8d7ded79d44384ed1beca12174b1757835d4f7 100644 (file)
@@ -1200,7 +1200,7 @@ static int or1k_get_gdb_reg_list(struct target *target, struct reg **reg_list[],
 
 }
 
-int or1k_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fileio_info)
+static int or1k_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fileio_info)
 {
        return ERROR_FAIL;
 }
index 42d3b8c7362c1f320301916d1fbbc7c5b6f76a8f..9169379bb5da2ff508c43533ebcf860aac33b0fc 100644 (file)
@@ -43,7 +43,7 @@
 #include "lakemont.h"
 #include "x86_32_common.h"
 
-int quark_d20xx_target_create(struct target *t, Jim_Interp *interp)
+static int quark_d20xx_target_create(struct target *t, Jim_Interp *interp)
 {
        struct x86_32_common *x86_32 = calloc(1, sizeof(struct x86_32_common));
        if (x86_32 == NULL) {
@@ -56,7 +56,7 @@ int quark_d20xx_target_create(struct target *t, Jim_Interp *interp)
        return ERROR_OK;
 }
 
-int quark_d20xx_init_target(struct command_context *cmd_ctx, struct target *t)
+static int quark_d20xx_init_target(struct command_context *cmd_ctx, struct target *t)
 {
        return lakemont_init_target(cmd_ctx, t);
 }
index 78bf6a27ae682a1e36c8a7b05d9651ff41d6904e..e99b3c21be3f4202cd4b4f58206e64201b76132e 100644 (file)
@@ -1945,7 +1945,7 @@ static int stm8_run_algorithm(struct target *target, int num_mem_params,
        return ERROR_OK;
 }
 
-int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
+static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
 {
        struct stm8_common *stm8 = target_to_stm8(target);
        jim_wide w;
index e2e614ffa315bb424ea39d0d5ebb96745874958e..da0c943bfbad9d5fc276a8d9113405e29aa87b22 100644 (file)
@@ -154,8 +154,8 @@ static struct target_type *target_types[] = {
 struct target *all_targets;
 static struct target_event_callback *target_event_callbacks;
 static struct target_timer_callback *target_timer_callbacks;
-LIST_HEAD(target_reset_callback_list);
-LIST_HEAD(target_trace_callback_list);
+static LIST_HEAD(target_reset_callback_list);
+static LIST_HEAD(target_trace_callback_list);
 static const int polling_interval = 100;
 
 static const Jim_Nvp nvp_assert[] = {
@@ -1319,7 +1319,7 @@ unsigned target_address_bits(struct target *target)
        return 32;
 }
 
-int target_profiling(struct target *target, uint32_t *samples,
+static int target_profiling(struct target *target, uint32_t *samples,
                        uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
 {
        return target->type->profiling(target, samples, max_num_samples,