public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Octavian Purdila <octavian.purdila@intel.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH v3 6/9] iio: bmc150: exit early if event / trigger state is not changed
Date: Sun, 08 Feb 2015 10:40:20 +0000	[thread overview]
Message-ID: <54D73D14.1080805@kernel.org> (raw)
In-Reply-To: <1423156173.2136.166.camel@spandruv-DESK3.jf.intel.com>

On 05/02/15 17:09, Srinivas Pandruvada wrote:
> On Sat, 2015-01-31 at 02:00 +0200, Octavian Purdila wrote: 
>> Previous of this patch the check was only done if we enabled the event
>> and it was already enabled. We can do the same if the event is
>> disabled and we want to disable it.
>>
>> The patch also adds the same check on the trigger code.
>>
>> Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> 
Another good standalone improvement.

Applied to the togreg branch of iio.git

Thanks,

Jonathan
>> ---
>>  drivers/iio/accel/bmc150-accel.c | 14 +++++++++++++-
>>  1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c
>> index 0873925..f040f40 100644
>> --- a/drivers/iio/accel/bmc150-accel.c
>> +++ b/drivers/iio/accel/bmc150-accel.c
>> @@ -748,7 +748,7 @@ static int bmc150_accel_write_event_config(struct iio_dev *indio_dev,
>>  	struct bmc150_accel_data *data = iio_priv(indio_dev);
>>  	int ret;
>>  
>> -	if (state && data->ev_enable_state)
>> +	if (state == data->ev_enable_state)
>>  		return 0;
>>  
>>  	mutex_lock(&data->mutex);
>> @@ -984,6 +984,18 @@ static int bmc150_accel_data_rdy_trigger_set_state(struct iio_trigger *trig,
>>  
>>  	mutex_lock(&data->mutex);
>>  
>> +	if (data->motion_trig == trig) {
>> +		if (data->motion_trigger_on == state) {
>> +			mutex_unlock(&data->mutex);
>> +			return 0;
>> +		}
>> +	} else {
>> +		if (data->dready_trigger_on == state) {
>> +			mutex_unlock(&data->mutex);
>> +			return 0;
>> +		}
>> +	}
>> +
>>  	if (!state && data->ev_enable_state && data->motion_trigger_on) {
>>  		data->motion_trigger_on = false;
>>  		mutex_unlock(&data->mutex);
> 
> 
> --
> 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
> 


  reply	other threads:[~2015-02-08 10:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 23:59 [PATCH v3 0/9] iio: add support for hardware fifo Octavian Purdila
2015-01-31  0:00 ` [PATCH v3 1/9] iio: buffer: refactor buffer attributes setup Octavian Purdila
2015-02-04 18:47   ` Jonathan Cameron
2015-01-31  0:00 ` [PATCH v3 2/9] iio: add watermark logic to iio read and poll Octavian Purdila
2015-02-04 18:49   ` Jonathan Cameron
2015-02-04 19:29     ` Octavian Purdila
2015-01-31  0:00 ` [PATCH v3 3/9] iio: add support for hardware fifo Octavian Purdila
2015-02-08 10:33   ` Jonathan Cameron
2015-01-31  0:00 ` [PATCH v3 4/9] iio: bmc150: refactor slope duration and threshold update Octavian Purdila
2015-02-05 17:02   ` Srinivas Pandruvada
2015-02-08 10:37     ` Jonathan Cameron
2015-02-09  9:54       ` Octavian Purdila
2015-01-31  0:00 ` [PATCH v3 5/9] iio: bmc150: refactor interrupt enabling Octavian Purdila
2015-02-05 17:06   ` Srinivas Pandruvada
2015-02-08 10:39     ` Jonathan Cameron
2015-01-31  0:00 ` [PATCH v3 6/9] iio: bmc150: exit early if event / trigger state is not changed Octavian Purdila
2015-02-05 17:09   ` Srinivas Pandruvada
2015-02-08 10:40     ` Jonathan Cameron [this message]
2015-01-31  0:00 ` [PATCH v3 7/9] iio: bmc150: introduce bmc150_accel_interrupt Octavian Purdila
2015-02-08 11:01   ` Jonathan Cameron
2015-01-31  0:00 ` [PATCH v3 8/9] iio: bmc150: introduce bmc150_accel_trigger Octavian Purdila
2015-02-08 11:07   ` Jonathan Cameron
2015-02-14  0:03     ` Srinivas Pandruvada
2015-01-31  0:00 ` [PATCH v3 9/9] iio: bmc150: add support for hardware fifo Octavian Purdila
2015-02-08 11:26   ` 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=54D73D14.1080805@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=octavian.purdila@intel.com \
    --cc=srinivas.pandruvada@linux.intel.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