linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ad7768-1: Fix the right interrupt interface calls
@ 2021-05-11 15:31 Tang Bin
  2021-05-11 16:29 ` Lars-Peter Clausen
  0 siblings, 1 reply; 4+ messages in thread
From: Tang Bin @ 2021-05-11 15:31 UTC (permalink / raw)
  To: Michael.Hennerich, lars, jic23, knaack.h, pmeerw
  Cc: linux-iio, linux-kernel, Tang Bin, Zhang Shengju

In the function ad7768_probe(), the devm_request_irq() should
call ad7768_interrupt, not &ad7768_interrupt, so fix this mistake.

Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support")
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/iio/adc/ad7768-1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
index 0e93b0766..9c9ab56d6 100644
--- a/drivers/iio/adc/ad7768-1.c
+++ b/drivers/iio/adc/ad7768-1.c
@@ -605,7 +605,7 @@ static int ad7768_probe(struct spi_device *spi)
 	init_completion(&st->completion);
 
 	ret = devm_request_irq(&spi->dev, spi->irq,
-			       &ad7768_interrupt,
+			       ad7768_interrupt,
 			       IRQF_TRIGGER_RISING | IRQF_ONESHOT,
 			       indio_dev->name, indio_dev);
 	if (ret)
-- 
2.20.1.windows.1




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

* Re: [PATCH] iio: adc: ad7768-1: Fix the right interrupt interface calls
  2021-05-11 15:31 [PATCH] iio: adc: ad7768-1: Fix the right interrupt interface calls Tang Bin
@ 2021-05-11 16:29 ` Lars-Peter Clausen
  2021-05-12  8:39   ` [PATCH] iio: adc: ad7768-1: Fix the right interrupt interfacecalls tangbin
  0 siblings, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2021-05-11 16:29 UTC (permalink / raw)
  To: Tang Bin, Michael.Hennerich, jic23, knaack.h, pmeerw
  Cc: linux-iio, linux-kernel, Zhang Shengju

On 5/11/21 5:31 PM, Tang Bin wrote:
> In the function ad7768_probe(), the devm_request_irq() should
> call ad7768_interrupt, not &ad7768_interrupt, so fix this mistake.
>
> Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support")
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>

Hi,

Thanks for the patch. Aren't those two expressions equivalent? Are you 
seeing an issue with the current code? If so can you include that in the 
commit message?

- Lars


> ---
>   drivers/iio/adc/ad7768-1.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
> index 0e93b0766..9c9ab56d6 100644
> --- a/drivers/iio/adc/ad7768-1.c
> +++ b/drivers/iio/adc/ad7768-1.c
> @@ -605,7 +605,7 @@ static int ad7768_probe(struct spi_device *spi)
>   	init_completion(&st->completion);
>   
>   	ret = devm_request_irq(&spi->dev, spi->irq,
> -			       &ad7768_interrupt,
> +			       ad7768_interrupt,
>   			       IRQF_TRIGGER_RISING | IRQF_ONESHOT,
>   			       indio_dev->name, indio_dev);
>   	if (ret)



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

* Re: [PATCH] iio: adc: ad7768-1: Fix the right interrupt interfacecalls
  2021-05-11 16:29 ` Lars-Peter Clausen
@ 2021-05-12  8:39   ` tangbin
  2021-05-12  9:21     ` Lars-Peter Clausen
  0 siblings, 1 reply; 4+ messages in thread
From: tangbin @ 2021-05-12  8:39 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Michael.Hennerich, jic23, knaack.h, pmeerw, linux-iio, linux-kernel

Hi Lars-Peter:

         Thanks for you reply!

> Hi,
>
> Thanks for the patch. Aren't those two expressions equivalent? Are you 
> seeing an issue with the current code? If so can you include that in 
> the commit message?
>
> - Lars
>
>
        When submitting this patch, I actually thought about it for a 
while, but finally decided to submit it, my reason is as follows:

         In numerical data of address, &ad7768_interrupt is equal to 
ad7768_interrupt, and the compilation can pass. But I think they are not 
the same, ad7768_interrupt is the first

address of the function, and its type is irqreturn_t, &ad7768_interrupt 
represents the address of an object that points to the function 
ad7768_interrupt().

         So I think they are not the same, For previous experience with 
devm_request_irq(), I send this patch. If I'm wrong, I'm sorry to bother 
you.

Thanks

Tang Bin




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

* Re: [PATCH] iio: adc: ad7768-1: Fix the right interrupt interfacecalls
  2021-05-12  8:39   ` [PATCH] iio: adc: ad7768-1: Fix the right interrupt interfacecalls tangbin
@ 2021-05-12  9:21     ` Lars-Peter Clausen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2021-05-12  9:21 UTC (permalink / raw)
  To: tangbin
  Cc: Michael.Hennerich, jic23, knaack.h, pmeerw, linux-iio, linux-kernel

On 5/12/21 10:39 AM, tangbin wrote:
> Hi Lars-Peter:
>
>         Thanks for you reply!
>
>> Hi,
>>
>> Thanks for the patch. Aren't those two expressions equivalent? Are 
>> you seeing an issue with the current code? If so can you include that 
>> in the commit message?
>>
>> - Lars
>>
>>
>        When submitting this patch, I actually thought about it for a 
> while, but finally decided to submit it, my reason is as follows:
>
>         In numerical data of address, &ad7768_interrupt is equal to 
> ad7768_interrupt, and the compilation can pass. But I think they are 
> not the same, ad7768_interrupt is the first
>
> address of the function, and its type is irqreturn_t, 
> &ad7768_interrupt represents the address of an object that points to 
> the function ad7768_interrupt().
>
>         So I think they are not the same, For previous experience with 
> devm_request_irq(), I send this patch. If I'm wrong, I'm sorry to 
> bother you.
>
Have a look at 
https://stackoverflow.com/questions/6893285/why-do-function-pointer-definitions-work-with-any-number-of-ampersands-or-as 
for some background on this.

You can also easily verify that they are the same with a simple test program

static void foo(void) {}

int main(void) {
     printf("%p %p %d\n", foo, &foo, foo == &foo);
}



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

end of thread, other threads:[~2021-05-12  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 15:31 [PATCH] iio: adc: ad7768-1: Fix the right interrupt interface calls Tang Bin
2021-05-11 16:29 ` Lars-Peter Clausen
2021-05-12  8:39   ` [PATCH] iio: adc: ad7768-1: Fix the right interrupt interfacecalls tangbin
2021-05-12  9:21     ` Lars-Peter Clausen

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).