rpmsg: fix build warning when compiling 64-bit
PATCH 1/1 rpmsg: fix build warning when compiling 64-bit
dev_dbg() in rpmsg_probe() made use of the %x formatting which expects an 'unsigned int' which dma_addr_t is not when compiling for 64-bit. Casting to a 'void *' and using %p will avoid this and not force an upcast to a 64-bit value for 32-bit builds.
--- drivers/rpmsg/virtio_rpmsg_bus.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/rpmsg/virtio_rpmsg_bus.c +2 -2
@@ -891,8 +891,8 @@ static int rpmsg_probe(struct virtio_device *vdev)if (!bufs_va) goto vqs_del; -dev_dbg (&vdev->dev,"buffers: va %p, dma 0x%x\n" , bufs_va, - vrp->bufs_dma); +dev_dbg (&vdev->dev,"buffers: va %p, dma %p\n" , bufs_va, + (void *)vrp->bufs_dma);/* half of the buffers is dedicated for RX */ vrp->rbufs = bufs_va;
Signature · 1 line
1.7.5.4
PATCH 1/1 rpmsg: fix build warning when compiling 64-bit
Quoted 5 lines · Mark Asselstine
dev_dbg()inrpmsg_probe()made use of the %x formatting which expects an 'unsigned int' whichdma_addr_tis not when compiling for 64-bit. Casting to a 'void *' and using %p will avoid this and not force an upcast to a 64-bit value for 32-bit builds.
This does not work on 32-bit platforms with a 64-bit dma_addr_t though. Better cast to unsigned long long and print using 0x%llx.
Arnd
PATCH v2 1/1 rpmsg: fix build warning when dma_addr_t is 64-bit
dev_dbg() in rpmsg_probe() made use of the %x formatting that expects an 'unsigned int' which dma_addr_t is not in cases where dma_addr_t is 64-bit (CONFIG_ARCH_DMA_ADDR_T_64BIT). Casting to a 'unsigned long long' and using %llx will avoid this.
--- drivers/rpmsg/virtio_rpmsg_bus.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/rpmsg/virtio_rpmsg_bus.c +2 -2
@@ -891,8 +891,8 @@ static int rpmsg_probe(struct virtio_device *vdev)if (!bufs_va) goto vqs_del; -dev_dbg (&vdev->dev,"buffers: va %p, dma 0x%x\n" , bufs_va, - vrp->bufs_dma); +dev_dbg (&vdev->dev,"buffers: va %p, dma 0x%llx\n" , bufs_va, + (unsigned long long )vrp->bufs_dma);/* half of the buffers is dedicated for RX */ vrp->rbufs = bufs_va;
Signature · 1 line
1.7.5.4
PATCH v2 1/1 rpmsg: fix build warning when dma_addr_t is 64-bit
Quoted 8 lines · Mark Asselstine
dev_dbg()inrpmsg_probe()made use of the %x formatting that expects an 'unsigned int' whichdma_addr_tis not in cases wheredma_addr_tis 64-bit (CONFIG_ARCH_DMA_ADDR_T_64BIT). Casting to a 'unsigned long long' and using %llx will avoid this.Signed-off-by Mark Asselstine <[email protected]>CC Ohad Ben-Cohen <[email protected]>CC Arnd Bergmann <[email protected]>
Thanks, Mark !
I'll send this to Arnd later this week together with the other remoteproc/rpmsg patches.
Ohad.