]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iio: chemical: atlas-ph-sensor: switch to iio_device_*_direct_mode helpers
authorMatt Ranostay <mranostay@gmail.com>
Fri, 19 Aug 2016 20:36:09 +0000 (13:36 -0700)
committerJonathan Cameron <jic23@kernel.org>
Sun, 21 Aug 2016 10:55:30 +0000 (11:55 +0100)
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/chemical/atlas-ph-sensor.c

index ae038a59d256c1c9f6ff89acb65819090e66a829..696875413d10edeb376897b922964db002a78cee 100644 (file)
@@ -402,15 +402,13 @@ 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;
-                       else
-                               ret = atlas_read_measurement(data,
-                                                       chan->address, &reg);
+                       ret = atlas_read_measurement(data, chan->address, &reg);
 
-                       mutex_unlock(&indio_dev->mlock);
+                       iio_device_release_direct_mode(indio_dev);
                        break;
                default:
                        ret = -EINVAL;