LOCAL / fbdev: bcm2708_fb: fix build warnings on 64bit build 99/149999/2
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 14 Sep 2017 02:52:35 +0000 (11:52 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 14 Sep 2017 04:24:49 +0000 (13:24 +0900)
There are build warnings on arm64 build. Fix following build
warnings:
   drivers/video/fbdev/bcm2708_fb.c: In function 'vc_mem_copy':
   drivers/video/fbdev/bcm2708_fb.c:507:49: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t {aka long unsigned int}' [-Wformat=]
      pr_err("[%s]: failed to dma_alloc_coherent(%d)\n",
                                                    ^
   drivers/video/fbdev/bcm2708_fb.c:516:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      unsigned char *p = (unsigned char *)ioparam.src + offset;
                         ^
   drivers/video/fbdev/bcm2708_fb.c: In function 'bcm2708_fb_probe':
   drivers/video/fbdev/bcm2708_fb.c:844:9: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]
     pr_info("BCM2708FB: allocated DMA memory %08x\n",
            ^~~~~~

This only fixes the warnings, but functionality of fb_dmacopy is
already broken on ARM64.

Change-Id: Ib9035e38c79e668f74b47139c2a39faf937226db
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/video/fbdev/bcm2708_fb.c

index 612293c..bb3983f 100644 (file)
@@ -504,7 +504,7 @@ static long vc_mem_copy(struct bcm2708_fb *fb, unsigned long arg)
        buf = dma_alloc_coherent(fb->fb.device, PAGE_ALIGN(size), &bus_addr,
                                 GFP_ATOMIC);
        if (!buf) {
-               pr_err("[%s]: failed to dma_alloc_coherent(%d)\n",
+               pr_err("[%s]: failed to dma_alloc_coherent(%zu)\n",
                                __func__, size);
                rc = -ENOMEM;
                goto out;
@@ -513,7 +513,7 @@ static long vc_mem_copy(struct bcm2708_fb *fb, unsigned long arg)
        for (offset = 0; offset < ioparam.length; offset += size) {
                size_t remaining = ioparam.length - offset;
                size_t s = min(size, remaining);
-               unsigned char *p = (unsigned char *)ioparam.src + offset;
+               unsigned char *p = (unsigned char *)(uintptr_t)ioparam.src + offset;
                unsigned char *q = (unsigned char *)ioparam.dst + offset;
                dma_memcpy(fb, bus_addr, INTALIAS_L1L2_NONALLOCATING((dma_addr_t)p), size);
                if (copy_to_user(q, buf, s) != 0) {
@@ -841,8 +841,8 @@ static int bcm2708_fb_probe(struct platform_device *dev)
                goto free_fb;
        }
 
-       pr_info("BCM2708FB: allocated DMA memory %08x\n",
-              fb->cb_handle);
+       pr_info("BCM2708FB: allocated DMA memory %pad\n",
+              &fb->cb_handle);
 
        ret = bcm_dma_chan_alloc(BCM_DMA_FEATURE_BULK,
                                 &fb->dma_chan_base, &fb->dma_irq);