Skip to content

Commit

Permalink
Merge tag 'iio-for-3.8b' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jic23/iio into staging-next

Second round of new IIO drivers and cleanups for the 3.8 cycle.

Usual mixed bag of cleanups and minor improvements including
one reversion for a patch in the previous series.

* adt7310 and adt7410 drivers merged into one.
* Revert use devm_kcalloc in at91_adc (because it doesn't exist)
* unlocking fix for error path in the ad5449
* isl29018 suspend and resume support.
* improved pseudo floating point parsing for info_mask write
attributes (and hence into write_raw).  Reject some messed up
strings.
  • Loading branch information
Greg Kroah-Hartman committed Nov 2, 2012
2 parents abcdc99 + 1e45cf3 commit 1180c88
Show file tree
Hide file tree
Showing 9 changed files with 427 additions and 1,002 deletions.
16 changes: 10 additions & 6 deletions drivers/iio/adc/at91_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ static int at91_adc_channel_init(struct iio_dev *idev)
idev->num_channels = bitmap_weight(&st->channels_mask,
st->num_channels) + 1;

chan_array = devm_kcalloc(&idev->dev, idev->num_channels + 1,
sizeof(*chan_array), GFP_KERNEL);
chan_array = devm_kzalloc(&idev->dev,
((idev->num_channels + 1) *
sizeof(struct iio_chan_spec)),
GFP_KERNEL);

if (!chan_array)
return -ENOMEM;
Expand Down Expand Up @@ -268,8 +270,9 @@ static int at91_adc_trigger_init(struct iio_dev *idev)
struct at91_adc_state *st = iio_priv(idev);
int i, ret;

st->trig = devm_kcalloc(&idev->dev, st->trigger_number,
sizeof(*st->trig), GFP_KERNEL);
st->trig = devm_kzalloc(&idev->dev,
st->trigger_number * sizeof(st->trig),
GFP_KERNEL);

if (st->trig == NULL) {
ret = -ENOMEM;
Expand Down Expand Up @@ -451,8 +454,9 @@ static int at91_adc_probe_dt(struct at91_adc_state *st,
st->registers->trigger_register = prop;

st->trigger_number = of_get_child_count(node);
st->trigger_list = devm_kcalloc(&idev->dev, st->trigger_number,
sizeof(*st->trigger_list), GFP_KERNEL);
st->trigger_list = devm_kzalloc(&idev->dev, st->trigger_number *
sizeof(struct at91_adc_trigger),
GFP_KERNEL);
if (!st->trigger_list) {
dev_err(&idev->dev, "Could not allocate trigger list memory.\n");
ret = -ENOMEM;
Expand Down
7 changes: 4 additions & 3 deletions drivers/iio/dac/ad5449.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,13 @@ static int ad5449_read(struct iio_dev *indio_dev, unsigned int addr,

ret = spi_sync(st->spi, &msg);
if (ret < 0)
return ret;
goto out_unlock;

*val = be16_to_cpu(st->data[1]);
mutex_unlock(&indio_dev->mlock);

return 0;
out_unlock:
mutex_unlock(&indio_dev->mlock);
return ret;
}

static int ad5449_read_raw(struct iio_dev *indio_dev,
Expand Down
6 changes: 3 additions & 3 deletions drivers/iio/industrialio-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ static ssize_t iio_write_channel_info(struct device *dev,
if (buf[0] == '-') {
negative = true;
buf++;
} else if (buf[0] == '+') {
buf++;
}

while (*buf) {
Expand All @@ -445,16 +447,14 @@ static ssize_t iio_write_channel_info(struct device *dev,
integer = integer*10 + *buf - '0';
else {
fract += fract_mult*(*buf - '0');
if (fract_mult == 1)
break;
fract_mult /= 10;
}
} else if (*buf == '\n') {
if (*(buf + 1) == '\0')
break;
else
return -EINVAL;
} else if (*buf == '.') {
} else if (*buf == '.' && integer_part) {
integer_part = false;
} else {
return -EINVAL;
Expand Down
13 changes: 3 additions & 10 deletions drivers/staging/iio/adc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,11 @@ config AD7192
To compile this driver as a module, choose M here: the
module will be called ad7192.

config ADT7310
tristate "Analog Devices ADT7310 temperature sensor driver"
depends on SPI
help
Say yes here to build support for Analog Devices ADT7310
temperature sensors.

config ADT7410
tristate "Analog Devices ADT7410 temperature sensor driver"
depends on I2C
tristate "Analog Devices ADT7310/ADT7410 temperature sensor driver"
depends on I2C || SPI_MASTER
help
Say yes here to build support for Analog Devices ADT7410
Say yes here to build support for Analog Devices ADT7310/ADT7410
temperature sensors.

config AD7280
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/iio/adc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ obj-$(CONFIG_AD7780) += ad7780.o
obj-$(CONFIG_AD7793) += ad7793.o
obj-$(CONFIG_AD7816) += ad7816.o
obj-$(CONFIG_AD7192) += ad7192.o
obj-$(CONFIG_ADT7310) += adt7310.o
obj-$(CONFIG_ADT7410) += adt7410.o
obj-$(CONFIG_AD7280) += ad7280a.o
obj-$(CONFIG_LPC32XX_ADC) += lpc32xx_adc.o
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/iio/adc/ad7280a.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
*/
#define POLYNOM 0x2F
#define POLYNOM_ORDER 8
#define HIGHBIT 1 << (POLYNOM_ORDER - 1);
#define HIGHBIT (1 << (POLYNOM_ORDER - 1))

struct ad7280_state {
struct spi_device *spi;
Expand Down
Loading

0 comments on commit 1180c88

Please sign in to comment.