printc: add printf attribute.

This commit is contained in:
Daniel Beer 2012-08-17 07:37:56 +12:00
parent 53dd7f8188
commit ff42788071
4 changed files with 11 additions and 8 deletions

View File

@ -575,7 +575,7 @@ static int identify_new(struct fet_device *dev, const char *force_id)
LE_LONG(r->msg29_data, 0x02) LE_LONG(r->msg29_data, 0x02)
- LE_WORD(r->msg29_data, 0) - LE_WORD(r->msg29_data, 0)
+ 1; + 1;
printc_dbg(" Code size : %lu byte = %lu kb\n", printc_dbg(" Code size : %u byte = %u kb\n",
codeSize, codeSize,
codeSize / 1024); codeSize / 1024);

View File

@ -233,7 +233,7 @@ static void report_error(struct tilib_device *dev, const char *what)
long err = dev->MSP430_Error_Number(); long err = dev->MSP430_Error_Number();
const char *desc = dev->MSP430_Error_String(err); const char *desc = dev->MSP430_Error_String(err);
printc_err("tilib: %s: %s (error = %d)\n", what, desc, err); printc_err("tilib: %s: %s (error = %ld)\n", what, desc, err);
} }
static int tilib_readmem(device_t dev_base, address_t addr, static int tilib_readmem(device_t dev_base, address_t addr,
@ -508,7 +508,7 @@ static void fw_progress(unsigned int msg_id, unsigned long w_param,
if (w_param > 100) if (w_param > 100)
w_param = 100; w_param = 100;
printc(" %3d percent done\n", w_param); printc(" %3lu percent done\n", w_param);
break; break;
case BL_UPDATE_ERROR: case BL_UPDATE_ERROR:
@ -591,7 +591,7 @@ static int do_init(struct tilib_device *dev, const struct device_args *args)
return -1; return -1;
} }
} else { } else {
printc_dbg("Firmware version is %d\n", version); printc_dbg("Firmware version is %ld\n", version);
} }
printc_dbg("MSP430_VCC: %d mV\n", args->vcc_mv); printc_dbg("MSP430_VCC: %d mV\n", args->vcc_mv);

View File

@ -79,7 +79,7 @@ static void event_print(const struct event *e)
break; break;
case EVENT_READ_16: case EVENT_READ_16:
printc("read.w => %s 0x%04x\n", name); printc("read.w => %s\n", name);
break; break;
case EVENT_WRITE_8: case EVENT_WRITE_8:

View File

@ -27,9 +27,12 @@
* Returns the number of characters printed (not including colour * Returns the number of characters printed (not including colour
* codes). * codes).
*/ */
int printc(const char *fmt, ...); int printc(const char *fmt, ...)
int printc_dbg(const char *fmt, ...); __attribute__((format (printf, 1, 2)));
int printc_err(const char *fmt, ...); int printc_dbg(const char *fmt, ...)
__attribute__((format (printf, 1, 2)));
int printc_err(const char *fmt, ...)
__attribute__((format (printf, 1, 2)));
void pr_error(const char *prefix); void pr_error(const char *prefix);