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
Unified · Split
| @@ -494,13 +494,11 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, · 493 unmodified lines | |||
| 494 | st->channel_config[channel].buf_negative = | 494 | st->channel_config[channel].buf_negative = |
| 495 | of_property_read_bool(child, "adi,buffered-negative"); | 495 | of_property_read_bool(child, "adi,buffered-negative"); |
| 496 | 496 | ||
| 497 | *chan = ad7124_channel_template; | 497 | chan[channel] = ad7124_channel_template; |
| 498 | chan->address = channel; | 498 | chan[channel].address = channel; |
| 499 | chan->scan_index = channel; | 499 | chan[channel].scan_index = channel; |
| 500 | chan->channel = ain[0]; | 500 | chan[channel].channel = ain[0]; |
| 501 | chan->channel2 = ain[1]; | 501 | chan[channel].channel2 = ain[1]; |
| 502 | |||
| 503 | chan++; | ||
| 504 | } | 502 | } |
| 505 | 503 | ||
| 506 | return 0; | 504 | return 0; |
| @@ -65,6 +65,7 @@ config IAQCORE · 64 unmodified lines | |||
| 65 | config PMS7003 | 65 | config PMS7003 |
| 66 | tristate "Plantower PMS7003 particulate matter sensor" | 66 | tristate "Plantower PMS7003 particulate matter sensor" |
| 67 | depends on SERIAL_DEV_BUS | 67 | depends on SERIAL_DEV_BUS |
| 68 | select IIO_BUFFER | ||
| 68 | select IIO_TRIGGERED_BUFFER | 69 | select IIO_TRIGGERED_BUFFER |
| 69 | help | 70 | help |
| 70 | Say Y here to build support for the Plantower PMS7003 particulate | 71 | 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, · 1300 unmodified lines | |||
| 1301 | 1301 | ||
| 1302 | for (i = 0; i < ARRAY_SIZE(st_lsm6dsx_sensor_settings); i++) { | 1302 | for (i = 0; i < ARRAY_SIZE(st_lsm6dsx_sensor_settings); i++) { |
| 1303 | for (j = 0; j < ST_LSM6DSX_MAX_ID; j++) { | 1303 | for (j = 0; j < ST_LSM6DSX_MAX_ID; j++) { |
| 1304 | if (id == st_lsm6dsx_sensor_settings[i].id[j].hw_id) | 1304 | if (st_lsm6dsx_sensor_settings[i].id[j].name && |
| 1305 | id == st_lsm6dsx_sensor_settings[i].id[j].hw_id) | ||
| 1305 | break; | 1306 | break; |
| 1306 | } | 1307 | } |
| 1307 | if (j < ST_LSM6DSX_MAX_ID) | 1308 | if (j < ST_LSM6DSX_MAX_ID) |
| @@ -566,7 +566,7 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, · 565 unmodified lines | |||
| 566 | const unsigned long *mask, bool timestamp) | 566 | const unsigned long *mask, bool timestamp) |
| 567 | { | 567 | { |
| 568 | unsigned bytes = 0; | 568 | unsigned bytes = 0; |
| 569 | int length, i; | 569 | int length, i, largest = 0; |
| 570 | 570 | ||
| 571 | /* How much space will the demuxed element take? */ | 571 | /* How much space will the demuxed element take? */ |
| 572 | for_each_set_bit(i, mask, | 572 | for_each_set_bit(i, mask, |
| @@ -574,13 +574,17 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, · 1 unmodified line | |||
| 574 | length = iio_storage_bytes_for_si(indio_dev, i); | 574 | length = iio_storage_bytes_for_si(indio_dev, i); |
| 575 | bytes = ALIGN(bytes, length); | 575 | bytes = ALIGN(bytes, length); |
| 576 | bytes += length; | 576 | bytes += length; |
| 577 | largest = max(largest, length); | ||
| 577 | } | 578 | } |
| 578 | 579 | ||
| 579 | if (timestamp) { | 580 | if (timestamp) { |
| 580 | length = iio_storage_bytes_for_timestamp(indio_dev); | 581 | length = iio_storage_bytes_for_timestamp(indio_dev); |
| 581 | bytes = ALIGN(bytes, length); | 582 | bytes = ALIGN(bytes, length); |
| 582 | bytes += length; | 583 | bytes += length; |
| 584 | largest = max(largest, length); | ||
| 583 | } | 585 | } |
| 586 | |||
| 587 | bytes = ALIGN(bytes, largest); | ||
| 584 | return bytes; | 588 | return bytes; |
| 585 | } | 589 | } |
| 586 | 590 | ||
| @@ -163,7 +163,6 @@ static int vcnl4200_init(struct vcnl4000_data *data) · 162 unmodified lines | |||
| 163 | if (ret < 0) | 163 | if (ret < 0) |
| 164 | return ret; | 164 | return ret; |
| 165 | 165 | ||
| 166 | data->al_scale = 24000; | ||
| 167 | data->vcnl4200_al.reg = VCNL4200_AL_DATA; | 166 | data->vcnl4200_al.reg = VCNL4200_AL_DATA; |
| 168 | data->vcnl4200_ps.reg = VCNL4200_PS_DATA; | 167 | data->vcnl4200_ps.reg = VCNL4200_PS_DATA; |
| 169 | switch (id) { | 168 | switch (id) { |
| @@ -172,11 +171,13 @@ static int vcnl4200_init(struct vcnl4000_data *data) · 2 unmodified lines | |||
| 172 | /* show 54ms in total. */ | 171 | /* show 54ms in total. */ |
| 173 | data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000); | 172 | data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000); |
| 174 | data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000); | 173 | data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000); |
| 174 | data->al_scale = 24000; | ||
| 175 | break; | 175 | break; |
| 176 | case VCNL4040_PROD_ID: | 176 | case VCNL4040_PROD_ID: |
| 177 | /* Integration time is 80ms, add 10ms. */ | 177 | /* Integration time is 80ms, add 10ms. */ |
| 178 | data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000); | 178 | data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000); |
| 179 | data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000); | 179 | data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000); |
| 180 | data->al_scale = 120000; | ||
| 180 | break; | 181 | break; |
| 181 | } | 182 | } |
| 182 | data->vcnl4200_al.last_measurement = ktime_set(0, 0); | 183 | data->vcnl4200_al.last_measurement = ktime_set(0, 0); |
| @@ -72,9 +72,6 @@ static int ni_find_device_routes(const char *device_family, · 71 unmodified lines | |||
| 72 | } | 72 | } |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | if (!rv) | ||
| 76 | return -ENODATA; | ||
| 77 | |||
| 78 | /* Second, find the set of routes valid for this device. */ | 75 | /* Second, find the set of routes valid for this device. */ |
| 79 | for (i = 0; ni_device_routes_list[i]; ++i) { | 76 | for (i = 0; ni_device_routes_list[i]; ++i) { |
| 80 | if (memcmp(ni_device_routes_list[i]->device, board_name, | 77 | if (memcmp(ni_device_routes_list[i]->device, board_name, |
| @@ -84,12 +81,12 @@ static int ni_find_device_routes(const char *device_family, · 3 unmodified lines | |||
| 84 | } | 81 | } |
| 85 | } | 82 | } |
| 86 | 83 | ||
| 87 | if (!dr) | ||
| 88 | return -ENODATA; | ||
| 89 | |||
| 90 | tables->route_values = rv; | 84 | tables->route_values = rv; |
| 91 | tables->valid_routes = dr; | 85 | tables->valid_routes = dr; |
| 92 | 86 | ||
| 87 | if (!rv || !dr) | ||
| 88 | return -ENODATA; | ||
| 89 | |||
| 93 | return 0; | 90 | return 0; |
| 94 | } | 91 | } |
| 95 | 92 | ||
| @@ -487,6 +484,9 @@ int ni_find_route_source(const u8 src_sel_reg_value, int dest, · 391 unmodified lines | |||
| 487 | { | 484 | { |
| 488 | int src; | 485 | int src; |
| 489 | 486 | ||
| 487 | if (!tables->route_values) | ||
| 488 | return -EINVAL; | ||
| 489 | |||
| 490 | dest = B(dest); /* subtract NI names offset */ | 490 | dest = B(dest); /* subtract NI names offset */ |
| 491 | /* ensure we are not going to under/over run the route value table */ | 491 | /* ensure we are not going to under/over run the route value table */ |
| 492 | if (dest < 0 || dest >= NI_NUM_NAMES) | 492 | if (dest < 0 || dest >= NI_NUM_NAMES) |