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). -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJS7+bmAAoJEFSFNJnE9BaIBEIP/Ry6x7SbKwjP71dO0gSrCmbf WLO7yE+jy3MRkua/vhRn2nRx76Mk4N0NfZ7aSxja3gE/UMIgDUG0QC5tJgVm+Sol rUr+TOn9vrBhvJWoaOuZerkfdEiP1AUE034sQ4BXPm8M+zpf/1t2nRXslFPGx0hw bq+XBhBpB2pBlmn8Z6q9DK279elh1cmhuJyFK4BEEa98/fLCfkLoKPWD3L/uDS6/ ne33LqvcKPgCkEToX5FoSeCibnQI673LgR2zuxfljxVYnkO7y8IqdzwJDExpsNzW mGYIrnuGM6ocXe8vIqkqknD9x8xST+mCGrpIUC0MD9eq5AIRzttxZoYKclq3kTTQ bukrbuqkiGyC2Hwe50A4+bWM06I8yu/NDUuGxCvKfy26wqwAtXlKGTzwJUg6jHBU rssMhYbBLSKmyl0sFlH1xwaHGDZKDNHWz60GpdO2OS516U37JkGvRvRg2bkgomps w4OoqXgspE5F1CCnRgy2NYIbN+UlJWY4SGO/boCor5JonYkWnmTq+0sQ4XxehAqc sTPW7vXITTkGJmrAgRWmBReI0iE03sC2CDZIOLlGOczJ4tDj7iRh1EN1tAB7gGV8 n3rIZaE5AfAGKNgLcgF5WaVbnxm/Pd9dr+JdjcFv+I8imKiLCCnj/U23WaD27kUt RnMueM0Uu7I1hD3BSbDx =otUr -----END PGP SIGNATURE----- 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).
This commit is contained in:
commit
81e990bbde
4 changed files with 23 additions and 12 deletions
|
@ -460,10 +460,14 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev,
|
|||
{
|
||||
struct tsl2563_chip *chip = iio_priv(indio_dev);
|
||||
|
||||
if (chan->channel == IIO_MOD_LIGHT_BOTH)
|
||||
if (mask != IIO_CHAN_INFO_CALIBSCALE)
|
||||
return -EINVAL;
|
||||
if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
|
||||
chip->calib0 = calib_from_sysfs(val);
|
||||
else
|
||||
else if (chan->channel2 == IIO_MOD_LIGHT_IR)
|
||||
chip->calib1 = calib_from_sysfs(val);
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -472,14 +476,14 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
|
|||
struct iio_chan_spec const *chan,
|
||||
int *val,
|
||||
int *val2,
|
||||
long m)
|
||||
long mask)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
u32 calib0, calib1;
|
||||
struct tsl2563_chip *chip = iio_priv(indio_dev);
|
||||
|
||||
mutex_lock(&chip->lock);
|
||||
switch (m) {
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
case IIO_CHAN_INFO_PROCESSED:
|
||||
switch (chan->type) {
|
||||
|
@ -498,7 +502,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
|
|||
ret = tsl2563_get_adc(chip);
|
||||
if (ret)
|
||||
goto error_ret;
|
||||
if (chan->channel == 0)
|
||||
if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
|
||||
*val = chip->data0;
|
||||
else
|
||||
*val = chip->data1;
|
||||
|
@ -510,7 +514,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
|
|||
break;
|
||||
|
||||
case IIO_CHAN_INFO_CALIBSCALE:
|
||||
if (chan->channel == 0)
|
||||
if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
|
||||
*val = calib_to_sysfs(chip->calib0);
|
||||
else
|
||||
*val = calib_to_sysfs(chip->calib1);
|
||||
|
|
|
@ -77,7 +77,6 @@ struct iio_channel_info {
|
|||
uint64_t mask;
|
||||
unsigned be;
|
||||
unsigned is_signed;
|
||||
unsigned enabled;
|
||||
unsigned location;
|
||||
};
|
||||
|
||||
|
@ -335,6 +334,7 @@ inline int build_channel_array(const char *device_dir,
|
|||
while (ent = readdir(dp), ent != NULL) {
|
||||
if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
|
||||
"_en") == 0) {
|
||||
int current_enabled = 0;
|
||||
current = &(*ci_array)[count++];
|
||||
ret = asprintf(&filename,
|
||||
"%s/%s", scan_el_dir, ent->d_name);
|
||||
|
@ -350,10 +350,10 @@ inline int build_channel_array(const char *device_dir,
|
|||
ret = -errno;
|
||||
goto error_cleanup_array;
|
||||
}
|
||||
fscanf(sysfsfp, "%u", ¤t->enabled);
|
||||
fscanf(sysfsfp, "%u", ¤t_enabled);
|
||||
fclose(sysfsfp);
|
||||
|
||||
if (!current->enabled) {
|
||||
if (!current_enabled) {
|
||||
free(filename);
|
||||
count--;
|
||||
continue;
|
||||
|
|
|
@ -409,7 +409,13 @@ static const struct iio_event_spec ad799x_events[] = {
|
|||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||
.scan_index = (_index), \
|
||||
.scan_type = IIO_ST('u', _realbits, 16, 12 - (_realbits)), \
|
||||
.scan_type = { \
|
||||
.sign = 'u', \
|
||||
.realbits = (_realbits), \
|
||||
.storagebits = 16, \
|
||||
.shift = 12 - (_realbits), \
|
||||
.endianness = IIO_BE, \
|
||||
}, \
|
||||
.event_spec = _ev_spec, \
|
||||
.num_event_specs = _num_ev_spec, \
|
||||
}
|
||||
|
@ -588,7 +594,8 @@ static int ad799x_probe(struct i2c_client *client,
|
|||
return 0;
|
||||
|
||||
error_free_irq:
|
||||
free_irq(client->irq, indio_dev);
|
||||
if (client->irq > 0)
|
||||
free_irq(client->irq, indio_dev);
|
||||
error_cleanup_ring:
|
||||
ad799x_ring_cleanup(indio_dev);
|
||||
error_disable_reg:
|
||||
|
|
|
@ -629,7 +629,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
|||
struct iio_buffer *buffer;
|
||||
|
||||
buffer = iio_kfifo_allocate(indio_dev);
|
||||
if (buffer)
|
||||
if (!buffer)
|
||||
return -ENOMEM;
|
||||
|
||||
iio_device_attach_buffer(indio_dev, buffer);
|
||||
|
|
Loading…
Reference in a new issue