linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer
@ 2017-04-01 14:11 simran singhal
  2017-04-02  8:50 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: simran singhal @ 2017-04-01 14:11 UTC (permalink / raw)
  To: lars
  Cc: Michael Hennerich, Jonathan Cameron, Hartmut Knaack,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/iio/dac/ad5504.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 22a027d..712d86b 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -223,7 +223,7 @@ static irqreturn_t ad5504_event_handler(int irq, void *private)
 					    0,
 					    IIO_EV_TYPE_THRESH,
 					    IIO_EV_DIR_RISING),
-		       iio_get_time_ns((struct iio_dev *)private));
+		       iio_get_time_ns(private));
 
 	return IRQ_HANDLED;
 }
-- 
2.7.4

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

* Re: [PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer
  2017-04-01 14:11 [PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer simran singhal
@ 2017-04-02  8:50 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2017-04-02  8:50 UTC (permalink / raw)
  To: simran singhal, lars
  Cc: Michael Hennerich, Hartmut Knaack, Peter Meerwald-Stadler,
	linux-iio, linux-kernel

On 01/04/17 15:11, simran singhal wrote:
> The following Coccinelle script was used to detect this:
> @r@
> expression x;
> void* e;
> type T;
> identifier f;
> @@
> (
>   *((T *)e)
> |
>   ((T *)x)[...]
> |
>   ((T*)x)->f
> |
> - (T*)
>   e
> )
> 
> Signed-off-by: simran singhal <singhalsimran0@gmail.com>
It could be argued for this one that it is acting as documentation
as it might not be obvious without looking up the definition of
the iio_get_time_ns function that it takes a struct iio_dev.

However, on balance I think that this case is simple enough that
it should be fine as you have it.

Applied.
> ---
>  drivers/iio/dac/ad5504.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
> index 22a027d..712d86b 100644
> --- a/drivers/iio/dac/ad5504.c
> +++ b/drivers/iio/dac/ad5504.c
> @@ -223,7 +223,7 @@ static irqreturn_t ad5504_event_handler(int irq, void *private)
>  					    0,
>  					    IIO_EV_TYPE_THRESH,
>  					    IIO_EV_DIR_RISING),
> -		       iio_get_time_ns((struct iio_dev *)private));
> +		       iio_get_time_ns(private));
>  
>  	return IRQ_HANDLED;
>  }
> 

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

end of thread, other threads:[~2017-04-02  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-01 14:11 [PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer simran singhal
2017-04-02  8:50 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).