diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-07 11:57:00 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-07 11:57:00 -0500 |
| commit | 81e990bbdeb77db80d7e7f0e36e159a0facfdff0 (patch) | |
| tree | 0ec51a2bcf825c35d524af027237b17cff89a8f3 | |
| parent | 5a819ed6d4bb803ee609b4ceedd7c8efbbfa65e0 (diff) | |
| parent | 8c314da583c9d5c67fe59aa8c92f94f15cb8de90 (diff) | |
Merge tag 'iio-fixes-for-3.14a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes:
First set of IIO fixes for the 3.14 cycle.
Included is the patch previously set as the fourth round for 3.13 which was
to late to be appropriate.
* Another endian fix (ad799x adc) due to missuse of the IIO_ST macro (which
is going away very shortly)
* A reversed error check in ad5933 which will make the probe fail.
* A buffer overflow in the example code in the documentation.
* ad799x was freeing an irq that might or might not have been requested.
* tsl2563 was checking the wrong element of chan_spec for modifiers. Thus some
sysfs reads would give the wrong values.
* A missing dependency on HAS_IOMEM in spear_adc and lpc32xx was causing some
test build failures (on s390 and perhaps elsewhere).
I also have a few fixes queued up for things that went in during the 3.14
merge window which will follow as a separate pull request (to avoid rebasing
my tree).
| -rw-r--r-- | drivers/iio/light/tsl2563.c | 16 | ||||
| -rw-r--r-- | drivers/staging/iio/Documentation/iio_utils.h | 6 | ||||
| -rw-r--r-- | drivers/staging/iio/adc/ad799x_core.c | 11 | ||||
| -rw-r--r-- | drivers/staging/iio/impedance-analyzer/ad5933.c | 2 |
4 files changed, 23 insertions, 12 deletions
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c index 3d8110157f2d..94daa9fc1247 100644 --- a/drivers/iio/light/tsl2563.c +++ b/drivers/iio/light/tsl2563.c | |||
| @@ -460,10 +460,14 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev, | |||
| 460 | { | 460 | { |
| 461 | struct tsl2563_chip *chip = iio_priv(indio_dev); | 461 | struct tsl2563_chip *chip = iio_priv(indio_dev); |
| 462 | 462 | ||
| 463 | if (chan->channel == IIO_MOD_LIGHT_BOTH) | 463 | if (mask != IIO_CHAN_INFO_CALIBSCALE) |
| 464 | return -EINVAL; | ||
| 465 | if (chan->channel2 == IIO_MOD_LIGHT_BOTH) | ||
| 464 | chip->calib0 = calib_from_sysfs(val); | 466 | chip->calib0 = calib_from_sysfs(val); |
| 465 | else | 467 | else if (chan->channel2 == IIO_MOD_LIGHT_IR) |
| 466 | chip->calib1 = calib_from_sysfs(val); | 468 | chip->calib1 = calib_from_sysfs(val); |
| 469 | else | ||
| 470 | return -EINVAL; | ||
| 467 | 471 | ||
| 468 | return 0; | 472 | return 0; |
| 469 | } | 473 | } |
| @@ -472,14 +476,14 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev, | |||
| 472 | struct iio_chan_spec const *chan, | 476 | struct iio_chan_spec const *chan, |
| 473 | int *val, | 477 | int *val, |
| 474 | int *val2, | 478 | int *val2, |
| 475 | long m) | 479 | long mask) |
| 476 | { | 480 | { |
| 477 | int ret = -EINVAL; | 481 | int ret = -EINVAL; |
| 478 | u32 calib0, calib1; | 482 | u32 calib0, calib1; |
| 479 | struct tsl2563_chip *chip = iio_priv(indio_dev); | 483 | struct tsl2563_chip *chip = iio_priv(indio_dev); |
| 480 | 484 | ||
| 481 | mutex_lock(&chip->lock); | 485 | mutex_lock(&chip->lock); |
| 482 | switch (m) { | 486 | switch (mask) { |
| 483 | case IIO_CHAN_INFO_RAW: | 487 | case IIO_CHAN_INFO_RAW: |
| 484 | case IIO_CHAN_INFO_PROCESSED: | 488 | case IIO_CHAN_INFO_PROCESSED: |
| 485 | switch (chan->type) { | 489 | switch (chan->type) { |
| @@ -498,7 +502,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev, | |||
| 498 | ret = tsl2563_get_adc(chip); | 502 | ret = tsl2563_get_adc(chip); |
| 499 | if (ret) | 503 | if (ret) |
| 500 | goto error_ret; | 504 | goto error_ret; |
| 501 | if (chan->channel == 0) | 505 | if (chan->channel2 == IIO_MOD_LIGHT_BOTH) |
| 502 | *val = chip->data0; | 506 | *val = chip->data0; |
| 503 | else | 507 | else |
| 504 | *val = chip->data1; | 508 | *val = chip->data1; |
| @@ -510,7 +514,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev, | |||
| 510 | break; | 514 | break; |
| 511 | 515 | ||
| 512 | case IIO_CHAN_INFO_CALIBSCALE: | 516 | case IIO_CHAN_INFO_CALIBSCALE: |
| 513 | if (chan->channel == 0) | 517 | if (chan->channel2 == IIO_MOD_LIGHT_BOTH) |
| 514 | *val = calib_to_sysfs(chip->calib0); | 518 | *val = calib_to_sysfs(chip->calib0); |
| 515 | else | 519 | else |
| 516 | *val = calib_to_sysfs(chip->calib1); | 520 | *val = calib_to_sysfs(chip->calib1); |
diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 35154d60faf6..c9fedb79e3a2 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h | |||
| @@ -77,7 +77,6 @@ struct iio_channel_info { | |||
| 77 | uint64_t mask; | 77 | uint64_t mask; |
| 78 | unsigned be; | 78 | unsigned be; |
| 79 | unsigned is_signed; | 79 | unsigned is_signed; |
| 80 | unsigned enabled; | ||
| 81 | unsigned location; | 80 | unsigned location; |
| 82 | }; | 81 | }; |
| 83 | 82 | ||
| @@ -335,6 +334,7 @@ inline int build_channel_array(const char *device_dir, | |||
| 335 | while (ent = readdir(dp), ent != NULL) { | 334 | while (ent = readdir(dp), ent != NULL) { |
| 336 | if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), | 335 | if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), |
| 337 | "_en") == 0) { | 336 | "_en") == 0) { |
| 337 | int current_enabled = 0; | ||
| 338 | current = &(*ci_array)[count++]; | 338 | current = &(*ci_array)[count++]; |
| 339 | ret = asprintf(&filename, | 339 | ret = asprintf(&filename, |
| 340 | "%s/%s", scan_el_dir, ent->d_name); | 340 | "%s/%s", scan_el_dir, ent->d_name); |
| @@ -350,10 +350,10 @@ inline int build_channel_array(const char *device_dir, | |||
| 350 | ret = -errno; | 350 | ret = -errno; |
| 351 | goto error_cleanup_array; | 351 | goto error_cleanup_array; |
| 352 | } | 352 | } |
| 353 | fscanf(sysfsfp, "%u", ¤t->enabled); | 353 | fscanf(sysfsfp, "%u", ¤t_enabled); |
| 354 | fclose(sysfsfp); | 354 | fclose(sysfsfp); |
| 355 | 355 | ||
| 356 | if (!current->enabled) { | 356 | if (!current_enabled) { |
| 357 | free(filename); | 357 | free(filename); |
| 358 | count--; | 358 | count--; |
| 359 | continue; | 359 | continue; |
diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c index 5ea36410f716..31a2be688060 100644 --- a/drivers/staging/iio/adc/ad799x_core.c +++ b/drivers/staging/iio/adc/ad799x_core.c | |||
| @@ -409,7 +409,13 @@ static const struct iio_event_spec ad799x_events[] = { | |||
| 409 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ | 409 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ |
| 410 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ | 410 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ |
| 411 | .scan_index = (_index), \ | 411 | .scan_index = (_index), \ |
| 412 | .scan_type = IIO_ST('u', _realbits, 16, 12 - (_realbits)), \ | 412 | .scan_type = { \ |
| 413 | .sign = 'u', \ | ||
| 414 | .realbits = (_realbits), \ | ||
| 415 | .storagebits = 16, \ | ||
| 416 | .shift = 12 - (_realbits), \ | ||
| 417 | .endianness = IIO_BE, \ | ||
| 418 | }, \ | ||
| 413 | .event_spec = _ev_spec, \ | 419 | .event_spec = _ev_spec, \ |
| 414 | .num_event_specs = _num_ev_spec, \ | 420 | .num_event_specs = _num_ev_spec, \ |
| 415 | } | 421 | } |
| @@ -588,7 +594,8 @@ static int ad799x_probe(struct i2c_client *client, | |||
| 588 | return 0; | 594 | return 0; |
| 589 | 595 | ||
| 590 | error_free_irq: | 596 | error_free_irq: |
| 591 | free_irq(client->irq, indio_dev); | 597 | if (client->irq > 0) |
| 598 | free_irq(client->irq, indio_dev); | ||
| 592 | error_cleanup_ring: | 599 | error_cleanup_ring: |
| 593 | ad799x_ring_cleanup(indio_dev); | 600 | ad799x_ring_cleanup(indio_dev); |
| 594 | error_disable_reg: | 601 | error_disable_reg: |
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index 0a4298b744e6..2b96665da8a2 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c | |||
| @@ -629,7 +629,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev) | |||
| 629 | struct iio_buffer *buffer; | 629 | struct iio_buffer *buffer; |
| 630 | 630 | ||
| 631 | buffer = iio_kfifo_allocate(indio_dev); | 631 | buffer = iio_kfifo_allocate(indio_dev); |
| 632 | if (buffer) | 632 | if (!buffer) |
| 633 | return -ENOMEM; | 633 | return -ENOMEM; |
| 634 | 634 | ||
| 635 | iio_device_attach_buffer(indio_dev, buffer); | 635 | iio_device_attach_buffer(indio_dev, buffer); |
