linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Ranostay <mranostay@gmail.com>
To: linux-iio@vger.kernel.org
Cc: jic23@kernel.org, Matt Ranostay <mranostay@gmail.com>
Subject: [PATCH 1/3] iio: chemical: atlas-ph-sensor: switch to iio_device_*_direct_mode helpers
Date: Tue,  9 Aug 2016 20:05:57 -0700	[thread overview]
Message-ID: <1470798359-4919-2-git-send-email-mranostay@gmail.com> (raw)
In-Reply-To: <1470798359-4919-1-git-send-email-mranostay@gmail.com>

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
---
 drivers/iio/chemical/atlas-ph-sensor.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c
index ae038a59d256..8e39b37a5385 100644
--- a/drivers/iio/chemical/atlas-ph-sensor.c
+++ b/drivers/iio/chemical/atlas-ph-sensor.c
@@ -402,7 +402,9 @@ static int atlas_read_raw(struct iio_dev *indio_dev,
 		case IIO_PH:
 		case IIO_CONCENTRATION:
 		case IIO_ELECTRICALCONDUCTIVITY:
-			mutex_lock(&indio_dev->mlock);
+			ret = iio_device_claim_direct_mode(indio_dev);
+			if (ret)
+				return ret;
 
 			if (iio_buffer_enabled(indio_dev))
 				ret = -EBUSY;
@@ -410,7 +412,7 @@ static int atlas_read_raw(struct iio_dev *indio_dev,
 				ret = atlas_read_measurement(data,
 							chan->address, &reg);
 
-			mutex_unlock(&indio_dev->mlock);
+			iio_device_release_direct_mode(indio_dev);
 			break;
 		default:
 			ret = -EINVAL;
-- 
2.7.4


  reply	other threads:[~2016-08-10  3:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10  3:05 [PATCH 0/3] iio: chemical: atlas-ph-sensor: add support for ORP part Matt Ranostay
2016-08-10  3:05 ` Matt Ranostay [this message]
2016-08-15 15:14   ` [PATCH 1/3] iio: chemical: atlas-ph-sensor: switch to iio_device_*_direct_mode helpers Jonathan Cameron
2016-08-16  3:11     ` Matt Ranostay
2016-08-10  3:05 ` [PATCH 2/3] iio: chemical: atlas-ph-sensor: switch to REGCACHE_NONE regmap tree Matt Ranostay
2016-08-10  3:05 ` [PATCH 3/3] iio: chemical: atlas-ph-sensor: add ORP feature Matt Ranostay
2016-08-15 15:19   ` 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=1470798359-4919-2-git-send-email-mranostay@gmail.com \
    --to=mranostay@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    /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).