All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/omap: Remove casting the return value which is a void pointer
@ 2013-09-09  5:39 Jingoo Han
       [not found] ` <005601cead1e$ffe78470$ffb68d50$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Jingoo Han @ 2013-09-09  5:39 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: 'Joerg Roedel', 'Suman Anna', linux-kernel,
	'Jingoo Han'

Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/iommu/omap-iopgtable.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/omap-iopgtable.h b/drivers/iommu/omap-iopgtable.h
index f4003d5..b6f9a51 100644
--- a/drivers/iommu/omap-iopgtable.h
+++ b/drivers/iommu/omap-iopgtable.h
@@ -95,4 +95,4 @@ static inline phys_addr_t omap_iommu_translate(u32 d, u32 va, u32 mask)
 #define iopte_offset(iopgd, da)	(iopgd_page_vaddr(iopgd) + iopte_index(da))
 
 #define to_iommu(dev)							\
-	((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))
+	(platform_get_drvdata(to_platform_device(dev)))
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] iommu/omap: Remove casting the return value which is a void pointer
  2013-09-09  5:39 Jingoo Han
@ 2013-09-12 22:30     ` Suman Anna
  0 siblings, 0 replies; 5+ messages in thread
From: Suman Anna @ 2013-09-12 22:30 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Andrew Morton',
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 09/09/2013 12:39 AM, Jingoo Han wrote:
> Casting the return value which is a void pointer is redundant.
> The conversion from void pointer to any other pointer type is
> guaranteed by the C programming language.
> 
> Signed-off-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

Thanks, LGTM.

> ---
>  drivers/iommu/omap-iopgtable.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/omap-iopgtable.h b/drivers/iommu/omap-iopgtable.h
> index f4003d5..b6f9a51 100644
> --- a/drivers/iommu/omap-iopgtable.h
> +++ b/drivers/iommu/omap-iopgtable.h
> @@ -95,4 +95,4 @@ static inline phys_addr_t omap_iommu_translate(u32 d, u32 va, u32 mask)
>  #define iopte_offset(iopgd, da)	(iopgd_page_vaddr(iopgd) + iopte_index(da))
>  
>  #define to_iommu(dev)							\
> -	((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))
> +	(platform_get_drvdata(to_platform_device(dev)))
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iommu/omap: Remove casting the return value which is a void pointer
@ 2013-09-12 22:30     ` Suman Anna
  0 siblings, 0 replies; 5+ messages in thread
From: Suman Anna @ 2013-09-12 22:30 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Andrew Morton', 'Joerg Roedel', linux-kernel,
	iommu

On 09/09/2013 12:39 AM, Jingoo Han wrote:
> Casting the return value which is a void pointer is redundant.
> The conversion from void pointer to any other pointer type is
> guaranteed by the C programming language.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Thanks, LGTM.

> ---
>  drivers/iommu/omap-iopgtable.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/omap-iopgtable.h b/drivers/iommu/omap-iopgtable.h
> index f4003d5..b6f9a51 100644
> --- a/drivers/iommu/omap-iopgtable.h
> +++ b/drivers/iommu/omap-iopgtable.h
> @@ -95,4 +95,4 @@ static inline phys_addr_t omap_iommu_translate(u32 d, u32 va, u32 mask)
>  #define iopte_offset(iopgd, da)	(iopgd_page_vaddr(iopgd) + iopte_index(da))
>  
>  #define to_iommu(dev)							\
> -	((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))
> +	(platform_get_drvdata(to_platform_device(dev)))
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] iommu/omap: Remove casting the return value which is a void pointer
@ 2014-08-29  3:47 Jingoo Han
       [not found] ` <004e01cfc33c$03b26230$0b172690$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Jingoo Han @ 2014-08-29  3:47 UTC (permalink / raw)
  To: 'Joerg Roedel'
  Cc: 'Ohad Ben-Cohen', 'Jingoo Han',
	'Linux IOMMU', 'Laurent Pinchart'

Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 drivers/iommu/omap-iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index e202b0c24120..02ef0ace7386 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -34,8 +34,7 @@
 #include "omap-iopgtable.h"
 #include "omap-iommu.h"
 
-#define to_iommu(dev)							\
-	((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))
+#define to_iommu(dev)	platform_get_drvdata(to_platform_device(dev))
 
 #define for_each_iotlb_cr(obj, n, __i, cr)				\
 	for (__i = 0;							\
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] iommu/omap: Remove casting the return value which is a void pointer
       [not found] ` <004e01cfc33c$03b26230$0b172690$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2014-08-29  8:45   ` Laurent Pinchart
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2014-08-29  8:45 UTC (permalink / raw)
  To: Jingoo Han; +Cc: 'Ohad Ben-Cohen', 'Linux IOMMU'

Hi Jingoo,

Thank you for the patch.

On Friday 29 August 2014 12:47:54 Jingoo Han wrote:
> Casting the return value which is a void pointer is redundant.
> The conversion from void pointer to any other pointer type is
> guaranteed by the C programming language.

I agree with that, but the explicit cast helps making sure we don't assign the 
value of to_iommu(dev) to a non struct omap_iommu pointer by mistake.

> Signed-off-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
>  drivers/iommu/omap-iommu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
> index e202b0c24120..02ef0ace7386 100644
> --- a/drivers/iommu/omap-iommu.c
> +++ b/drivers/iommu/omap-iommu.c
> @@ -34,8 +34,7 @@
>  #include "omap-iopgtable.h"
>  #include "omap-iommu.h"
> 
> -#define to_iommu(dev)							\
> -	((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))
> +#define to_iommu(dev)	platform_get_drvdata(to_platform_device(dev))
> 
>  #define for_each_iotlb_cr(obj, n, __i, cr)				\
>  	for (__i = 0;							\

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-29  8:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-29  3:47 [PATCH] iommu/omap: Remove casting the return value which is a void pointer Jingoo Han
     [not found] ` <004e01cfc33c$03b26230$0b172690$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-08-29  8:45   ` Laurent Pinchart
  -- strict thread matches above, loose matches on Subject: below --
2013-09-09  5:39 Jingoo Han
     [not found] ` <005601cead1e$ffe78470$ffb68d50$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-09-12 22:30   ` Suman Anna
2013-09-12 22:30     ` Suman Anna

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.