Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1614537 > unrolled thread

[PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer

Started bysimran singhal <singhalsimran0@gmail.com>
First post2017-04-01 16:20 +0200
Last post2017-04-02 11:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer simran singhal <singhalsimran0@gmail.com> - 2017-04-01 16:20 +0200
    Re: [PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer Jonathan Cameron <jic23@kernel.org> - 2017-04-02 11:00 +0200

#1614537 — [PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer

Fromsimran singhal <singhalsimran0@gmail.com>
Date2017-04-01 16:20 +0200
Subject[PATCH] iio: dac: ad5504: Remove unnecessary cast on void pointer
Message-ID<trs2J-3Q0-9@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1614670

FromJonathan Cameron <jic23@kernel.org>
Date2017-04-02 11:00 +0200
Message-ID<trJwB-6BS-3@gated-at.bofh.it>
In reply to#1614537
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;
>  }
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web