Skip to content

Commit dc6ac05

Browse files
Linus Walleijjic23
authored andcommitted
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>
1 parent a483ab7 commit dc6ac05

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

drivers/iio/accel/kxsd9.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,10 @@
4141

4242
/**
4343
* struct kxsd9_state - device related storage
44-
* @transport: transport for the KXSD9
45-
* @buf_lock: protect the rx and tx buffers.
46-
* @us: spi device
47-
**/
44+
* @map: regmap to the device
45+
*/
4846
struct kxsd9_state {
4947
struct regmap *map;
50-
struct mutex buf_lock;
5148
};
5249

5350
#define KXSD9_SCALE_2G "0.011978"
@@ -73,7 +70,6 @@ static int kxsd9_write_scale(struct iio_dev *indio_dev, int micro)
7370
if (!foundit)
7471
return -EINVAL;
7572

76-
mutex_lock(&st->buf_lock);
7773
ret = regmap_read(st->map,
7874
KXSD9_REG_CTRL_C,
7975
&val);
@@ -83,7 +79,6 @@ static int kxsd9_write_scale(struct iio_dev *indio_dev, int micro)
8379
KXSD9_REG_CTRL_C,
8480
(val & ~KXSD9_FS_MASK) | i);
8581
error_ret:
86-
mutex_unlock(&st->buf_lock);
8782
return ret;
8883
}
8984

@@ -93,15 +88,11 @@ static int kxsd9_read(struct iio_dev *indio_dev, u8 address)
9388
struct kxsd9_state *st = iio_priv(indio_dev);
9489
__be16 raw_val;
9590

96-
mutex_lock(&st->buf_lock);
9791
ret = regmap_bulk_read(st->map, address, &raw_val, sizeof(raw_val));
9892
if (ret)
99-
goto out_fail_read;
93+
return ret;
10094
/* Only 12 bits are valid */
101-
ret = be16_to_cpu(raw_val) & 0xfff0;
102-
out_fail_read:
103-
mutex_unlock(&st->buf_lock);
104-
return ret;
95+
return be16_to_cpu(raw_val) & 0xfff0;
10596
}
10697

10798
static IIO_CONST_ATTR(accel_scale_available,
@@ -220,7 +211,6 @@ int kxsd9_common_probe(struct device *parent,
220211
st = iio_priv(indio_dev);
221212
st->map = map;
222213

223-
mutex_init(&st->buf_lock);
224214
indio_dev->channels = kxsd9_channels;
225215
indio_dev->num_channels = ARRAY_SIZE(kxsd9_channels);
226216
indio_dev->name = name;

0 commit comments

Comments
 (0)