Third round of new stuff for IIO in the 3.16 cycle.

This (rather late) set consists only of fixes to patches earlier in the
 cycle or minor fixes for other problems (such as randconfig build issues
 picked up by Arnd).  I've included the general minor fixes here as it is
 very late in the current cycle and they can all wait for the merge window.
 
 * Recent change to hid-sensors introduced a possible infinite loop due to a
   typo. In the same series, a report interval unit read was added but in the
   case where the hardware doesn't support it a value of 0 would lead to some
   nasty issues.  The patch sets it to the specified default of msecs.
 * Anon inodes were used by IIO without being explicitly selected.  This has
   been true for a long time so it clearly only effects rather unusual
   configurations (rand configs)
 * at91 requires the input subsytem but this wasn't explicity in the Kconfig.
 * A couple of parts supported by the max1363 driver were using the wrong
   iio_chan_spec arrays and hence would missreport their bit depths.  This has
   been there a long time and was never right so isn't a regression.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTgdLAAAoJEFSFNJnE9BaIDBwP/jGJ4cOV4mKekQvn+keMCQ8M
 fPyKRijwgWE9VEVP6BbhA5ya4hwH6bloQXBBp2PhB51GS1I8pNc5dWJzQEZO+oFA
 9jkQm91zufeRjxEUCRlD8kfJ+7V766SKlIkENbJgbk5XStvrAWAIQ8lHkHwJmL5j
 lNfGWCrVuBKK3Ck08HH6p2N6hHO1GDHnyrdGIW2BYJZVyUBpBlkukSZoU8T0zB6g
 F9QzZyECG9VdbL1HVBrsBy3Pw9cOwiMTJrDMJ2dkwBdKmAnkllSomrKV5cOlYWFF
 qg3z6JOPPY+6Hpl15tr2RvTaoKYTc33q9/UX1sysrLyLN07W52ygXdozxTGUINB2
 ozhmIp/oZVYyHXIHC3yg7MOhW6AExJkzr91IMNnvVT8f22BlkdXHRB0atCAHcUvT
 t4NsFHS0QrRYooqVI12Z3wOPmZahydgUlivNySRaug4lYgULxl5pts9WAl8fEgA7
 ZM4tUUtGjrni5KpaYT5wnQ2JhwNTZDu2kIYgRB5Zhh5F/uqJ/xQCjllhJxv92hKG
 r6LvacGaWiwyYXryl4TvfqH1/4lqsFk8nyS0OLUFhtCfE8jmydSZ63LhnnQJs/iH
 u0u/uDz9lqPgtClWZDm3YqIMRpp4ShNkn8irBZ9bLhaHC59GurgYMM+PgkrUPM/N
 7y76UVWNYNWxYb/L0A5n
 =u2ra
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-3.16c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Third round of new stuff for IIO in the 3.16 cycle.

This (rather late) set consists only of fixes to patches earlier in the
cycle or minor fixes for other problems (such as randconfig build issues
picked up by Arnd).  I've included the general minor fixes here as it is
very late in the current cycle and they can all wait for the merge window.

* Recent change to hid-sensors introduced a possible infinite loop due to a
  typo. In the same series, a report interval unit read was added but in the
  case where the hardware doesn't support it a value of 0 would lead to some
  nasty issues.  The patch sets it to the specified default of msecs.
* Anon inodes were used by IIO without being explicitly selected.  This has
  been true for a long time so it clearly only effects rather unusual
  configurations (rand configs)
* at91 requires the input subsytem but this wasn't explicity in the Kconfig.
* A couple of parts supported by the max1363 driver were using the wrong
  iio_chan_spec arrays and hence would missreport their bit depths.  This has
  been there a long time and was never right so isn't a regression.
This commit is contained in:
Greg Kroah-Hartman 2014-05-25 10:56:30 -07:00
commit 588079342e
5 changed files with 30 additions and 15 deletions

View File

@ -4,6 +4,7 @@
menuconfig IIO menuconfig IIO
tristate "Industrial I/O support" tristate "Industrial I/O support"
select ANON_INODES
help help
The industrial I/O subsystem provides a unified framework for The industrial I/O subsystem provides a unified framework for
drivers for many different types of embedded sensors using a drivers for many different types of embedded sensors using a

View File

@ -110,6 +110,7 @@ config AD799X
config AT91_ADC config AT91_ADC
tristate "Atmel AT91 ADC" tristate "Atmel AT91 ADC"
depends on ARCH_AT91 depends on ARCH_AT91
depends on INPUT
select IIO_BUFFER select IIO_BUFFER
select IIO_TRIGGERED_BUFFER select IIO_TRIGGERED_BUFFER
select SYSFS select SYSFS

View File

@ -1252,8 +1252,8 @@ static const struct max1363_chip_info max1363_chip_info_tbl[] = {
.num_modes = ARRAY_SIZE(max1238_mode_list), .num_modes = ARRAY_SIZE(max1238_mode_list),
.default_mode = s0to11, .default_mode = s0to11,
.info = &max1238_info, .info = &max1238_info,
.channels = max1238_channels, .channels = max1038_channels,
.num_channels = ARRAY_SIZE(max1238_channels), .num_channels = ARRAY_SIZE(max1038_channels),
}, },
[max11605] = { [max11605] = {
.bits = 8, .bits = 8,
@ -1262,8 +1262,8 @@ static const struct max1363_chip_info max1363_chip_info_tbl[] = {
.num_modes = ARRAY_SIZE(max1238_mode_list), .num_modes = ARRAY_SIZE(max1238_mode_list),
.default_mode = s0to11, .default_mode = s0to11,
.info = &max1238_info, .info = &max1238_info,
.channels = max1238_channels, .channels = max1038_channels,
.num_channels = ARRAY_SIZE(max1238_channels), .num_channels = ARRAY_SIZE(max1038_channels),
}, },
[max11606] = { [max11606] = {
.bits = 10, .bits = 10,
@ -1312,8 +1312,8 @@ static const struct max1363_chip_info max1363_chip_info_tbl[] = {
.num_modes = ARRAY_SIZE(max1238_mode_list), .num_modes = ARRAY_SIZE(max1238_mode_list),
.default_mode = s0to11, .default_mode = s0to11,
.info = &max1238_info, .info = &max1238_info,
.channels = max1238_channels, .channels = max1138_channels,
.num_channels = ARRAY_SIZE(max1238_channels), .num_channels = ARRAY_SIZE(max1138_channels),
}, },
[max11611] = { [max11611] = {
.bits = 10, .bits = 10,
@ -1322,8 +1322,8 @@ static const struct max1363_chip_info max1363_chip_info_tbl[] = {
.num_modes = ARRAY_SIZE(max1238_mode_list), .num_modes = ARRAY_SIZE(max1238_mode_list),
.default_mode = s0to11, .default_mode = s0to11,
.info = &max1238_info, .info = &max1238_info,
.channels = max1238_channels, .channels = max1138_channels,
.num_channels = ARRAY_SIZE(max1238_channels), .num_channels = ARRAY_SIZE(max1138_channels),
}, },
[max11612] = { [max11612] = {
.bits = 12, .bits = 12,

View File

@ -327,7 +327,7 @@ int hid_sensor_format_scale(u32 usage_id,
*val0 = 1; *val0 = 1;
*val1 = 0; *val1 = 0;
for (i = 0; ARRAY_SIZE(unit_conversion); ++i) { for (i = 0; i < ARRAY_SIZE(unit_conversion); ++i) {
if (unit_conversion[i].usage_id == usage_id && if (unit_conversion[i].usage_id == usage_id &&
unit_conversion[i].unit == attr_info->units) { unit_conversion[i].unit == attr_info->units) {
exp = hid_sensor_convert_exponent( exp = hid_sensor_convert_exponent(
@ -343,15 +343,28 @@ int hid_sensor_format_scale(u32 usage_id,
} }
EXPORT_SYMBOL(hid_sensor_format_scale); EXPORT_SYMBOL(hid_sensor_format_scale);
int hid_sensor_get_reporting_interval(struct hid_sensor_hub_device *hsdev,
u32 usage_id,
struct hid_sensor_common *st)
{
sensor_hub_input_get_attribute_info(hsdev,
HID_FEATURE_REPORT, usage_id,
HID_USAGE_SENSOR_PROP_REPORT_INTERVAL,
&st->poll);
/* Default unit of measure is milliseconds */
if (st->poll.units == 0)
st->poll.units = HID_USAGE_SENSOR_UNITS_MILLISECOND;
return 0;
}
int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev, int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
u32 usage_id, u32 usage_id,
struct hid_sensor_common *st) struct hid_sensor_common *st)
{ {
sensor_hub_input_get_attribute_info(hsdev,
HID_FEATURE_REPORT, usage_id, hid_sensor_get_reporting_interval(hsdev, usage_id, st);
HID_USAGE_SENSOR_PROP_REPORT_INTERVAL,
&st->poll);
sensor_hub_input_get_attribute_info(hsdev, sensor_hub_input_get_attribute_info(hsdev,
HID_FEATURE_REPORT, usage_id, HID_FEATURE_REPORT, usage_id,

View File

@ -318,7 +318,7 @@ inline int build_channel_array(const char *device_dir,
free(filename); free(filename);
goto error_close_dir; goto error_close_dir;
} }
fscanf(sysfsfp, "%u", &ret); fscanf(sysfsfp, "%i", &ret);
if (ret == 1) if (ret == 1)
(*counter)++; (*counter)++;
fclose(sysfsfp); fclose(sysfsfp);
@ -350,7 +350,7 @@ inline int build_channel_array(const char *device_dir,
ret = -errno; ret = -errno;
goto error_cleanup_array; goto error_cleanup_array;
} }
fscanf(sysfsfp, "%u", &current_enabled); fscanf(sysfsfp, "%i", &current_enabled);
fclose(sysfsfp); fclose(sysfsfp);
if (!current_enabled) { if (!current_enabled) {