aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/iio/adc/max1363.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-02-05 11:25:37 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-02-05 11:25:37 -0800
commit4e98fcfb95dfd9c40976dcfa2f3b878eeec4dbaa (patch)
tree8afe7ff2f2a3bf960dfd637bfa1ae56838f9f0bb /drivers/iio/adc/max1363.c
parentstaging: comedi: check s->async for poll(), read() and write() (diff)
parentiio: Simplify iio_map_array_unregister API (diff)
downloadwireguard-linux-4e98fcfb95dfd9c40976dcfa2f3b878eeec4dbaa.tar.xz
wireguard-linux-4e98fcfb95dfd9c40976dcfa2f3b878eeec4dbaa.zip
Merge tag 'iio-for-3.9c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: "Third set of IIO new drivers, cleanups and fixes for the 3.9 cycle New drivers 1) A driver for ST microelectronics sensors. This driver already covers a large set of new parts (20 gyros, accelerometer and magnetometers) not currently covered by the existing drivers. The intent moving forward is to merge this with the other drivers for similar parts already in tree. The lis3l02dq driver currently in staging/iio will be trivial, the lis3 driver in misc more complex as it has a number of additional interfaces. Any merging in of the lis3 driver will rely on the not currently merged iio_input bridge driver and handling of freefall notifications etc. 2) A driver for the itg3200 gyroscope. Graduations from staging 1) Cleanup and move out of staging of the adxrs450 gyroscope driver. The cleanup required was all minor but there were a couple of fixes hidden in there. Core and driver additions 1) Initial work from Guenter Roeck on device tree support for IIO's provider/ consumer code. Focuses on the iio_hwmon driver and the max1363 adc driver. The full device tree syntax is currently under discussion but should follow shortly. Cleanups and fixes 1) Remove a noop function __iio_update_buffer 2) Couple of small fixes and cleanups for the max1363 "
Diffstat (limited to 'drivers/iio/adc/max1363.c')
-rw-r--r--drivers/iio/adc/max1363.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
index 5db56f5ce7dc..08e4feb4f6ee 100644
--- a/drivers/iio/adc/max1363.c
+++ b/drivers/iio/adc/max1363.c
@@ -335,7 +335,7 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev,
{
int ret = 0;
s32 data;
- char rxbuf[2];
+ u8 rxbuf[2];
struct max1363_state *st = iio_priv(indio_dev);
struct i2c_client *client = st->client;
@@ -367,7 +367,8 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev,
ret = data;
goto error_ret;
}
- data = (s32)(rxbuf[1]) | ((s32)(rxbuf[0] & 0x0F)) << 8;
+ data = (rxbuf[1] | rxbuf[0] << 8) &
+ ((1 << st->chip_info->bits) - 1);
} else {
/* Get reading */
data = i2c_master_recv(client, rxbuf, 1);
@@ -1496,6 +1497,7 @@ static int max1363_probe(struct i2c_client *client,
goto error_out;
}
+ indio_dev->dev.of_node = client->dev.of_node;
ret = iio_map_array_register(indio_dev, client->dev.platform_data);
if (ret < 0)
goto error_free_device;
@@ -1529,8 +1531,6 @@ static int max1363_probe(struct i2c_client *client,
indio_dev->num_channels = st->chip_info->num_channels;
indio_dev->info = st->chip_info->info;
indio_dev->modes = INDIO_DIRECT_MODE;
- indio_dev->channels = st->chip_info->channels;
- indio_dev->num_channels = st->chip_info->num_channels;
ret = max1363_initial_setup(st);
if (ret < 0)
goto error_free_available_scan_masks;
@@ -1569,7 +1569,7 @@ error_disable_reg:
error_put_reg:
regulator_put(st->reg);
error_unregister_map:
- iio_map_array_unregister(indio_dev, client->dev.platform_data);
+ iio_map_array_unregister(indio_dev);
error_free_device:
iio_device_free(indio_dev);
error_out:
@@ -1588,7 +1588,7 @@ static int max1363_remove(struct i2c_client *client)
kfree(indio_dev->available_scan_masks);
regulator_disable(st->reg);
regulator_put(st->reg);
- iio_map_array_unregister(indio_dev, client->dev.platform_data);
+ iio_map_array_unregister(indio_dev);
iio_device_free(indio_dev);
return 0;