aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-09-01 05:44:42 -0400
committerJonathan Cameron <jic23@kernel.org>2016-09-18 06:29:48 -0400
commitdc6ac050c7d405cf99f847d5f7b485a7dfa00840 (patch)
tree0235f9efb6d0bc6cf40b9148a35a77056734fe82
parenta483ab796960c9080dc9f97f5905d11debad3df9 (diff)
iio: accel: kxsd9: Drop the buffer lock
The RX/TX buffers are gone so drop the lock (it should have been in the transport struct anyway). Tested-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/accel/kxsd9.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
index c065c6e09fa4..dc0bea7cbf4f 100644
--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -41,13 +41,10 @@
41 41
42/** 42/**
43 * struct kxsd9_state - device related storage 43 * struct kxsd9_state - device related storage
44 * @transport: transport for the KXSD9 44 * @map: regmap to the device
45 * @buf_lock: protect the rx and tx buffers. 45 */
46 * @us: spi device
47 **/
48struct kxsd9_state { 46struct kxsd9_state {
49 struct regmap *map; 47 struct regmap *map;
50 struct mutex buf_lock;
51}; 48};
52 49
53#define KXSD9_SCALE_2G "0.011978" 50#define KXSD9_SCALE_2G "0.011978"
@@ -73,7 +70,6 @@ static int kxsd9_write_scale(struct iio_dev *indio_dev, int micro)
73 if (!foundit) 70 if (!foundit)
74 return -EINVAL; 71 return -EINVAL;
75 72
76 mutex_lock(&st->buf_lock);
77 ret = regmap_read(st->map, 73 ret = regmap_read(st->map,
78 KXSD9_REG_CTRL_C, 74 KXSD9_REG_CTRL_C,
79 &val); 75 &val);
@@ -83,7 +79,6 @@ static int kxsd9_write_scale(struct iio_dev *indio_dev, int micro)
83 KXSD9_REG_CTRL_C, 79 KXSD9_REG_CTRL_C,
84 (val & ~KXSD9_FS_MASK) | i); 80 (val & ~KXSD9_FS_MASK) | i);
85error_ret: 81error_ret:
86 mutex_unlock(&st->buf_lock);
87 return ret; 82 return ret;
88} 83}
89 84
@@ -93,15 +88,11 @@ static int kxsd9_read(struct iio_dev *indio_dev, u8 address)
93 struct kxsd9_state *st = iio_priv(indio_dev); 88 struct kxsd9_state *st = iio_priv(indio_dev);
94 __be16 raw_val; 89 __be16 raw_val;
95 90
96 mutex_lock(&st->buf_lock);
97 ret = regmap_bulk_read(st->map, address, &raw_val, sizeof(raw_val)); 91 ret = regmap_bulk_read(st->map, address, &raw_val, sizeof(raw_val));
98 if (ret) 92 if (ret)
99 goto out_fail_read; 93 return ret;
100 /* Only 12 bits are valid */ 94 /* Only 12 bits are valid */
101 ret = be16_to_cpu(raw_val) & 0xfff0; 95 return be16_to_cpu(raw_val) & 0xfff0;
102out_fail_read:
103 mutex_unlock(&st->buf_lock);
104 return ret;
105} 96}
106 97
107static IIO_CONST_ATTR(accel_scale_available, 98static IIO_CONST_ATTR(accel_scale_available,
@@ -220,7 +211,6 @@ int kxsd9_common_probe(struct device *parent,
220 st = iio_priv(indio_dev); 211 st = iio_priv(indio_dev);
221 st->map = map; 212 st->map = map;
222 213
223 mutex_init(&st->buf_lock);
224 indio_dev->channels = kxsd9_channels; 214 indio_dev->channels = kxsd9_channels;
225 indio_dev->num_channels = ARRAY_SIZE(kxsd9_channels); 215 indio_dev->num_channels = ARRAY_SIZE(kxsd9_channels);
226 indio_dev->name = name; 216 indio_dev->name = name;