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