diff mbox

[v2] drm/msm: Fix a couple of 64-bit build warnings

Message ID 1428590391-28132-1-git-send-email-thierry.reding@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Thierry Reding April 9, 2015, 2:39 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

Avoid casts from pointers to fixed-size integers to prevent the compiler
from warning. Print virtual memory addresses using %p instead. Also turn
a couple of %d/%x specifiers into %zu/%zd/%zx to avoid further warnings
due to mismatched format strings.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- print physical addresses using %pa (fixes another warning that started
  to appear in next-20150409)

 drivers/gpu/drm/msm/edp/edp_aux.c |  4 ++--
 drivers/gpu/drm/msm/msm_drv.c     | 10 +++++-----
 drivers/gpu/drm/msm/msm_gem.c     |  2 +-
 drivers/gpu/drm/msm/msm_iommu.c   |  4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

Comments

Rob Clark April 9, 2015, 6:24 p.m. UTC | #1
On Thu, Apr 9, 2015 at 10:39 AM, Thierry Reding
<thierry.reding@gmail.com> wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> Avoid casts from pointers to fixed-size integers to prevent the compiler
> from warning. Print virtual memory addresses using %p instead. Also turn
> a couple of %d/%x specifiers into %zu/%zd/%zx to avoid further warnings
> due to mismatched format strings.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Thanks Thierry, I can include this when I send a -fixes pull.  Or if
you prefer I'm fine with this going in sooner via another tree..

Reviewed-by: Rob Clark <robdclark@gmail.com>

> ---
> Changes in v2:
> - print physical addresses using %pa (fixes another warning that started
>   to appear in next-20150409)
>
>  drivers/gpu/drm/msm/edp/edp_aux.c |  4 ++--
>  drivers/gpu/drm/msm/msm_drv.c     | 10 +++++-----
>  drivers/gpu/drm/msm/msm_gem.c     |  2 +-
>  drivers/gpu/drm/msm/msm_iommu.c   |  4 ++--
>  4 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/edp/edp_aux.c b/drivers/gpu/drm/msm/edp/edp_aux.c
> index 5f5a84f6074c..208f9d47f82e 100644
> --- a/drivers/gpu/drm/msm/edp/edp_aux.c
> +++ b/drivers/gpu/drm/msm/edp/edp_aux.c
> @@ -132,7 +132,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg)
>         /* msg sanity check */
>         if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) ||
>                 (msg->size > AUX_CMD_I2C_MAX)) {
> -               pr_err("%s: invalid msg: size(%d), request(%x)\n",
> +               pr_err("%s: invalid msg: size(%zu), request(%x)\n",
>                         __func__, msg->size, msg->request);
>                 return -EINVAL;
>         }
> @@ -155,7 +155,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg)
>                  */
>                 edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0);
>                 msm_edp_aux_ctrl(aux, 1);
> -               pr_err("%s: aux timeout, %d\n", __func__, ret);
> +               pr_err("%s: aux timeout, %zd\n", __func__, ret);
>                 goto unlock_exit;
>         }
>         DBG("completion");
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 47f4dd407671..cc5dc5299b8d 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -94,7 +94,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
>         }
>
>         if (reglog)
> -               printk(KERN_DEBUG "IO:region %s %08x %08lx\n", dbgname, (u32)ptr, size);
> +               printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size);
>
>         return ptr;
>  }
> @@ -102,7 +102,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
>  void msm_writel(u32 data, void __iomem *addr)
>  {
>         if (reglog)
> -               printk(KERN_DEBUG "IO:W %08x %08x\n", (u32)addr, data);
> +               printk(KERN_DEBUG "IO:W %p %08x\n", addr, data);
>         writel(data, addr);
>  }
>
> @@ -110,7 +110,7 @@ u32 msm_readl(const void __iomem *addr)
>  {
>         u32 val = readl(addr);
>         if (reglog)
> -               printk(KERN_ERR "IO:R %08x %08x\n", (u32)addr, val);
> +               printk(KERN_ERR "IO:R %p %08x\n", addr, val);
>         return val;
>  }
>
> @@ -177,7 +177,7 @@ static int get_mdp_ver(struct platform_device *pdev)
>         const struct of_device_id *match;
>         match = of_match_node(match_types, dev->of_node);
>         if (match)
> -               return (int)match->data;
> +               return (int)(unsigned long)match->data;
>  #endif
>         return 4;
>  }
> @@ -216,7 +216,7 @@ static int msm_init_vram(struct drm_device *dev)
>                 if (ret)
>                         return ret;
>                 size = r.end - r.start;
> -               DRM_INFO("using VRAM carveout: %lx@%08x\n", size, r.start);
> +               DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start);
>         } else
>  #endif
>
> diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
> index 479d8af72bcb..52839769eb6c 100644
> --- a/drivers/gpu/drm/msm/msm_gem.c
> +++ b/drivers/gpu/drm/msm/msm_gem.c
> @@ -483,7 +483,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
>         uint64_t off = drm_vma_node_start(&obj->vma_node);
>
>         WARN_ON(!mutex_is_locked(&dev->struct_mutex));
> -       seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %d\n",
> +       seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %zu\n",
>                         msm_obj->flags, is_active(msm_obj) ? 'A' : 'I',
>                         msm_obj->read_fence, msm_obj->write_fence,
>                         obj->name, obj->refcount.refcount.counter,
> diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
> index 7acdaa5688b7..7ac2f1997e4a 100644
> --- a/drivers/gpu/drm/msm/msm_iommu.c
> +++ b/drivers/gpu/drm/msm/msm_iommu.c
> @@ -60,7 +60,7 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova,
>                 u32 pa = sg_phys(sg) - sg->offset;
>                 size_t bytes = sg->length + sg->offset;
>
> -               VERB("map[%d]: %08x %08x(%x)", i, iova, pa, bytes);
> +               VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes);
>
>                 ret = iommu_map(domain, da, pa, bytes, prot);
>                 if (ret)
> @@ -99,7 +99,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova,
>                 if (unmapped < bytes)
>                         return unmapped;
>
> -               VERB("unmap[%d]: %08x(%x)", i, iova, bytes);
> +               VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);
>
>                 BUG_ON(!PAGE_ALIGNED(bytes));
>
> --
> 2.3.2
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/msm/edp/edp_aux.c b/drivers/gpu/drm/msm/edp/edp_aux.c
index 5f5a84f6074c..208f9d47f82e 100644
--- a/drivers/gpu/drm/msm/edp/edp_aux.c
+++ b/drivers/gpu/drm/msm/edp/edp_aux.c
@@ -132,7 +132,7 @@  ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg)
 	/* msg sanity check */
 	if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) ||
 		(msg->size > AUX_CMD_I2C_MAX)) {
-		pr_err("%s: invalid msg: size(%d), request(%x)\n",
+		pr_err("%s: invalid msg: size(%zu), request(%x)\n",
 			__func__, msg->size, msg->request);
 		return -EINVAL;
 	}
@@ -155,7 +155,7 @@  ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg)
 		 */
 		edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0);
 		msm_edp_aux_ctrl(aux, 1);
-		pr_err("%s: aux timeout, %d\n", __func__, ret);
+		pr_err("%s: aux timeout, %zd\n", __func__, ret);
 		goto unlock_exit;
 	}
 	DBG("completion");
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 47f4dd407671..cc5dc5299b8d 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -94,7 +94,7 @@  void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
 	}
 
 	if (reglog)
-		printk(KERN_DEBUG "IO:region %s %08x %08lx\n", dbgname, (u32)ptr, size);
+		printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size);
 
 	return ptr;
 }
@@ -102,7 +102,7 @@  void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
 void msm_writel(u32 data, void __iomem *addr)
 {
 	if (reglog)
-		printk(KERN_DEBUG "IO:W %08x %08x\n", (u32)addr, data);
+		printk(KERN_DEBUG "IO:W %p %08x\n", addr, data);
 	writel(data, addr);
 }
 
@@ -110,7 +110,7 @@  u32 msm_readl(const void __iomem *addr)
 {
 	u32 val = readl(addr);
 	if (reglog)
-		printk(KERN_ERR "IO:R %08x %08x\n", (u32)addr, val);
+		printk(KERN_ERR "IO:R %p %08x\n", addr, val);
 	return val;
 }
 
@@ -177,7 +177,7 @@  static int get_mdp_ver(struct platform_device *pdev)
 	const struct of_device_id *match;
 	match = of_match_node(match_types, dev->of_node);
 	if (match)
-		return (int)match->data;
+		return (int)(unsigned long)match->data;
 #endif
 	return 4;
 }
@@ -216,7 +216,7 @@  static int msm_init_vram(struct drm_device *dev)
 		if (ret)
 			return ret;
 		size = r.end - r.start;
-		DRM_INFO("using VRAM carveout: %lx@%08x\n", size, r.start);
+		DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start);
 	} else
 #endif
 
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 479d8af72bcb..52839769eb6c 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -483,7 +483,7 @@  void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
 	uint64_t off = drm_vma_node_start(&obj->vma_node);
 
 	WARN_ON(!mutex_is_locked(&dev->struct_mutex));
-	seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %d\n",
+	seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %zu\n",
 			msm_obj->flags, is_active(msm_obj) ? 'A' : 'I',
 			msm_obj->read_fence, msm_obj->write_fence,
 			obj->name, obj->refcount.refcount.counter,
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index 7acdaa5688b7..7ac2f1997e4a 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -60,7 +60,7 @@  static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova,
 		u32 pa = sg_phys(sg) - sg->offset;
 		size_t bytes = sg->length + sg->offset;
 
-		VERB("map[%d]: %08x %08x(%x)", i, iova, pa, bytes);
+		VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes);
 
 		ret = iommu_map(domain, da, pa, bytes, prot);
 		if (ret)
@@ -99,7 +99,7 @@  static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova,
 		if (unmapped < bytes)
 			return unmapped;
 
-		VERB("unmap[%d]: %08x(%x)", i, iova, bytes);
+		VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);
 
 		BUG_ON(!PAGE_ALIGNED(bytes));