Re: [PATCH v2 4/8] iio: stm32-dfsdm-adc: pass iio device as arg for the interrupt handler

Jonathan Cameron
2020-05-16T17:20:51Z

On Thu, 14 May 2020 16:17:06 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> This changes the argument for the interrupt handler to be the IIO device
> instead of the state-struct.
> Since there will be some changes to how iio_priv_to_dev() is implemented,
> it could be that the helper becomes a bit slower, as it will be hidden away
> in the IIO core.
>
> The iio_priv() call will still be fast enough, as it will return a void
> pointer from the public IIO device structure. So it's better to switch the
> order.
>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Whilst this one looks fine to me. I'd definitely like an Ack from
one of the stm people in case I'm missing something.

> ---
> drivers/iio/adc/stm32-dfsdm-adc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
> index 76a60d93fe23..28ef02887bd3 100644
> --- a/drivers/iio/adc/stm32-dfsdm-adc.c
> +++ b/drivers/iio/adc/stm32-dfsdm-adc.c
> @@ -1313,8 +1313,8 @@ static const struct iio_info stm32_dfsdm_info_adc = {
>
> static irqreturn_t stm32_dfsdm_irq(int irq, void *arg)
> {
> - struct stm32_dfsdm_adc *adc = arg;
> - struct iio_dev *indio_dev = iio_priv_to_dev(adc);
> + struct iio_dev *indio_dev = arg;
> + struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
> struct regmap *regmap = adc->dfsdm->regmap;
> unsigned int status, int_en;
>
> @@ -1603,7 +1603,7 @@ static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
> return irq;
>
> ret = devm_request_irq(dev, irq, stm32_dfsdm_irq,
> - 0, pdev->name, adc);
> + 0, pdev->name, iio);
> if (ret < 0) {
> dev_err(dev, "Failed to request IRQ\n");
> return ret;