[PATCH 2/8] firmware: mark unused params, remove unused vars

Alexander Huemer alexander.huemer at xx.vu
Wed Nov 23 22:59:38 UTC 2011


this eliminates the occurrance of gcc warning
warning: unused parameter ‘?’
---
 src/target/firmware/apps/hello_world/main.c        |    3 ++-
 src/target/firmware/board/compal/rffe_dualband.c   |    6 ++++--
 .../firmware/board/compal_e86/rffe_dualband_e86.c  |    6 ++++--
 .../firmware/board/gta0x/rffe_gta0x_triband.c      |    6 ++++--
 .../board/pirelli_dpl10/rffe_dpl10_triband.c       |    6 ++++--
 src/target/firmware/calypso/i2c.c                  |    3 ++-
 src/target/firmware/calypso/sim.c                  |    3 ++-
 src/target/firmware/comm/msgb.c                    |    4 +++-
 src/target/firmware/comm/timer.c                   |    4 +++-
 src/target/firmware/display/ssd1783.c              |    4 +++-
 src/target/firmware/display/ssd1963.c              |    6 +++---
 src/target/firmware/display/td014.c                |    4 +++-
 src/target/firmware/flash/cfi_flash.c              |    3 +++
 src/target/firmware/layer1/afc.c                   |    3 ++-
 src/target/firmware/layer1/apc.c                   |    4 +++-
 src/target/firmware/layer1/l23_api.c               |    8 +++-----
 src/target/firmware/layer1/prim_fbsb.c             |    6 +-----
 src/target/firmware/layer1/prim_rach.c             |    1 -
 src/target/firmware/layer1/prim_tch.c              |    2 +-
 src/target/firmware/layer1/prim_tx_nb.c            |    1 -
 src/target/firmware/layer1/toa.c                   |    3 ++-
 src/target/firmware/layer1/tpu_window.c            |    2 +-
 src/target/firmware/rf/trf6151.c                   |    6 ++++++
 23 files changed, 59 insertions(+), 35 deletions(-)

diff --git a/src/target/firmware/apps/hello_world/main.c b/src/target/firmware/apps/hello_world/main.c
index 5e3ed85..56598b9 100644
--- a/src/target/firmware/apps/hello_world/main.c
+++ b/src/target/firmware/apps/hello_world/main.c
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <memory.h>
 #include <delay.h>
@@ -59,7 +60,7 @@ static void console_rx_cb(uint8_t dlci, struct msgb *msg)
 	msgb_free(msg);
 }
 
-static void l1a_l23_rx_cb(uint8_t dlci, struct msgb *msg)
+static void l1a_l23_rx_cb(__unused uint8_t dlci, struct msgb *msg)
 {
 	int i;
 	puts("l1a_l23_rx_cb: ");
diff --git a/src/target/firmware/board/compal/rffe_dualband.c b/src/target/firmware/board/compal/rffe_dualband.c
index f4b7361..995c03b 100644
--- a/src/target/firmware/board/compal/rffe_dualband.c
+++ b/src/target/firmware/board/compal/rffe_dualband.c
@@ -1,6 +1,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <memory.h>
 #include <rffe.h>
@@ -23,7 +24,7 @@
 #define		RITA_STROBE	TSPEN(2)	/* Strobe for the Rita TSP */
 
 /* switch RF Frontend Mode */
-void rffe_mode(enum gsm_band band, int tx)
+void rffe_mode(__unused enum gsm_band band, __unused int tx)
 {
 	uint16_t tspact = tsp_act_state();
 
@@ -96,7 +97,8 @@ void rffe_compute_gain(int16_t exp_inp, int16_t target_bb)
 	trf6151_compute_gain(exp_inp, target_bb);
 }
 
-void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb)
+void rffe_rx_win_ctrl(__unused int16_t exp_inp, __unused int16_t target_bb)
 {
+#warning function not implemented yet
 	/* FIXME */
 }
diff --git a/src/target/firmware/board/compal_e86/rffe_dualband_e86.c b/src/target/firmware/board/compal_e86/rffe_dualband_e86.c
index 25bb099..a71a6d4 100644
--- a/src/target/firmware/board/compal_e86/rffe_dualband_e86.c
+++ b/src/target/firmware/board/compal_e86/rffe_dualband_e86.c
@@ -1,6 +1,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <memory.h>
 #include <rffe.h>
@@ -26,7 +27,7 @@
 #define		RITA_STROBE	TSPEN(2)	/* Strobe for the Rita TSP */
 
 /* switch RF Frontend Mode */
-void rffe_mode(enum gsm_band band, int tx)
+void rffe_mode(__unused enum gsm_band band, __unused int tx)
 {
 	uint16_t tspact = tsp_act_state();
 
@@ -100,7 +101,8 @@ void rffe_compute_gain(int16_t exp_inp, int16_t target_bb)
 	trf6151_compute_gain(exp_inp, target_bb);
 }
 
-void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb)
+void rffe_rx_win_ctrl(__unused int16_t exp_inp, __unused int16_t target_bb)
 {
+#warning function not implemented yet
 	/* FIXME */
 }
diff --git a/src/target/firmware/board/gta0x/rffe_gta0x_triband.c b/src/target/firmware/board/gta0x/rffe_gta0x_triband.c
index f118d29..c138fde 100644
--- a/src/target/firmware/board/gta0x/rffe_gta0x_triband.c
+++ b/src/target/firmware/board/gta0x/rffe_gta0x_triband.c
@@ -1,6 +1,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <memory.h>
 #include <rffe.h>
@@ -27,7 +28,7 @@
 #define		RITA_STROBE	TSPEN(2)	/* Strobe for the Rita TSP */
 
 /* switch RF Frontend Mode */
-void rffe_mode(enum gsm_band band, int tx)
+void rffe_mode(enum gsm_band band, __unused int tx)
 {
 	uint16_t tspact = tsp_act_state();
 
@@ -125,7 +126,8 @@ void rffe_compute_gain(int16_t exp_inp, int16_t target_bb)
 	trf6151_compute_gain(exp_inp, target_bb);
 }
 
-void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb)
+void rffe_rx_win_ctrl(__unused int16_t exp_inp, __unused int16_t target_bb)
 {
+#warning function not implemented yet
 	/* FIXME */
 }
diff --git a/src/target/firmware/board/pirelli_dpl10/rffe_dpl10_triband.c b/src/target/firmware/board/pirelli_dpl10/rffe_dpl10_triband.c
index d4d1342..e17dd6b 100644
--- a/src/target/firmware/board/pirelli_dpl10/rffe_dpl10_triband.c
+++ b/src/target/firmware/board/pirelli_dpl10/rffe_dpl10_triband.c
@@ -1,6 +1,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <memory.h>
 #include <rffe.h>
@@ -28,7 +29,7 @@
 #define		RITA_STROBE	TSPEN(1)	/* Strobe for the Rita TSP */
 
 /* switch RF Frontend Mode */
-void rffe_mode(enum gsm_band band, int tx)
+void rffe_mode(enum gsm_band band, __unused int tx)
 {
 	uint16_t tspact = tsp_act_state();
 
@@ -130,7 +131,8 @@ void rffe_compute_gain(int16_t exp_inp, int16_t target_bb)
 	trf6151_compute_gain(exp_inp, target_bb);
 }
 
-void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb)
+void rffe_rx_win_ctrl(__unused int16_t exp_inp, __unused int16_t target_bb)
 {
+#warning function not implemented yet
 	/* FIXME */
 }
diff --git a/src/target/firmware/calypso/i2c.c b/src/target/firmware/calypso/i2c.c
index 02e1a03..cd05838 100644
--- a/src/target/firmware/calypso/i2c.c
+++ b/src/target/firmware/calypso/i2c.c
@@ -23,6 +23,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <memory.h>
 #include <i2c.h>
@@ -100,7 +101,7 @@ int i2c_write(uint8_t chip, uint32_t addr, int alen, const uint8_t *buffer, int
 	return 0;
 }
 
-void i2c_init(int speed, int slaveadd)
+void i2c_init(__unused int speed, __unused int slaveadd)
 {
 	/* scl_out = clk_func_ref / 3,
 	   clk_func_ref = master_clock_freq / (divisor_2 + 1)
diff --git a/src/target/firmware/calypso/sim.c b/src/target/firmware/calypso/sim.c
index 752628f..3f4dd15 100644
--- a/src/target/firmware/calypso/sim.c
+++ b/src/target/firmware/calypso/sim.c
@@ -27,6 +27,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <memory.h>
 #include <string.h>
@@ -392,7 +393,7 @@ int calypso_sim_transmit(uint8_t *data, int length)
 
 
 /* IRQ-Handler for simcard interface */
-void sim_irq_handler(enum irq_nr irq)
+void sim_irq_handler(__unused enum irq_nr irq)
 {
 	int regVal = readw(REG_SIM_IT);
 
diff --git a/src/target/firmware/comm/msgb.c b/src/target/firmware/comm/msgb.c
index 4215d24..f2ff8c1 100644
--- a/src/target/firmware/comm/msgb.c
+++ b/src/target/firmware/comm/msgb.c
@@ -24,8 +24,10 @@
 #include <sys/types.h>
 #include <asm/system.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <delay.h>
+#include <console.h>
 
 #include <osmocom/core/msgb.h>
 
@@ -43,7 +45,7 @@ struct supermsg {
 	uint8_t buf[MSGB_DATA_SIZE];
 };
 static struct supermsg msgs[MSGB_NUM];
-void *_talloc_zero(void *ctx, unsigned int size, const char *name)
+void *_talloc_zero(__unused void *ctx, unsigned int size, __unused const char *name)
 {
 	unsigned long flags;
 	unsigned int i;
diff --git a/src/target/firmware/comm/timer.c b/src/target/firmware/comm/timer.c
index 6a649ae..66b01b1 100644
--- a/src/target/firmware/comm/timer.c
+++ b/src/target/firmware/comm/timer.c
@@ -19,6 +19,8 @@
  */
 
 #include <stdint.h>
+
+#include <defines.h>
 #include <debug.h>
 #include <osmocom/core/linuxlist.h>
 
@@ -187,7 +189,7 @@ int timer_check(void)
 	return i;
 }
 
-static void timer_irq(enum irq_nr irq)
+static void timer_irq(__unused enum irq_nr irq)
 {
 	/* we only increment jiffies here.  FIXME: does this need to be atomic? */
 	jiffies++;
diff --git a/src/target/firmware/display/ssd1783.c b/src/target/firmware/display/ssd1783.c
index 5696b48..7f96c1e 100644
--- a/src/target/firmware/display/ssd1783.c
+++ b/src/target/firmware/display/ssd1783.c
@@ -24,6 +24,7 @@
 #include <stdint.h>
 #include <stdio.h>
 //#define DEBUG
+#include <defines.h>
 #include <debug.h>
 #include <delay.h>
 #include <uwire.h>
@@ -230,8 +231,9 @@ static int ssd1783_puts_col(const char *str, int txtline, int fColor, int bColor
 
 /* interface to display driver core */
 
-static void ssd1783_set_attr(unsigned long attr)
+static void ssd1783_set_attr(__unused unsigned long attr)
 {
+#warning function not implemented yet
 	/* FIXME */
 }
 
diff --git a/src/target/firmware/display/ssd1963.c b/src/target/firmware/display/ssd1963.c
index 49d5275..7c453a5 100644
--- a/src/target/firmware/display/ssd1963.c
+++ b/src/target/firmware/display/ssd1963.c
@@ -24,6 +24,7 @@
 
 #include <stdint.h>
 #include <stdio.h>
+#include <defines.h>
 #include <debug.h>
 #include <delay.h>
 #include <uwire.h>
@@ -78,8 +79,6 @@ static void ssd1963_clrscr(void)
 
 static void ssd1963_init(void)
 {
-	unsigned int i;
-
 	calypso_reset_set(RESET_EXT, 0);
 	uwire_init();
 	delay_ms(3);
@@ -183,8 +182,9 @@ static int ssd1963_puts_col(const char *str, int txtline, int fColor, int bColor
 
 /* interface to display driver core */
 
-static void ssd1963_set_attr(unsigned long attr)
+static void ssd1963_set_attr(__unused unsigned long attr)
 {
+#warning function not implemented yet
 	/* FIXME */
 }
 
diff --git a/src/target/firmware/display/td014.c b/src/target/firmware/display/td014.c
index 11ef3ea..df04c13 100644
--- a/src/target/firmware/display/td014.c
+++ b/src/target/firmware/display/td014.c
@@ -24,6 +24,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <delay.h>
 #include <uwire.h>
@@ -158,8 +159,9 @@ static int td014_puts_col(const char *str, int txtline, int fColor, int bColor)
 
 /* interface to display driver core */
 
-static void td014_set_attr(unsigned long attr)
+static void td014_set_attr(__unused unsigned long attr)
 {
+#warning function not implemented yet
 	/* FIXME */
 }
 
diff --git a/src/target/firmware/flash/cfi_flash.c b/src/target/firmware/flash/cfi_flash.c
index 4f31d78..167cf20 100644
--- a/src/target/firmware/flash/cfi_flash.c
+++ b/src/target/firmware/flash/cfi_flash.c
@@ -140,6 +140,9 @@ static inline uint16_t flash_read16(const void *base_addr, uint32_t offset)
 __ramtext
 static char flash_protected(uint32_t block_offset)
 {
+	/* prevent compiler from complaining when preprocessor causes
+	   variable block_offset to be unused */
+	(void)block_offset;
 #ifdef CONFIG_FLASH_WRITE
 #  ifdef CONFIG_FLASH_WRITE_LOADER
 	return 0;
diff --git a/src/target/firmware/layer1/afc.c b/src/target/firmware/layer1/afc.c
index a51a107..f136ef1 100644
--- a/src/target/firmware/layer1/afc.c
+++ b/src/target/firmware/layer1/afc.c
@@ -23,6 +23,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <osmocom/gsm/gsm_utils.h>
 
@@ -117,7 +118,7 @@ void afc_input(int32_t freq_error, uint16_t arfcn, int valid)
 }
 
 /* callback function for runavg */
-static void afc_ravg_output(struct running_avg *ravg, int32_t avg)
+static void afc_ravg_output(__unused struct running_avg *ravg, int32_t avg)
 {
 	afc_correct(avg, afc_state.arfcn);
 }
diff --git a/src/target/firmware/layer1/apc.c b/src/target/firmware/layer1/apc.c
index 480c760..c3180d3 100644
--- a/src/target/firmware/layer1/apc.c
+++ b/src/target/firmware/layer1/apc.c
@@ -22,6 +22,8 @@
 
 #include <errno.h>
 
+#include <defines.h>
+
 #include <osmocom/core/utils.h>
 #include <osmocom/gsm/gsm_utils.h>
 
@@ -33,7 +35,7 @@ extern const int dbm2apc_gsm900_max;
 
 
 /* determine the AUXAPC value by the Tx Power Level */
-int16_t apc_tx_dbm2auxapc(enum gsm_band band, int8_t dbm)
+int16_t apc_tx_dbm2auxapc(__unused enum gsm_band band, int8_t dbm)
 {
 	if (dbm < 0)
 		return -ERANGE;
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index ed43e14..fd4ad09 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <byteorder.h>
 
@@ -302,11 +303,8 @@ static void l1ctl_rx_crypto_req(struct msgb *msg)
 }
 
 /* receive a L1CTL_DM_REL_REQ from L23 */
-static void l1ctl_rx_dm_rel_req(struct msgb *msg)
+static void l1ctl_rx_dm_rel_req(__unused struct msgb *msg)
 {
-	struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
-	struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *) l1h->data;
-
 	printd("L1CTL_DM_REL_REQ\n");
 	l1a_mftask_set(0);
 	l1s.dedicated.type = GSM_DCHAN_NONE;
@@ -574,7 +572,7 @@ static void l1ctl_sim_req(struct msgb *msg)
 }
 
 /* callback from SERCOMM when L2 sends a message to L1 */
-static void l1a_l23_rx_cb(uint8_t dlci, struct msgb *msg)
+static void l1a_l23_rx_cb(__unused uint8_t dlci, struct msgb *msg)
 {
 	struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
 
diff --git a/src/target/firmware/layer1/prim_fbsb.c b/src/target/firmware/layer1/prim_fbsb.c
index 023902d..06ecee2 100644
--- a/src/target/firmware/layer1/prim_fbsb.c
+++ b/src/target/firmware/layer1/prim_fbsb.c
@@ -178,8 +178,6 @@ static int l1s_sbdet_resp(__unused uint8_t p1, uint8_t attempt,
 	int qbits, fn_offset;
 	struct l1_cell_info *cinfo = &l1s.serving_cell;
 	int fnr_delta, bits_delta;
-	struct l1ctl_sync_new_ccch_resp *l1;
-	struct msgb *msg;
 
 	putchart('s');
 
@@ -327,7 +325,7 @@ static int read_fb_result(struct mon_state *st, int attempt)
 }
 
 static void fbinfo2cellinfo(struct l1_cell_info *cinfo,
-			    const struct mon_state *mon)
+			    __unused const struct mon_state *mon)
 {
 	int ntdma, qbits, fn_offset, fnr_delta, bits_delta;
 
@@ -523,8 +521,6 @@ static const struct tdma_sched_item fb_sched_set[] = {
 /* Asynchronous completion handler for FB detection */
 static void l1a_fb_compl(__unused enum l1_compl c)
 {
-	struct l1_cell_info *cinfo = &l1s.serving_cell;
-
 	if (last_fb->attempt >= 13) {
 		/* FB detection failed, signal this via L1CTL */
 		return l1ctl_fbsb_resp(255);
diff --git a/src/target/firmware/layer1/prim_rach.c b/src/target/firmware/layer1/prim_rach.c
index 47f7424..f0c553e 100644
--- a/src/target/firmware/layer1/prim_rach.c
+++ b/src/target/firmware/layer1/prim_rach.c
@@ -57,7 +57,6 @@ struct {
 /* p1: type of operation (0: one NB, 1: one RACH burst, 2: four NB */
 static int l1s_tx_rach_cmd(__unused uint8_t p1, __unused uint8_t p2, __unused uint16_t p3)
 {
-	int i;
 	uint16_t  *info_ptr;
 	uint8_t data[2];
 
diff --git a/src/target/firmware/layer1/prim_tch.c b/src/target/firmware/layer1/prim_tch.c
index 96858fb..e5f6a5a 100644
--- a/src/target/firmware/layer1/prim_tch.c
+++ b/src/target/firmware/layer1/prim_tch.c
@@ -500,7 +500,7 @@ const struct tdma_sched_item tch_sched_set[] = {
 /* This task is needed to perform some operation in the DSP when there is
  * no data to be exchanged */
 
-static int l1s_tch_d_resp(__unused uint8_t p1, __unused uint8_t p2, uint16_t p3)
+static int l1s_tch_d_resp(__unused uint8_t p1, __unused uint8_t p2, __unused uint16_t p3)
 {
 	/* mark READ page as being used */
 	dsp_api.r_page_used = 1;
diff --git a/src/target/firmware/layer1/prim_tx_nb.c b/src/target/firmware/layer1/prim_tx_nb.c
index 3038178..b886200 100644
--- a/src/target/firmware/layer1/prim_tx_nb.c
+++ b/src/target/firmware/layer1/prim_tx_nb.c
@@ -75,7 +75,6 @@ static int l1s_tx_cmd(uint8_t p1, uint8_t burst_id, uint16_t p3)
 {
 	uint16_t arfcn;
 	uint8_t tsc, tn;
-	uint8_t mf_task_id = p3 & 0xff;
 	uint8_t mf_task_flags = p3 >> 8;
 
 	putchart('T');
diff --git a/src/target/firmware/layer1/toa.c b/src/target/firmware/layer1/toa.c
index 7d80d95..e5b857c 100644
--- a/src/target/firmware/layer1/toa.c
+++ b/src/target/firmware/layer1/toa.c
@@ -24,6 +24,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <osmocom/gsm/gsm_utils.h>
 
@@ -71,7 +72,7 @@ void toa_reset(void)
 }
 
 /* callback function for runavg */
-static void toa_ravg_output(struct running_avg *ravg, int32_t avg)
+static void toa_ravg_output(__unused struct running_avg *ravg, int32_t avg)
 {
 	if (avg != 16) {
 		printf("TOA AVG is not 16 qbits, correcting (got %ld)\n", avg);
diff --git a/src/target/firmware/layer1/tpu_window.c b/src/target/firmware/layer1/tpu_window.c
index 2fdb048..e8762d4 100644
--- a/src/target/firmware/layer1/tpu_window.c
+++ b/src/target/firmware/layer1/tpu_window.c
@@ -135,7 +135,7 @@ void l1s_rx_win_ctrl(uint16_t arfcn, enum l1_rxwin_type wtype, uint8_t tn_ofs)
 	trf6151_set_mode(TRF6151_IDLE);
 }
 
-void l1s_tx_win_ctrl(uint16_t arfcn, enum l1_txwin_type wtype, uint8_t pwr, uint8_t tn_ofs)
+void l1s_tx_win_ctrl(uint16_t arfcn, enum l1_txwin_type wtype, __unused uint8_t pwr, uint8_t tn_ofs)
 {
 	uint16_t offset;
 
diff --git a/src/target/firmware/rf/trf6151.c b/src/target/firmware/rf/trf6151.c
index 5360402..29dd408 100644
--- a/src/target/firmware/rf/trf6151.c
+++ b/src/target/firmware/rf/trf6151.c
@@ -23,6 +23,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <defines.h>
 #include <debug.h>
 #include <memory.h>
 #include <keypad.h>
@@ -568,6 +569,11 @@ void trf6151_rx_window(int16_t start_qbits, uint16_t arfcn)
 /* prepare a Tx window with the TRF6151 finished at time 'start' (in qbits) */
 void trf6151_tx_window(int16_t start_qbits, uint16_t arfcn)
 {
+	/* prevent compiler from complaining when preprocessor causes
+	   variables start_qbits and arfcn to be unused */
+	(void)start_qbits;
+	(void)arfcn;
+
 #ifdef CONFIG_TX_ENABLE
 	int16_t start_pll_qbits;
 
-- 
1.7.8.rc1





More information about the baseband-devel mailing list