summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/accel/sca3000_core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-09 12:18:17 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-09 12:18:17 -0800
commit12e55508921865aefdd80fd17afe70c191afbd1b (patch)
tree476b3226fd9602b36bed0934409959bdd24a7eb5 /drivers/staging/iio/accel/sca3000_core.c
parent55b81e6f2795484ea8edf5805c95c007cacfa736 (diff)
parent4d447c9a6ebc0142d320f075c5bac6d202a79fd4 (diff)
Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (466 commits) net/hyperv: Add support for jumbo frame up to 64KB net/hyperv: Add NETVSP protocol version negotiation net/hyperv: Remove unnecessary kmap_atomic in netvsc driver staging/rtl8192e: Register against lib80211 staging/rtl8192e: Convert to lib80211_crypt_info staging/rtl8192e: Convert to lib80211_crypt_data and lib80211_crypt_ops staging/rtl8192e: Add lib80211.h to rtllib.h staging/mei: add watchdog device registration wrappers drm/omap: GEM, deal with cache staging: vt6656: int.c, int.h: Change return of function to void staging: usbip: removed unused definitions from header staging: usbip: removed dead code from receive function staging:iio: Drop {mark,unmark}_in_use callbacks staging:iio: Drop buffer mark_param_change callback staging:iio: Drop the unused buffer enable() and is_enabled() callbacks staging:iio: Drop buffer busy flag staging:iio: Make sure a device is only opened once at a time staging:iio: Disallow modifying buffer size when buffer is enabled staging:iio: Disallow changing scan elements in all buffered modes staging:iio: Use iio_buffer_enabled instead of open coding it ... Fix up conflict in drivers/staging/iio/adc/ad799x_core.c (removal of module_init due to using module_i2c_driver() helper, next to removal of MODULE_ALIAS due to using MODULE_DEVICE_TABLE instead).
Diffstat (limited to 'drivers/staging/iio/accel/sca3000_core.c')
-rw-r--r--drivers/staging/iio/accel/sca3000_core.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c
index 6c359074a06d..49764fb7181c 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -20,7 +20,8 @@
#include <linux/module.h>
#include "../iio.h"
#include "../sysfs.h"
-#include "../buffer_generic.h"
+#include "../events.h"
+#include "../buffer.h"
#include "sca3000.h"
@@ -381,13 +382,17 @@ sca3000_store_measurement_mode(struct device *dev,
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct sca3000_state *st = iio_priv(indio_dev);
int ret;
- int mask = 0x03;
- long val;
+ u8 mask = 0x03;
+ u8 val;
mutex_lock(&st->lock);
- ret = strict_strtol(buf, 10, &val);
+ ret = kstrtou8(buf, 10, &val);
if (ret)
goto error_ret;
+ if (val > 3) {
+ ret = -EINVAL;
+ goto error_ret;
+ }
ret = sca3000_read_data_short(st, SCA3000_REG_ADDR_MODE, 1);
if (ret)
goto error_ret;
@@ -424,7 +429,7 @@ static IIO_DEVICE_ATTR(measurement_mode, S_IRUGO | S_IWUSR,
static IIO_DEVICE_ATTR(revision, S_IRUGO, sca3000_show_rev, NULL, 0);
#define SCA3000_INFO_MASK \
- (1 << IIO_CHAN_INFO_SCALE_SHARED)
+ IIO_CHAN_INFO_SCALE_SHARED_BIT
#define SCA3000_EVENT_MASK \
(IIO_EV_BIT(IIO_EV_TYPE_MAG, IIO_EV_DIR_RISING))
@@ -474,7 +479,7 @@ static int sca3000_read_raw(struct iio_dev *indio_dev,
(sizeof(*val)*8 - 13);
mutex_unlock(&st->lock);
return IIO_VAL_INT;
- case (1 << IIO_CHAN_INFO_SCALE_SHARED):
+ case IIO_CHAN_INFO_SCALE:
*val = 0;
if (chan->type == IIO_ACCEL)
*val2 = st->info->scale;
@@ -1161,9 +1166,9 @@ static int __devinit sca3000_probe(struct spi_device *spi)
if (ret < 0)
goto error_unregister_dev;
if (indio_dev->buffer) {
- iio_scan_mask_set(indio_dev->buffer, 0);
- iio_scan_mask_set(indio_dev->buffer, 1);
- iio_scan_mask_set(indio_dev->buffer, 2);
+ iio_scan_mask_set(indio_dev, indio_dev->buffer, 0);
+ iio_scan_mask_set(indio_dev, indio_dev->buffer, 1);
+ iio_scan_mask_set(indio_dev, indio_dev->buffer, 2);
}
if (spi->irq) {
@@ -1240,6 +1245,7 @@ static const struct spi_device_id sca3000_id[] = {
{"sca3000_e05", e05},
{}
};
+MODULE_DEVICE_TABLE(spi, sca3000_id);
static struct spi_driver sca3000_driver = {
.driver = {