[PATCH 2/9] i386/pc386: Fix printk formatting warnings.
Chris Johns
chrisj at rtems.org
Mon May 23 06:55:41 UTC 2016
---
c/src/lib/libbsp/i386/pc386/console/console_control.c | 2 +-
c/src/lib/libbsp/i386/pc386/console/exar17d15x.c | 2 +-
c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c | 12 +++++++-----
c/src/lib/libbsp/i386/pc386/console/inch.c | 2 ++
c/src/lib/libbsp/i386/pc386/console/uart_bus_pci.c | 6 +++---
c/src/lib/libbsp/i386/pc386/ide/ide.c | 16 ++++++++++------
c/src/lib/libbsp/i386/shared/comm/i386-stub.c | 1 -
c/src/lib/libbsp/i386/shared/comm/tty_drv.c | 4 +++-
8 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/c/src/lib/libbsp/i386/pc386/console/console_control.c b/c/src/lib/libbsp/i386/pc386/console/console_control.c
index 3a454d9..e5e4bc1 100644
--- a/c/src/lib/libbsp/i386/pc386/console/console_control.c
+++ b/c/src/lib/libbsp/i386/pc386/console/console_control.c
@@ -54,7 +54,7 @@ rtems_device_driver console_control(
break;
case MW_UID_REGISTER_DEVICE:
- printk( "SerialMouse: reg=%s\n", args->buffer );
+ printk( "SerialMouse: reg=%s\n", (const char*) args->buffer );
register_kbd_msg_queue( args->buffer, 0 );
break;
diff --git a/c/src/lib/libbsp/i386/pc386/console/exar17d15x.c b/c/src/lib/libbsp/i386/pc386/console/exar17d15x.c
index d17c948..83cb029 100644
--- a/c/src/lib/libbsp/i386/pc386/console/exar17d15x.c
+++ b/c/src/lib/libbsp/i386/pc386/console/exar17d15x.c
@@ -166,7 +166,7 @@ rtems_device_driver exar17d15x_initialize(
&conf[instance].base
);
printk(
- "Found Exar 17D15x %d at 0x%08x IRQ %d with %d ports\n",
+ "Found Exar 17D15x %d at 0x%08lx IRQ %d with %d ports\n",
instance,
conf[instance].base,
conf[instance].irq,
diff --git a/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c b/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
index fa41d01..fa3f00c 100644
--- a/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
+++ b/c/src/lib/libbsp/i386/pc386/console/fb_vesa_rm.c
@@ -42,6 +42,8 @@
* - RTEMS fb_cirrus.c - Alexandru-Sever Horin (alex.sever.h at gmail.com)
*/
+#include <inttypes.h>
+
#include <bsp.h>
#include <bsp/fb_default_mode.h>
@@ -785,7 +787,7 @@ void vesa_realmode_bootup_init(void)
if ((vbe_ret_val&0xff)!=VBE_functionSupported ||
(vbe_ret_val>>8)!=VBE_callSuccessful)
{
- printk(FB_VESA_NAME " Cannot get mode info anymore. ax=0x%x\n",
+ printk(FB_VESA_NAME " Cannot get mode info anymore. ax=0x%lx\n",
vbe_ret_val);
}
@@ -822,7 +824,7 @@ void vesa_realmode_bootup_init(void)
if ((vbe_ret_val&0xff)!= (VBE_functionSupported | VBE_callSuccessful<<8))
printk(FB_VESA_NAME " Call to function 2h (set VBE mode) failed. "
- "ax=0x%x\n", vbe_ret_val);
+ "ax=0x%" PRIx32 "\n", vbe_ret_val);
vib = (void *) 0;
mib = (void *) 0;
@@ -968,9 +970,9 @@ frame_buffer_control(
{
rtems_libio_ioctl_args_t *args = arg;
- printk( FB_VESA_NAME " ioctl called, cmd=%x\n", args->command );
- printk("fbxres %d, fbyres %d\n", fb_var.xres, fb_var.yres);
- printk("fbbpp %d\n", fb_var.bits_per_pixel);
+ printk( FB_VESA_NAME " ioctl called, cmd=%" PRIx32 "\n", args->command );
+ printk("fbxres %lu, fbyres %lu\n", fb_var.xres, fb_var.yres);
+ printk("fbbpp %lu\n", fb_var.bits_per_pixel);
switch (args->command)
{
diff --git a/c/src/lib/libbsp/i386/pc386/console/inch.c b/c/src/lib/libbsp/i386/pc386/console/inch.c
index e503de5..047269e 100644
--- a/c/src/lib/libbsp/i386/pc386/console/inch.c
+++ b/c/src/lib/libbsp/i386/pc386/console/inch.c
@@ -206,9 +206,11 @@ _IBMPC_scankey(char *outChar)
static bool
_IBMPC_chrdy(char *c)
{
+#if CCJ_REMOVED_NO_IDEA_ABOUT_THIS_CODE_OR_COMMENT
/* FIX ME!!! It doesn't work without something like the following line.
Find out why! */
printk("");
+#endif
/* Check buffer our ISR builds */
if (kbd_first != kbd_last)
diff --git a/c/src/lib/libbsp/i386/pc386/console/uart_bus_pci.c b/c/src/lib/libbsp/i386/pc386/console/uart_bus_pci.c
index 7b48248..e90eb57 100644
--- a/c/src/lib/libbsp/i386/pc386/console/uart_bus_pci.c
+++ b/c/src/lib/libbsp/i386/pc386/console/uart_bus_pci.c
@@ -285,14 +285,14 @@ static uint8_t pci_ns16550_io_get_register(uint32_t addr, uint8_t i)
{
uint8_t val = rtems_inb(addr + i);
if (UART_PCI_IO)
- printk( "RD(%p -> 0x%02x) ", addr + i, val );
+ printk( "RD(%p -> 0x%02x) ", (void*) addr + i, val );
return val;
}
static void pci_ns16550_io_set_register(uint32_t addr, uint8_t i, uint8_t val)
{
if (UART_PCI_IO)
- printk( "WR(%p <- 0x%02x) ", addr + i, val );
+ printk( "WR(%p <- 0x%02x) ", (void*) addr + i, val );
rtems_outb(addr + i, val);
}
@@ -453,7 +453,7 @@ void pci_uart_probe(void)
printk(
- "%s:%d:%s,%s:0x%x%s%s,irq:%d,clk:%d\n", /* */
+ "%s:%d:%s,%s:0x%lx%s%s,irq:%d,clk:%lu\n", /* */
name, b, conf[b].desc,
io ? "io" : "mem", base, locatable, prefectable,
conf[b].irq, conf[b].clock
diff --git a/c/src/lib/libbsp/i386/pc386/ide/ide.c b/c/src/lib/libbsp/i386/pc386/ide/ide.c
index 73b6df2..52877cf 100644
--- a/c/src/lib/libbsp/i386/pc386/ide/ide.c
+++ b/c/src/lib/libbsp/i386/pc386/ide/ide.c
@@ -23,7 +23,10 @@
| 01.14.03 creation doe |
\*===============================================================*/
+#include <inttypes.h>
+
#include <rtems.h>
+
#include <bsp.h>
#include <libchip/ide_ctrl.h>
#include <libchip/ide_ctrl_cfg.h>
@@ -199,7 +202,7 @@ static void pc386_ide_initialize
uint8_t dev = 0;
if (pc386_ide_show)
- printk("IDE%d: port base: %04x\n", minor, port);
+ printk("IDE%d: port base: %04" PRIu32 "\n", minor, port);
outport_byte(port+IDE_REGISTER_DEVICE_HEAD,
(dev << IDE_REGISTER_DEVICE_HEAD_DEV_POS) | 0xE0);
@@ -303,7 +306,7 @@ static void pc386_ide_initialize
uint16_t word;
if (pc386_ide_show && ((byte % 16) == 0))
- printk("\n %04x : ", byte);
+ printk("\n %04" PRIx32 " : ", byte);
inport_word(port+IDE_REGISTER_DATA, word);
@@ -346,7 +349,7 @@ static void pc386_ide_initialize
}
if (pc386_ide_show)
- printk("\nbytes read = %d\n", byte);
+ printk("\nbytes read = %" PRIu32 "\n", byte);
if (p != &model_number[0])
{
@@ -388,7 +391,7 @@ static void pc386_ide_initialize
p--;
}
- printk("IDE%d:%s:%s, %u.%u%c (%u/%u/%u), max blk size:%d\n",
+ printk("IDE%d:%s:%s, %" PRIu32 ".%" PRIu32 "%c (%" PRIu32 "/%" PRIu32 "/%" PRIu32 "), max blk size:%d\n",
minor, label, model_number, left, right, units,
heads, cylinders, sectors, max_multiple_sectors * 512);
}
@@ -541,7 +544,8 @@ static void pc386_ide_read_block
if (!pc386_ide_status_data_ready (port, pc386_ide_timeout,
&status_val, pc386_ide_tasking_sleep))
{
- printk ("pc386_ide_read_block: block=%u cbuf=%u status=%02x, cnt=%d bs=%d\n",
+ printk ("pc386_ide_read_block: block=%" PRIu32 \
+ " cbuf=%" PRIu32 " status=%02x, cnt=%" PRIu32 " bs=%" PRIu32 "\n",
bufs[*cbuf].block, *cbuf, status_val, cnt, block_size);
/* FIXME: add an error here. */
return;
@@ -620,7 +624,7 @@ static void pc386_ide_write_block
if (!pc386_ide_status_data_ready (port, pc386_ide_timeout,
&status_val, pc386_ide_tasking_sleep))
{
- printk ("pc386_ide_write_block: block=%u status=%02x, cnt=%d bs=%d\n",
+ printk ("pc386_ide_write_block: block=%" PRIu32 " status=%02x, cnt=%" PRIu32 " bs=%" PRIu32 "\n",
bufs[*cbuf].block, status_val, cnt, block_size);
/* FIXME: add an error here. */
return;
diff --git a/c/src/lib/libbsp/i386/shared/comm/i386-stub.c b/c/src/lib/libbsp/i386/shared/comm/i386-stub.c
index d28a431..1eff100 100644
--- a/c/src/lib/libbsp/i386/shared/comm/i386-stub.c
+++ b/c/src/lib/libbsp/i386/shared/comm/i386-stub.c
@@ -1032,7 +1032,6 @@ handle_exception (int exceptionVector)
if (*(ptr++) == ',')
{
bool insert = remcomInBuffer[0] == 'Z';
- printk("hbreak type\n", insert);
if (hexToInt (&ptr, &addr))
{
if (*(ptr++) == ',')
diff --git a/c/src/lib/libbsp/i386/shared/comm/tty_drv.c b/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
index 16a40df..bbc22af 100644
--- a/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
+++ b/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
@@ -16,6 +16,7 @@
****************************************************************************/
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
@@ -262,7 +263,8 @@ conSetAttr(int port, int minor, const struct termios *t)
stopbits = 0;
}
- printk("Setting attributes, port=%X, baud=%d, linemode = 0x%02x\n", port, baud, databits | parity | stopbits );
+ printk("Setting attributes, port=%X, baud=%" PRId32 ", linemode = 0x%02" PRIx32 "\n",
+ port, baud, databits | parity | stopbits );
BSP_uart_set_attributes(port, baud, databits, parity, stopbits);
return 0;
}
--
2.4.6
More information about the devel
mailing list