]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/iio/magnetometer/mag3110.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
[karo-tx-linux.git] / drivers / iio / magnetometer / mag3110.c
index becf54496967aee126fb6449b54341394645d9bd..f66955fb3509e261f3a0d0cf7028f6178b3cb1a2 100644 (file)
@@ -106,7 +106,7 @@ static ssize_t mag3110_show_int_plus_micros(char *buf,
 
        while (n-- > 0)
                len += scnprintf(buf + len, PAGE_SIZE - len,
-                       "%d.%d ", vals[n][0], vals[n][1]);
+                       "%d.%06d ", vals[n][0], vals[n][1]);
 
        /* replace trailing space by newline */
        buf[len - 1] = '\n';
@@ -154,6 +154,9 @@ static int mag3110_read_raw(struct iio_dev *indio_dev,
 
        switch (mask) {
        case IIO_CHAN_INFO_RAW:
+               if (iio_buffer_enabled(indio_dev))
+                       return -EBUSY;
+
                switch (chan->type) {
                case IIO_MAGN: /* in 0.1 uT / LSB */
                        ret = mag3110_read(data, buffer);
@@ -199,6 +202,9 @@ static int mag3110_write_raw(struct iio_dev *indio_dev,
        struct mag3110_data *data = iio_priv(indio_dev);
        int rate;
 
+       if (iio_buffer_enabled(indio_dev))
+               return -EBUSY;
+
        switch (mask) {
        case IIO_CHAN_INFO_SAMP_FREQ:
                rate = mag3110_get_samp_freq_index(data, val, val2);
@@ -266,7 +272,11 @@ static const struct iio_chan_spec mag3110_channels[] = {
                .type = IIO_TEMP,
                .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
                .scan_index = 3,
-               .scan_type = IIO_ST('s', 8, 8, 0),
+               .scan_type = {
+                       .sign = 's',
+                       .realbits = 8,
+                       .storagebits = 8,
+                       },
        },
        IIO_CHAN_SOFT_TIMESTAMP(4),
 };