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_WORD(r->msg29_data, 0)
+ 1;
printc_dbg(" Code size : %lu byte = %lu kb\n",
printc_dbg(" Code size : %u byte = %u kb\n",
codeSize,
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();
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,
@ -508,7 +508,7 @@ static void fw_progress(unsigned int msg_id, unsigned long w_param,
if (w_param > 100)
w_param = 100;
printc(" %3d percent done\n", w_param);
printc(" %3lu percent done\n", w_param);
break;
case BL_UPDATE_ERROR:
@ -591,7 +591,7 @@ static int do_init(struct tilib_device *dev, const struct device_args *args)
return -1;
}
} 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);

View File

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

View File

@ -27,9 +27,12 @@
* Returns the number of characters printed (not including colour
* codes).
*/
int printc(const char *fmt, ...);
int printc_dbg(const char *fmt, ...);
int printc_err(const char *fmt, ...);
int printc(const char *fmt, ...)
__attribute__((format (printf, 1, 2)));
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);