Commit bf3f401d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'staging-5.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging and IIO driver fixes from Greg KH:
 "Here are some small staging and iio driver fixes for 5.5-rc7

  All of them are for some small reported issues. Nothing major, full
  details in the shortlog.

  All have been in linux-next with no reported issues"

* tag 'staging-5.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: comedi: ni_routes: allow partial routing information
  staging: comedi: ni_routes: fix null dereference in ni_find_route_source()
  iio: light: vcnl4000: Fix scale for vcnl4040
  iio: buffer: align the size of scan bytes to size of the largest element
  iio: chemical: pms7003: fix unmet triggered buffer dependency
  iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID
  iio: adc: ad7124: Fix DT channel configuration
parents c5fd2c5b 9fea3a40
...@@ -494,13 +494,11 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, ...@@ -494,13 +494,11 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev,
st->channel_config[channel].buf_negative = st->channel_config[channel].buf_negative =
of_property_read_bool(child, "adi,buffered-negative"); of_property_read_bool(child, "adi,buffered-negative");
*chan = ad7124_channel_template; chan[channel] = ad7124_channel_template;
chan->address = channel; chan[channel].address = channel;
chan->scan_index = channel; chan[channel].scan_index = channel;
chan->channel = ain[0]; chan[channel].channel = ain[0];
chan->channel2 = ain[1]; chan[channel].channel2 = ain[1];
chan++;
} }
return 0; return 0;
......
...@@ -65,6 +65,7 @@ config IAQCORE ...@@ -65,6 +65,7 @@ config IAQCORE
config PMS7003 config PMS7003
tristate "Plantower PMS7003 particulate matter sensor" tristate "Plantower PMS7003 particulate matter sensor"
depends on SERIAL_DEV_BUS depends on SERIAL_DEV_BUS
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER select IIO_TRIGGERED_BUFFER
help help
Say Y here to build support for the Plantower PMS7003 particulate Say Y here to build support for the Plantower PMS7003 particulate
......
...@@ -1301,7 +1301,8 @@ static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id, ...@@ -1301,7 +1301,8 @@ static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id,
for (i = 0; i < ARRAY_SIZE(st_lsm6dsx_sensor_settings); i++) { for (i = 0; i < ARRAY_SIZE(st_lsm6dsx_sensor_settings); i++) {
for (j = 0; j < ST_LSM6DSX_MAX_ID; j++) { for (j = 0; j < ST_LSM6DSX_MAX_ID; j++) {
if (id == st_lsm6dsx_sensor_settings[i].id[j].hw_id) if (st_lsm6dsx_sensor_settings[i].id[j].name &&
id == st_lsm6dsx_sensor_settings[i].id[j].hw_id)
break; break;
} }
if (j < ST_LSM6DSX_MAX_ID) if (j < ST_LSM6DSX_MAX_ID)
......
...@@ -566,7 +566,7 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, ...@@ -566,7 +566,7 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev,
const unsigned long *mask, bool timestamp) const unsigned long *mask, bool timestamp)
{ {
unsigned bytes = 0; unsigned bytes = 0;
int length, i; int length, i, largest = 0;
/* How much space will the demuxed element take? */ /* How much space will the demuxed element take? */
for_each_set_bit(i, mask, for_each_set_bit(i, mask,
...@@ -574,13 +574,17 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, ...@@ -574,13 +574,17 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev,
length = iio_storage_bytes_for_si(indio_dev, i); length = iio_storage_bytes_for_si(indio_dev, i);
bytes = ALIGN(bytes, length); bytes = ALIGN(bytes, length);
bytes += length; bytes += length;
largest = max(largest, length);
} }
if (timestamp) { if (timestamp) {
length = iio_storage_bytes_for_timestamp(indio_dev); length = iio_storage_bytes_for_timestamp(indio_dev);
bytes = ALIGN(bytes, length); bytes = ALIGN(bytes, length);
bytes += length; bytes += length;
largest = max(largest, length);
} }
bytes = ALIGN(bytes, largest);
return bytes; return bytes;
} }
......
...@@ -163,7 +163,6 @@ static int vcnl4200_init(struct vcnl4000_data *data) ...@@ -163,7 +163,6 @@ static int vcnl4200_init(struct vcnl4000_data *data)
if (ret < 0) if (ret < 0)
return ret; return ret;
data->al_scale = 24000;
data->vcnl4200_al.reg = VCNL4200_AL_DATA; data->vcnl4200_al.reg = VCNL4200_AL_DATA;
data->vcnl4200_ps.reg = VCNL4200_PS_DATA; data->vcnl4200_ps.reg = VCNL4200_PS_DATA;
switch (id) { switch (id) {
...@@ -172,11 +171,13 @@ static int vcnl4200_init(struct vcnl4000_data *data) ...@@ -172,11 +171,13 @@ static int vcnl4200_init(struct vcnl4000_data *data)
/* show 54ms in total. */ /* show 54ms in total. */
data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000); data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000);
data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000); data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000);
data->al_scale = 24000;
break; break;
case VCNL4040_PROD_ID: case VCNL4040_PROD_ID:
/* Integration time is 80ms, add 10ms. */ /* Integration time is 80ms, add 10ms. */
data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000); data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000);
data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000); data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000);
data->al_scale = 120000;
break; break;
} }
data->vcnl4200_al.last_measurement = ktime_set(0, 0); data->vcnl4200_al.last_measurement = ktime_set(0, 0);
......
...@@ -72,9 +72,6 @@ static int ni_find_device_routes(const char *device_family, ...@@ -72,9 +72,6 @@ static int ni_find_device_routes(const char *device_family,
} }
} }
if (!rv)
return -ENODATA;
/* Second, find the set of routes valid for this device. */ /* Second, find the set of routes valid for this device. */
for (i = 0; ni_device_routes_list[i]; ++i) { for (i = 0; ni_device_routes_list[i]; ++i) {
if (memcmp(ni_device_routes_list[i]->device, board_name, if (memcmp(ni_device_routes_list[i]->device, board_name,
...@@ -84,12 +81,12 @@ static int ni_find_device_routes(const char *device_family, ...@@ -84,12 +81,12 @@ static int ni_find_device_routes(const char *device_family,
} }
} }
if (!dr)
return -ENODATA;
tables->route_values = rv; tables->route_values = rv;
tables->valid_routes = dr; tables->valid_routes = dr;
if (!rv || !dr)
return -ENODATA;
return 0; return 0;
} }
...@@ -487,6 +484,9 @@ int ni_find_route_source(const u8 src_sel_reg_value, int dest, ...@@ -487,6 +484,9 @@ int ni_find_route_source(const u8 src_sel_reg_value, int dest,
{ {
int src; int src;
if (!tables->route_values)
return -EINVAL;
dest = B(dest); /* subtract NI names offset */ dest = B(dest); /* subtract NI names offset */
/* ensure we are not going to under/over run the route value table */ /* ensure we are not going to under/over run the route value table */
if (dest < 0 || dest >= NI_NUM_NAMES) if (dest < 0 || dest >= NI_NUM_NAMES)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment