From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Ramona Bolboaca <ramona.bolboaca@analog.com>
Cc: <jic23@kernel.org>, <nuno.sa@analog.com>,
<linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 1/9] iio: adis: add '__adis_enable_irq()' implementation
Date: Mon, 21 Nov 2022 17:08:35 +0000 [thread overview]
Message-ID: <20221121170835.000038d9@Huawei.com> (raw)
In-Reply-To: <20221121152717.403667-2-ramona.bolboaca@analog.com>
On Mon, 21 Nov 2022 17:27:09 +0200
Ramona Bolboaca <ramona.bolboaca@analog.com> wrote:
> Add '__adis_enable_irq()' implementation which is the unlocked
> version of 'adis_enable_irq()'.
> Call '__adis_enable_irq()' instead of 'adis_enable_irq()' from
> '__adis_intial_startup()' to keep the expected unlocked functionality.
>
> Fixes: b600bd7eb3335 ("iio: adis: do not disabe IRQs in 'adis_init()'")
> Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com>
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Can you add some explanation in here for 'why' this is a fix.
People need that info to decide whether they want to pick it up for
distros etc.
Jonathan
> ---
> drivers/iio/imu/adis.c | 28 ++++++++++------------------
> include/linux/iio/imu/adis.h | 13 ++++++++++++-
> 2 files changed, 22 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index f7fcfd04f659..bc40240b29e2 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -270,23 +270,19 @@ EXPORT_SYMBOL_NS(adis_debugfs_reg_access, IIO_ADISLIB);
> #endif
>
> /**
> - * adis_enable_irq() - Enable or disable data ready IRQ
> + * __adis_enable_irq() - Enable or disable data ready IRQ (unlocked)
> * @adis: The adis device
> * @enable: Whether to enable the IRQ
> *
> * Returns 0 on success, negative error code otherwise
> */
> -int adis_enable_irq(struct adis *adis, bool enable)
> +int __adis_enable_irq(struct adis *adis, bool enable)
> {
> - int ret = 0;
> + int ret;
> u16 msc;
>
> - mutex_lock(&adis->state_lock);
> -
> - if (adis->data->enable_irq) {
> - ret = adis->data->enable_irq(adis, enable);
> - goto out_unlock;
> - }
> + if (adis->data->enable_irq)
> + return adis->data->enable_irq(adis, enable);
>
> if (adis->data->unmasked_drdy) {
> if (enable)
> @@ -294,12 +290,12 @@ int adis_enable_irq(struct adis *adis, bool enable)
> else
> disable_irq(adis->spi->irq);
>
> - goto out_unlock;
> + return 0;
> }
>
> ret = __adis_read_reg_16(adis, adis->data->msc_ctrl_reg, &msc);
> if (ret)
> - goto out_unlock;
> + return ret;
>
> msc |= ADIS_MSC_CTRL_DATA_RDY_POL_HIGH;
> msc &= ~ADIS_MSC_CTRL_DATA_RDY_DIO2;
> @@ -308,13 +304,9 @@ int adis_enable_irq(struct adis *adis, bool enable)
> else
> msc &= ~ADIS_MSC_CTRL_DATA_RDY_EN;
>
> - ret = __adis_write_reg_16(adis, adis->data->msc_ctrl_reg, msc);
> -
> -out_unlock:
> - mutex_unlock(&adis->state_lock);
> - return ret;
> + return __adis_write_reg_16(adis, adis->data->msc_ctrl_reg, msc);
> }
> -EXPORT_SYMBOL_NS(adis_enable_irq, IIO_ADISLIB);
> +EXPORT_SYMBOL_NS(__adis_enable_irq, IIO_ADISLIB);
>
> /**
> * __adis_check_status() - Check the device for error conditions (unlocked)
> @@ -445,7 +437,7 @@ int __adis_initial_startup(struct adis *adis)
> * with 'IRQF_NO_AUTOEN' anyways.
> */
> if (!adis->data->unmasked_drdy)
> - adis_enable_irq(adis, false);
> + __adis_enable_irq(adis, false);
>
> if (!adis->data->prod_id_reg)
> return 0;
> diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
> index 515ca09764fe..d789ecf8d0c8 100644
> --- a/include/linux/iio/imu/adis.h
> +++ b/include/linux/iio/imu/adis.h
> @@ -402,9 +402,20 @@ static inline int adis_update_bits_base(struct adis *adis, unsigned int reg,
> __adis_update_bits_base(adis, reg, mask, val, sizeof(val)); \
> })
>
> -int adis_enable_irq(struct adis *adis, bool enable);
> +static inline int adis_enable_irq(struct adis *adis, bool enable)
> +{
> + int ret;
> +
> + mutex_lock(&adis->state_lock);
> + ret = __adis_enable_irq(adis, enable);
> + mutex_unlock(&adis->state_lock);
> +
> + return ret;
> +}
> +
> int __adis_check_status(struct adis *adis);
> int __adis_initial_startup(struct adis *adis);
> +int __adis_enable_irq(struct adis *adis, bool enable);
>
> static inline int adis_check_status(struct adis *adis)
> {
next prev parent reply other threads:[~2022-11-21 17:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 15:27 [PATCH v5 0/9] Add '__adis_enable_irq()' Ramona Bolboaca
2022-11-21 15:27 ` [PATCH v5 1/9] iio: adis: add '__adis_enable_irq()' implementation Ramona Bolboaca
2022-11-21 17:08 ` Jonathan Cameron [this message]
2022-11-21 15:27 ` [PATCH v5 2/9] iio: accel: adis16201: Call '__adis_initial_startup()' in probe Ramona Bolboaca
2022-11-21 15:27 ` [PATCH v5 3/9] iio: accel: adis16209: " Ramona Bolboaca
2022-11-21 15:27 ` [PATCH v5 4/9] iio: gyro: adis16136: " Ramona Bolboaca
2022-11-21 15:27 ` [PATCH v5 5/9] iio: gyro: adis16260: " Ramona Bolboaca
2022-11-21 15:27 ` [PATCH v5 6/9] iio: imu: adis16400: " Ramona Bolboaca
2022-11-21 15:27 ` [PATCH v5 7/9] staging: iio: accel: adis16203: Call '__adis_initial_startup()' Ramona Bolboaca
2022-11-21 15:27 ` [PATCH v5 8/9] staging: iio: accel: adis16240: " Ramona Bolboaca
2022-11-21 15:27 ` [PATCH v5 9/9] iio: imu: adis: Remove adis_initial_startup function Ramona Bolboaca
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221121170835.000038d9@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=ramona.bolboaca@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).