Commit 9f4db79f authored by Adam Wujek's avatar Adam Wujek

remove warnings

New warnings are reported by a newer version of gcc used for RISCV
Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 0581b66d
......@@ -78,7 +78,7 @@ void minic_init()
mcr = minic_readl(MINIC_REG_MCR);
if (MINIC_MCR_VER_R(mcr) != MINIC_HDL_VERSION) {
pp_printf("Error: Minic HDL version %d not supported by sw\n",
MINIC_MCR_VER_R(mcr));
(int) MINIC_MCR_VER_R(mcr));
ver_supported = 0;
return;
}
......@@ -223,7 +223,7 @@ int minic_rx_frame(struct wr_ethhdr *hdr, uint8_t * payload, uint32_t buf_size,
int minic_tx_frame(struct wr_ethhdr_vlan *hdr, uint8_t *payload, uint32_t size,
struct hw_timestamp *hwts)
{
uint32_t d_hdr, mcr, pwords, hwords;
uint32_t mcr, pwords, hwords;
int ts_valid;
int i, hsize;
uint16_t *ptr;
......@@ -241,8 +241,6 @@ int minic_tx_frame(struct wr_ethhdr_vlan *hdr, uint8_t *payload, uint32_t size,
size = 60 - hsize;
pwords = ((size + 1) >> 1);
d_hdr = 0;
/* First we write status word (empty status for Tx) */
minic_txword(WRF_STATUS, 0);
......@@ -281,7 +279,8 @@ int minic_tx_frame(struct wr_ethhdr_vlan *hdr, uint8_t *payload, uint32_t size,
}
if (i == 1000)
pp_printf("Warning: tx not terminated infinite mcr=0x%x\n",mcr);
pp_printf("Warning: tx not terminated infinite mcr=0x%x\n",
(unsigned int) mcr);
if (hwts) {
uint32_t raw_ts;
......@@ -319,6 +318,7 @@ int minic_tx_frame(struct wr_ethhdr_vlan *hdr, uint8_t *payload, uint32_t size,
}
EXPLODE_WR_TIMESTAMP(raw_ts, counter_r, counter_f);
(void) counter_f; /* Make a compiler happy */
shw_pps_gen_get_time(&sec, &nsec);
if (counter_r > 3 * REF_CLOCK_FREQ_HZ / 4 && nsec < 250000000)
......@@ -331,7 +331,7 @@ int minic_tx_frame(struct wr_ethhdr_vlan *hdr, uint8_t *payload, uint32_t size,
minic.tx_count++;
}
return size;
}
......
......@@ -43,7 +43,7 @@ static int sfp_present(void)
static void sfp_read_i2c(int addr, uint8_t *mem, int start, int size)
{
int i = start;
uint8_t data, sum;
uint8_t data;
bb_i2c_init( &dev_i2c_sfp );
......@@ -55,7 +55,6 @@ static void sfp_read_i2c(int addr, uint8_t *mem, int start, int size)
bb_i2c_get_byte(&dev_i2c_sfp, &data, 1);
bb_i2c_stop(&dev_i2c_sfp);
*(mem + i) = data;
sum = data;
bb_i2c_start( &dev_i2c_sfp );
bb_i2c_put_byte(&dev_i2c_sfp, addr << 1 | BB_I2C_WRITE);
......
......@@ -1202,8 +1202,9 @@ int storage_sdbfs_format( struct storage_device *dev, uint32_t addr, int force_b
}
pp_printf("Formatting SDBFS in %s (base 0x%08x, size 0x%08x)...\n", dev->name,
base_addr, (uint32_t) (SDBFS_REC * wrc_sdbfs.blocksize) );
pp_printf("Formatting SDBFS in %s (base 0x%08x, size 0x%08x)...\n",
dev->name, (unsigned int) base_addr,
(unsigned int) (SDBFS_REC * wrc_sdbfs.blocksize) );
storage_sdbfs_erase(dev, addr, force_base);
......
......@@ -31,8 +31,10 @@ static int cmd_faketemp(const char *args[])
const char *dot;
if (!args[0]) {
pp_printf("%08x %08x %08x\n", temp_fake_data[0].t,
temp_fake_data[1].t, temp_fake_data[2].t);
pp_printf("%08x %08x %08x\n",
(unsigned int) temp_fake_data[0].t,
(unsigned int) temp_fake_data[1].t,
(unsigned int) temp_fake_data[2].t);
return 0;
}
......
......@@ -92,8 +92,8 @@ extern int wrc_temp_format(char *buffer, int len)
t = -(signed)t;
l += sprintf(buffer + l, "-");
}
l += sprintf(buffer + l,"%d.%04d", t >> 16,
((t & 0xffff) * 10 * 1000 >> 16));
l += sprintf(buffer + l,"%d.%04d", (int) (t >> 16),
(int) ((t & 0xffff) * 10 * 1000 >> 16));
}
return l;
}
......
......@@ -73,7 +73,7 @@ static int cmd_w1(const char *args[])
pp_printf("device %i: %08x%08x\n", i,
(int)(d->rom >> 32), (int)d->rom);
temp = w1_read_temp(d, 0);
pp_printf("temp: %d.%04d\n", temp >> 16,
pp_printf("temp: %d.%04d\n", (int) (temp >> 16),
(int)((temp & 0xffff) * 10 * 1000 >> 16));
}
}
......
......@@ -25,7 +25,7 @@ struct wrc_global {
int task_list_max;
struct wrc_task *task_list;
int temp_group_list_max;
struct wrc_temp *temp_group_list;
struct wrc_temp_group *temp_group_list;
volatile struct softpll_state *softpll;
struct spll_fifo_log *pll_fifo;
struct sfp_info *sfp_info;
......
......@@ -47,10 +47,12 @@ static inline void queue_put( struct event_queue* buf, int c )
static inline int queue_get( struct event_queue* buf )
{
int rv;
if( !buf->count )
return -1;
int rv = buf->data[buf->tail];
rv = buf->data[buf->tail];
buf->tail++;
if (buf->tail >= buf->size)
......
......@@ -75,8 +75,9 @@ static void ts_sub(struct wr_timestamp *t2, struct wr_timestamp *t1,
static void latency_warning(void) {
if (!lat_verbose)
return;
pp_printf("lat: unexpected %i.%i after %i.%i\n",
frame.sequence, frame.type, prev_sequence, prev_type);
pp_printf("lat: unexpected %d.%d after %d.%d\n",
(unsigned int) frame.sequence, (unsigned int) frame.type,
(unsigned int) prev_sequence, (unsigned int) prev_type);
}
/* report once a minute */
......@@ -198,9 +199,9 @@ static int latency_poll_rx(void)
if (lat_verbose) {
pp_printf("lat: %9i %6i.%03i %6i.%03i\n",
frame.sequence,
lat[0].nsec, lat[0].phase,
lat[1].nsec, lat[1].phase);
(unsigned int) frame.sequence,
(int) lat[0].nsec, (int) lat[0].phase,
(int) lat[1].nsec, (int) lat[1].phase);
return 1;
} else {
latency_report(lat);
......@@ -254,7 +255,7 @@ static int latency_poll_tx(void)
} else if (frame.ts->sec - lasts >= 10) {
lasts = frame.ts->sec;
pp_printf("latency: seq %9i sent @ %9i\n",
sequence, lasts);
(unsigned int) sequence, (unsigned int) lasts);
}
return 1;
......@@ -296,8 +297,9 @@ static int cmd_ltest(const char *args[])
lastt = 0; /* reset, so it fires immediately */
}
}
pp_printf("%i.%03i (%s)\n", latency_period_ms / 1000,
latency_period_ms % 1000, lat_verbose ? "verbose" : "quiet");
pp_printf("%i.%03i (%s)\n", (unsigned int) (latency_period_ms / 1000),
(unsigned int) (latency_period_ms % 1000),
lat_verbose ? "verbose" : "quiet");
return 0;
}
......
......@@ -891,7 +891,6 @@ static int func_aux_diag(uint8_t *buf, uint8_t in_oid_limb_matched_len,
{
int oid_twig_len = buf[0] - in_oid_limb_matched_len;
uint8_t *in_oid_limb_end = &buf[1 + in_oid_limb_matched_len];
uint8_t oid_twig_matching_len;
struct snmp_oid *oid;
struct snmp_oid leaf_obj;
int return_first = 0;
......@@ -924,9 +923,6 @@ static int func_aux_diag(uint8_t *buf, uint8_t in_oid_limb_matched_len,
in_oid_limb_end[TABLE_ROW] = TABLE_FIRST_ROW;
oid_twig_len = table_size;
}
/* Decide what is shorter the rest of the OID, or the
* matching part */
oid_twig_matching_len = min(oid_twig_len, table_size);
/* For get and set twig size has to be exact */
if (!snmp_get_next && (oid_twig_len != table_size)) {
......@@ -1237,8 +1233,8 @@ static int get_temp(uint8_t *buf, struct snmp_oid *obj)
t = -(signed)t;
l += sprintf(buffer, "-");
}
sprintf(buffer, "%d.%04d", t >> 16,
((t & 0xffff) * 10 * 1000 >> 16));
sprintf(buffer, "%d.%04d", (int) (t >> 16),
(int) ((t & 0xffff) * 10 * 1000 >> 16));
break;
}
}
......@@ -1920,6 +1916,9 @@ static int snmp_respond(uint8_t *buf)
(void) set_ptp_config;
(void) set_ptp_restart;
(void) set_aux_diag;
(void) set_shell_cmd;
(void) set_netconsole;
(void) set_sdb;
(void) func_aux_diag;
(void) get_i32sat_pp;
(void) oid_array_wrpcAuxRwTable;
......
......@@ -137,7 +137,7 @@ int syslog_poll(void)
len = syslog_header(buf, SYSLOG_DEFAULT_LEVEL, ip);
len += pp_sprintf(buf + len, "(%s) Node up "
"since %i seconds", format_mac(b, mac),
(tics - tics_zero) / 1000);
(int) ((tics - tics_zero) / 1000));
goto send;
}
......@@ -151,7 +151,8 @@ int syslog_poll(void)
down_tics = now - down_tics;
len = syslog_header(buf, SYSLOG_DEFAULT_LEVEL, ip);
len += pp_sprintf(buf + len, "Link up after %i.%03i s",
down_tics / 1000, down_tics % 1000);
(unsigned int) (down_tics / 1000),
(unsigned int) (down_tics % 1000));
down_tics = 0;
goto send;
}
......@@ -180,15 +181,17 @@ int syslog_poll(void)
if (track_ok_count == 1) {
len = syslog_header(buf, SYSLOG_DEFAULT_LEVEL, ip);
len += pp_sprintf(buf + len,
"Tracking after %i.%03i s",
prev_tics / 1000, prev_tics % 1000);
"Tracking after %i.%03i s",
(unsigned int) (prev_tics / 1000),
(unsigned int) (prev_tics % 1000));
goto send;
}
len = syslog_header(buf, SYSLOG_DEFAULT_LEVEL, ip);
len += pp_sprintf(buf + len,
"%i-th re-rtrack after %i.%03i s",
track_ok_count,
prev_tics / 1000, prev_tics % 1000);
(unsigned int) (prev_tics / 1000),
(unsigned int) (prev_tics % 1000));
/* Report if we didn't really loose time */
if (!bad_track_lost)
len += pp_sprintf(buf + len, " (max delta %i ps)",
......
......@@ -840,11 +840,11 @@ int wrc_log_stats(void)
for (i = 0; i < n_out - 1; i++) {
aux_stat = spll_get_aux_status(i);
pp_printf("aux%d:%08x%08x ", i, aux_stat.flags, aux_stat.phase);
pp_printf("aux%d:%08x%08x ", i, (int) aux_stat.flags, (int) aux_stat.phase);
}
/* fixme: clock is not always 125 MHz */
pp_printf("sec:%d nsec:%09d ", (uint32_t) sec, nsec);
pp_printf("sec:%d nsec:%09d ", (int) sec, (int) nsec);
wrh_servo = (ppi_static.protocol_extension == PPSI_EXT_WR && ppi_static.extState == PP_EXSTATE_ACTIVE) ?
(wrh_servo_t*) ppi_static.ext_data : NULL;
......@@ -861,11 +861,11 @@ int wrc_log_stats(void)
pp_printf("dms:%Ld ", pp_time_to_picos(&s->delayMS));
pp_printf("dtxm:%d drxm:%d ",
(int32_t) pp_time_to_picos(&wr_servo_ext->delta_txm),
(int32_t) pp_time_to_picos(&wr_servo_ext->delta_rxm));
(int) pp_time_to_picos(&wr_servo_ext->delta_txm),
(int) pp_time_to_picos(&wr_servo_ext->delta_rxm));
pp_printf("dtxs:%d drxs:%d ",
(int32_t) pp_time_to_picos(&wr_servo_ext->delta_txs),
(int32_t) pp_time_to_picos(&wr_servo_ext->delta_rxs));
(int) pp_time_to_picos(&wr_servo_ext->delta_txs),
(int) pp_time_to_picos(&wr_servo_ext->delta_rxs));
pp_printf("asym:%Ld ", interval_to_picos(ppi_static.portDS->delayAsymmetry));
crtt = wr_servo_ext->rawDelayMM;
......@@ -877,9 +877,9 @@ int wrc_log_stats(void)
/* Cable RTT */
pp_printf("crtt:%Ld ", pp_time_to_picos(&crtt));
/* Clock offset */
pp_printf("cko:%d ", (int32_t) pp_time_to_picos(&s->offsetFromMaster));
pp_printf("setp:%d ", wrh_servo->cur_setpoint_ps);
pp_printf("ucnt:%d ", (int32_t) s->update_count);
pp_printf("cko:%d ", (int) pp_time_to_picos(&s->offsetFromMaster));
pp_printf("setp:%d ", (int) wrh_servo->cur_setpoint_ps);
pp_printf("ucnt:%d ", (int) s->update_count);
pp_printf("bslide:%d ", ep_get_bitslide(&wrc_endpoint_dev));
}
......@@ -890,8 +890,8 @@ int wrc_log_stats(void)
int32_t temp;
temp = wrc_temp_get("pcb");
pp_printf("temp:%d.%04d C", temp >> 16,
(int)((temp & 0xffff) * 10 * 1000 >> 16));
pp_printf("temp:%d.%04d C", (int) (temp >> 16),
(int) ((temp & 0xffff) * 10 * 1000 >> 16));
}
pp_printf("\n");
......
......@@ -46,14 +46,15 @@ static int cmd_calibration(const char *args[])
int value = atoi(args[2]);
pp_printf("Setting calibration parameter %s [0x%x] to %d\n", args[1], param ,value );
pp_printf("Setting calibration parameter %s [0x%x] to %d\n",
args[1], (unsigned int) param, value);
storage_set_calibration_parameter( param, value );
}
} else if (!args[0]) {
if (storage_phtrans(&trans, 0) > 0) {
pp_printf("Found phase transition in EEPROM: %dps\n",
trans);
(unsigned int) trans);
return 0;
} else {
......
......@@ -23,8 +23,9 @@ static int cmd_diag(const char *args[])
if (!args[0]) {
pp_printf("Aux diagnostics info:\n");
pp_printf("id: %d.%d, r/w words: %d, r/o words: %d\n", id, ver,
nrw, nro);
pp_printf("id: %d.%d, r/w words: %d, r/o words: %d\n",
(unsigned int) id, (unsigned int) ver,
(unsigned int) nrw, (unsigned int) nro);
return 0;
}
......@@ -34,12 +35,14 @@ static int cmd_diag(const char *args[])
for(i=0; i<nro; i++ )
{
ret = diag_read_word(i, DIAG_RO_BANK, &val);
pp_printf("RO word %-3d = 0x%08x\n", i, val );
pp_printf("RO word %-3d = 0x%08x\n", i,
(unsigned int) val);
}
for(i=0; i<nrw; i++ )
{
ret = diag_read_word(i, DIAG_RW_BANK, &val);
pp_printf("RW word %-3d = 0x%08x\n", i, val );
pp_printf("RW word %-3d = 0x%08x\n", i,
(unsigned int) val);
}
return ret;
}
......@@ -48,7 +51,8 @@ static int cmd_diag(const char *args[])
addr = atoi(args[1]);
ret = diag_read_word(addr, DIAG_RO_BANK, &val);
if (!ret)
pp_printf("Word %d is 0x%08x\n", addr, val);
pp_printf("Word %d is 0x%08x\n",
(unsigned int) addr, (unsigned int) val);
return ret;
}
......@@ -56,7 +60,8 @@ static int cmd_diag(const char *args[])
addr = atoi(args[1]);
ret = diag_read_word(addr, DIAG_RW_BANK, &val);
if (!ret)
pp_printf("Word %d is 0x%08x\n", addr, val);
pp_printf("Word %d is 0x%08x\n",
(unsigned int) addr, (unsigned int) val);
return ret;
}
......@@ -66,7 +71,7 @@ static int cmd_diag(const char *args[])
ret = diag_write_word(addr, val);
if (!ret)
pp_printf("Value 0x%08x written to the word %d\n",
val, addr);
(unsigned int) val, (unsigned int) addr);
return ret;
}
......
......@@ -29,7 +29,7 @@ static int cmd_devmem(const char *args[])
fromhex(args[1], (void *)&value);
*addr = value;
} else {
pp_printf("%08x = %08x\n", (int)addr, *addr);
pp_printf("%08x = %08x\n", (int) addr, (unsigned int) *addr);
}
return 0;
}
......@@ -70,8 +70,8 @@ static int cmd_delays(const char *args[])
picos_to_pp_time(rx, &wr_servo_ext->delta_rxm);
picos_to_pp_time(tx, &wr_servo_ext->delta_txm);
} else {
pp_printf("tx: %i rx: %i\n", sfp_info.sfp_params.dTx,
sfp_info.sfp_params.dRx);
pp_printf("tx: %i rx: %i\n", (int) sfp_info.sfp_params.dTx,
(int) sfp_info.sfp_params.dRx);
}
return 0;
}
......
......@@ -16,7 +16,7 @@
static int cmd_pll(const char *args[])
{
int cur, tgt;
int32_t cur, tgt;
if (!strcasecmp(args[0], "init")) {
if (!args[3])
......@@ -36,7 +36,7 @@ static int cmd_pll(const char *args[])
if (!args[1])
return -EINVAL;
spll_get_phase_shift(atoi(args[1]), &cur, &tgt);
pp_printf("%d %d\n", cur, tgt);
pp_printf("%d %d\n", (int) cur, (int) tgt);
} else if (!strcasecmp(args[0], "start")) {
if (!args[1])
return -EINVAL;
......
......@@ -35,7 +35,7 @@ static int cmd_ps(const char *args[])
if (args[1])
print_task_time_threshold = atoi(args[1]);
pp_printf("print_task_time_threshold %d\n",
print_task_time_threshold);
(unsigned int) print_task_time_threshold);
return 0;
}
}
......
......@@ -33,7 +33,8 @@ static int cmd_sdb(const char *args[])
storage_sdbfs_format( &wrc_storage_dev, base, 0 );
} else {
base = atoi(args[1]);
pp_printf("Formatting using custom location 0x%X\n", base);
pp_printf("Formatting using custom location 0x%X\n",
(unsigned int) base);
storage_sdbfs_format( &wrc_storage_dev, base, 1 );
}
return 0;
......@@ -44,7 +45,8 @@ static int cmd_sdb(const char *args[])
storage_sdbfs_erase( &wrc_storage_dev, base, 0 );
} else {
base = atoi(args[1]);
pp_printf("Erasing using custom location 0x%X\n", base);
pp_printf("Erasing using custom location 0x%X\n",
(unsigned int) base);
storage_sdbfs_erase( &wrc_storage_dev, base, 1 );
}
return 0;
......
......@@ -128,8 +128,8 @@ static int cmd_sfp(const char *args[])
pp_printf("%d: PN:", i + 1);
for (temp = 0; temp < SFP_PN_LEN; ++temp)
pp_printf("%c", sfp.pn[temp]);
pp_printf(" dTx: %8d dRx: %8d alpha: %19Ld\n", sfp.dTx,
sfp.dRx, sfp.alpha);
pp_printf(" dTx: %8d dRx: %8d alpha: %19Ld\n",
(int) sfp.dTx, (int) sfp.dRx, sfp.alpha);
}
return 0;
} else if (!strcasecmp(args[0], "match")) {
......@@ -156,8 +156,9 @@ static int cmd_sfp(const char *args[])
}
/* match successful */
pp_printf("SFP matched, dTx=%d dRx=%d alpha=%Ld\n",
sfp_info.sfp_params.dTx, sfp_info.sfp_params.dRx,
sfp_info.sfp_params.alpha);
(int) sfp_info.sfp_params.dTx,
(int) sfp_info.sfp_params.dRx,
sfp_info.sfp_params.alpha);
return ret;
} else if (args[1] && !strcasecmp(args[0], "ena")) {
ep_sfp_enable(&wrc_endpoint_dev, atoi(args[1]));
......
......@@ -49,12 +49,12 @@ static int cmd_time(const char *args[])
return 0;
}
} else if (args[0] && !strcasecmp(args[0], "raw")) {
pp_printf("%d %d\n", (uint32_t) sec, nsec);
pp_printf("%d %d\n", (unsigned int) sec, (unsigned int) nsec);
return 0;
}
pp_printf("%s +%d nanoseconds.\n",
format_time(sec, TIME_FORMAT_LEGACY), nsec);
format_time(sec, TIME_FORMAT_LEGACY), (unsigned int) nsec);
/* fixme: clock freq is not always 125 MHz */
return 0;
......
......@@ -5,7 +5,7 @@ static int cmd_uptime(const char *args[])
{
extern uint32_t uptime_sec;
pp_printf("%u\n", uptime_sec);
pp_printf("%u\n", (unsigned int) uptime_sec);
return 0;
}
......
......@@ -15,7 +15,8 @@ extern void _reset_handler(void); /* user to reset again */
void check_stack(void)
{
assert(_endram == ENDRAM_MAGIC, "Stack overflow! (%x)\n", _endram);
assert(_endram == ENDRAM_MAGIC, "Stack overflow! (0x%x)\n",
(unsigned int) _endram);
}
#ifdef CONFIG_CHECK_RESET
......@@ -48,7 +49,9 @@ void check_reset(void)
pp_printf("\nWarning: the CPU was reset\nStack trace:\n");
while (p < &_fstack) {
pp_printf("%08x: %08x %08x %08x %08x\n",
(int)p, save[0], save[1], save[2], save[3]);
(int)p, (unsigned int) save[0],
(unsigned int) save[1], (unsigned int) save[2],
(unsigned int) save[3]);
p += 4;
save += 4;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment