From: Jonathan Cameron <jic23@kernel.org>
To: Hartmut Knaack <knaack.h@gmx.de>, linux-iio@vger.kernel.org
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>,
Antoine Tenart <antoine.tenart@free-electrons.com>
Subject: Re: [PATCH v2 7/8] iio:adc:berlin2-adc: enable interrupts with mutex locked
Date: Wed, 12 Aug 2015 22:13:39 +0100 [thread overview]
Message-ID: <55CBB703.9050506@kernel.org> (raw)
In-Reply-To: <55BC0ABF.5080204@gmx.de>
On 01/08/15 00:54, Hartmut Knaack wrote:
> Antoine, any opinion about this one?
>
>
> Hartmut Knaack schrieb am 28.07.2015 um 00:39:
>> Move the call to enable channel interrupts into its _read() function to
>> have it protected by a mutex. This ensures that only one channel is
>> sampled at a time.
>>
>> Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Looks fine to me and Antoine has had a while to confirm.
Applied to the togreg branch of iio.git
Thanks,
Jonathan
>> ---
>> drivers/iio/adc/berlin2-adc.c | 17 ++++++++---------
>> 1 file changed, 8 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/iio/adc/berlin2-adc.c b/drivers/iio/adc/berlin2-adc.c
>> index 6e20c856f479..13cfeb494e34 100644
>> --- a/drivers/iio/adc/berlin2-adc.c
>> +++ b/drivers/iio/adc/berlin2-adc.c
>> @@ -111,6 +111,10 @@ static int berlin2_adc_read(struct iio_dev *indio_dev, int channel)
>>
>> mutex_lock(&priv->lock);
>>
>> + /* Enable the interrupts */
>> + regmap_write(priv->regmap, BERLIN2_SM_ADC_STATUS,
>> + BERLIN2_SM_ADC_STATUS_INT_EN(channel));
>> +
>> /* Configure the ADC */
>> regmap_update_bits(priv->regmap, BERLIN2_SM_CTRL,
>> BERLIN2_SM_CTRL_ADC_RESET | BERLIN2_SM_CTRL_ADC_SEL_MASK
>> @@ -149,6 +153,10 @@ static int berlin2_adc_tsen_read(struct iio_dev *indio_dev)
>>
>> mutex_lock(&priv->lock);
>>
>> + /* Enable interrupts */
>> + regmap_write(priv->regmap, BERLIN2_SM_TSEN_STATUS,
>> + BERLIN2_SM_TSEN_STATUS_INT_EN);
>> +
>> /* Configure the ADC */
>> regmap_update_bits(priv->regmap, BERLIN2_SM_CTRL,
>> BERLIN2_SM_CTRL_TSEN_RESET | BERLIN2_SM_CTRL_ADC_ROTATE,
>> @@ -190,7 +198,6 @@ static int berlin2_adc_read_raw(struct iio_dev *indio_dev,
>> struct iio_chan_spec const *chan, int *val, int *val2,
>> long mask)
>> {
>> - struct berlin2_adc_priv *priv = iio_priv(indio_dev);
>> int temp;
>>
>> switch (mask) {
>> @@ -198,10 +205,6 @@ static int berlin2_adc_read_raw(struct iio_dev *indio_dev,
>> if (chan->type != IIO_VOLTAGE)
>> return -EINVAL;
>>
>> - /* Enable the interrupts */
>> - regmap_write(priv->regmap, BERLIN2_SM_ADC_STATUS,
>> - BERLIN2_SM_ADC_STATUS_INT_EN(chan->channel));
>> -
>> *val = berlin2_adc_read(indio_dev, chan->channel);
>> if (*val < 0)
>> return *val;
>> @@ -211,10 +214,6 @@ static int berlin2_adc_read_raw(struct iio_dev *indio_dev,
>> if (chan->type != IIO_TEMP)
>> return -EINVAL;
>>
>> - /* Enable interrupts */
>> - regmap_write(priv->regmap, BERLIN2_SM_TSEN_STATUS,
>> - BERLIN2_SM_TSEN_STATUS_INT_EN);
>> -
>> temp = berlin2_adc_tsen_read(indio_dev);
>> if (temp < 0)
>> return temp;
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-08-12 21:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-27 22:38 [PATCH v2 0/8] berlin2-adc fixes and cleanup Hartmut Knaack
2015-07-27 22:38 ` [PATCH v2 1/8] iio:adc:berlin2-adc: Fix register definition Hartmut Knaack
2015-07-30 12:47 ` Antoine Tenart
2015-08-02 17:59 ` Jonathan Cameron
2015-07-27 22:38 ` [PATCH v2 2/8] iio:adc:berlin2-adc: pass up real error code Hartmut Knaack
2015-08-02 18:06 ` Jonathan Cameron
2015-07-27 22:38 ` [PATCH v2 3/8] iio:adc:berlin2-adc: use GENMASK and BIT for masks Hartmut Knaack
2015-07-30 12:47 ` Antoine Tenart
2015-08-02 18:07 ` Jonathan Cameron
2015-08-12 21:11 ` Jonathan Cameron
2015-07-27 22:39 ` [PATCH v2 4/8] iio:adc:berlin2-adc: constify iio_chan_spec Hartmut Knaack
2015-08-02 18:07 ` Jonathan Cameron
2015-07-27 22:39 ` [PATCH v2 5/8] iio:adc:berlin2-adc: use short operator format Hartmut Knaack
2015-08-02 18:08 ` Jonathan Cameron
2015-07-27 22:39 ` [PATCH v2 6/8] iio:adc:berlin2-adc: use channel-array size directly Hartmut Knaack
2015-08-02 18:09 ` Jonathan Cameron
2015-07-27 22:39 ` [PATCH v2 7/8] iio:adc:berlin2-adc: enable interrupts with mutex locked Hartmut Knaack
2015-07-31 23:54 ` Hartmut Knaack
2015-08-12 21:13 ` Jonathan Cameron [this message]
2015-08-17 12:57 ` Antoine Tenart
2015-07-27 22:39 ` [PATCH v2 8/8] iio:adc:berlin2-adc: coding style cleanup Hartmut Knaack
2015-08-12 21:14 ` Jonathan Cameron
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=55CBB703.9050506@kernel.org \
--to=jic23@kernel.org \
--cc=antoine.tenart@free-electrons.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.