diff options
Diffstat (limited to 'drivers/iio/magnetometer/mag3110.c')
-rw-r--r-- | drivers/iio/magnetometer/mag3110.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c index 4b65b6d3bdb1..f66955fb3509 100644 --- a/drivers/iio/magnetometer/mag3110.c +++ b/drivers/iio/magnetometer/mag3110.c | |||
@@ -106,7 +106,7 @@ static ssize_t mag3110_show_int_plus_micros(char *buf, | |||
106 | 106 | ||
107 | while (n-- > 0) | 107 | while (n-- > 0) |
108 | len += scnprintf(buf + len, PAGE_SIZE - len, | 108 | len += scnprintf(buf + len, PAGE_SIZE - len, |
109 | "%d.%d ", vals[n][0], vals[n][1]); | 109 | "%d.%06d ", vals[n][0], vals[n][1]); |
110 | 110 | ||
111 | /* replace trailing space by newline */ | 111 | /* replace trailing space by newline */ |
112 | buf[len - 1] = '\n'; | 112 | buf[len - 1] = '\n'; |
@@ -154,6 +154,9 @@ static int mag3110_read_raw(struct iio_dev *indio_dev, | |||
154 | 154 | ||
155 | switch (mask) { | 155 | switch (mask) { |
156 | case IIO_CHAN_INFO_RAW: | 156 | case IIO_CHAN_INFO_RAW: |
157 | if (iio_buffer_enabled(indio_dev)) | ||
158 | return -EBUSY; | ||
159 | |||
157 | switch (chan->type) { | 160 | switch (chan->type) { |
158 | case IIO_MAGN: /* in 0.1 uT / LSB */ | 161 | case IIO_MAGN: /* in 0.1 uT / LSB */ |
159 | ret = mag3110_read(data, buffer); | 162 | ret = mag3110_read(data, buffer); |
@@ -199,6 +202,9 @@ static int mag3110_write_raw(struct iio_dev *indio_dev, | |||
199 | struct mag3110_data *data = iio_priv(indio_dev); | 202 | struct mag3110_data *data = iio_priv(indio_dev); |
200 | int rate; | 203 | int rate; |
201 | 204 | ||
205 | if (iio_buffer_enabled(indio_dev)) | ||
206 | return -EBUSY; | ||
207 | |||
202 | switch (mask) { | 208 | switch (mask) { |
203 | case IIO_CHAN_INFO_SAMP_FREQ: | 209 | case IIO_CHAN_INFO_SAMP_FREQ: |
204 | rate = mag3110_get_samp_freq_index(data, val, val2); | 210 | rate = mag3110_get_samp_freq_index(data, val, val2); |