Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'iio-fixes-for-6.19a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus

Jonathan writes:

IIO: 1st set of fixes for the 6.19 cycle

The usual mixed bag of fixes for ancient problems plus some more
recent ones.

adi,ad7280a
- Check for errors from spi_setup().
adi,ad3552r
- Fix potential buffer overflow when setting to use the internal ramp.
adi,ax5695r
- Fill in the data for this device in the chip info table.
adi,ad7606
- Don't store a negative error in an unsigned int.
adi,ad9467
- Fix incorrect register mask value.
adi,adxl380
- Fix inverted condition for whether INT1 interrupt present in dt.
atmel,at91-sama5d2
- Cancel work on remove to avoid a potential use-after-free
invensense,icm45600
- Fix temperature scaling.
samsung,eynos_adc
- Use of_platform_depolulate() to correctly clear up such that child
devices are created correctly if the driver is rebound.
sensiron,scd4x
- Fix incorrect endianness reported to user-space.
st,accel
- Fix gain reported for the iis329dq.
st,lsm6dsx
- Hide event related interfaces on parts that don't support events.
ti,pac1934
- Ensure output of clamp() is used rather than unclamped value.

* tag 'iio-fixes-for-6.19a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
iio: dac: ad3552r-hs: fix out-of-bound write in ad3552r_hs_write_data_source
iio: accel: iis328dq: fix gain values
iio: core: add separate lockdep class for info_exist_lock
iio: chemical: scd4x: fix reported channel endianness
iio: imu: inv_icm45600: fix temperature offset reporting
iio: adc: exynos_adc: fix OF populate on driver rebind
iio: dac: ad5686: add AD5695R to ad5686_chip_info_tbl
iio: accel: adxl380: fix handling of unavailable "INT1" interrupt
iio: imu: st_lsm6dsx: fix iio_chan_spec for sensors without event detection
iio: adc: pac1934: Fix clamped value in pac1934_reg_snapshot
iio: adc: ad9467: fix ad9434 vref mask
iio: adc: ad7606: Fix incorrect type for error return variable
iio: adc: ad7280a: handle spi_setup() errors in probe()
iio: adc: at91-sama5d2_adc: Fix potential use-after-free in sama5d2_adc driver

+120 -36
+3 -3
drivers/iio/accel/adxl380.c
··· 1784 1784 st->int_map[1] = ADXL380_INT0_MAP1_REG; 1785 1785 } else { 1786 1786 st->irq = fwnode_irq_get_byname(dev_fwnode(st->dev), "INT1"); 1787 - if (st->irq > 0) 1788 - return dev_err_probe(st->dev, -ENODEV, 1789 - "no interrupt name specified"); 1787 + if (st->irq < 0) 1788 + return dev_err_probe(st->dev, st->irq, 1789 + "no interrupt name specified\n"); 1790 1790 st->int_map[0] = ADXL380_INT1_MAP0_REG; 1791 1791 st->int_map[1] = ADXL380_INT1_MAP1_REG; 1792 1792 }
+71 -1
drivers/iio/accel/st_accel_core.c
··· 517 517 .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, 518 518 .sensors_supported = { 519 519 [0] = H3LIS331DL_ACCEL_DEV_NAME, 520 - [1] = IIS328DQ_ACCEL_DEV_NAME, 521 520 }, 522 521 .ch = (struct iio_chan_spec *)st_accel_12bit_channels, 523 522 .odr = { ··· 557 558 .num = ST_ACCEL_FS_AVL_400G, 558 559 .value = 0x03, 559 560 .gain = IIO_G_TO_M_S_2(195000), 561 + }, 562 + }, 563 + }, 564 + .bdu = { 565 + .addr = 0x23, 566 + .mask = 0x80, 567 + }, 568 + .drdy_irq = { 569 + .int1 = { 570 + .addr = 0x22, 571 + .mask = 0x02, 572 + }, 573 + .int2 = { 574 + .addr = 0x22, 575 + .mask = 0x10, 576 + }, 577 + .addr_ihl = 0x22, 578 + .mask_ihl = 0x80, 579 + }, 580 + .sim = { 581 + .addr = 0x23, 582 + .value = BIT(0), 583 + }, 584 + .multi_read_bit = true, 585 + .bootime = 2, 586 + }, 587 + { 588 + .wai = 0x32, 589 + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, 590 + .sensors_supported = { 591 + [0] = IIS328DQ_ACCEL_DEV_NAME, 592 + }, 593 + .ch = (struct iio_chan_spec *)st_accel_12bit_channels, 594 + .odr = { 595 + .addr = 0x20, 596 + .mask = 0x18, 597 + .odr_avl = { 598 + { .hz = 50, .value = 0x00, }, 599 + { .hz = 100, .value = 0x01, }, 600 + { .hz = 400, .value = 0x02, }, 601 + { .hz = 1000, .value = 0x03, }, 602 + }, 603 + }, 604 + .pw = { 605 + .addr = 0x20, 606 + .mask = 0x20, 607 + .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE, 608 + .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, 609 + }, 610 + .enable_axis = { 611 + .addr = ST_SENSORS_DEFAULT_AXIS_ADDR, 612 + .mask = ST_SENSORS_DEFAULT_AXIS_MASK, 613 + }, 614 + .fs = { 615 + .addr = 0x23, 616 + .mask = 0x30, 617 + .fs_avl = { 618 + [0] = { 619 + .num = ST_ACCEL_FS_AVL_100G, 620 + .value = 0x00, 621 + .gain = IIO_G_TO_M_S_2(980), 622 + }, 623 + [1] = { 624 + .num = ST_ACCEL_FS_AVL_200G, 625 + .value = 0x01, 626 + .gain = IIO_G_TO_M_S_2(1950), 627 + }, 628 + [2] = { 629 + .num = ST_ACCEL_FS_AVL_400G, 630 + .value = 0x03, 631 + .gain = IIO_G_TO_M_S_2(3910), 560 632 }, 561 633 }, 562 634 },
+3 -1
drivers/iio/adc/ad7280a.c
··· 1024 1024 1025 1025 st->spi->max_speed_hz = AD7280A_MAX_SPI_CLK_HZ; 1026 1026 st->spi->mode = SPI_MODE_1; 1027 - spi_setup(st->spi); 1027 + ret = spi_setup(st->spi); 1028 + if (ret < 0) 1029 + return ret; 1028 1030 1029 1031 st->ctrl_lb = FIELD_PREP(AD7280A_CTRL_LB_ACQ_TIME_MSK, st->acquisition_time) | 1030 1032 FIELD_PREP(AD7280A_CTRL_LB_THERMISTOR_MSK, st->thermistor_term_en);
+2 -1
drivers/iio/adc/ad7606_par.c
··· 43 43 struct iio_dev *indio_dev) 44 44 { 45 45 struct ad7606_state *st = iio_priv(indio_dev); 46 - unsigned int ret, c; 46 + unsigned int c; 47 + int ret; 47 48 struct iio_backend_data_fmt data = { 48 49 .sign_extend = true, 49 50 .enable = true,
+1 -1
drivers/iio/adc/ad9467.c
··· 95 95 96 96 #define CHIPID_AD9434 0x6A 97 97 #define AD9434_DEF_OUTPUT_MODE 0x00 98 - #define AD9434_REG_VREF_MASK 0xC0 98 + #define AD9434_REG_VREF_MASK GENMASK(4, 0) 99 99 100 100 /* 101 101 * Analog Devices AD9467 16-Bit, 200/250 MSPS ADC
+1
drivers/iio/adc/at91-sama5d2_adc.c
··· 2481 2481 struct at91_adc_state *st = iio_priv(indio_dev); 2482 2482 2483 2483 iio_device_unregister(indio_dev); 2484 + cancel_work_sync(&st->touch_st.workq); 2484 2485 2485 2486 at91_adc_dma_disable(st); 2486 2487
+2 -13
drivers/iio/adc/exynos_adc.c
··· 540 540 ADC_CHANNEL(9, "adc9"), 541 541 }; 542 542 543 - static int exynos_adc_remove_devices(struct device *dev, void *c) 544 - { 545 - struct platform_device *pdev = to_platform_device(dev); 546 - 547 - platform_device_unregister(pdev); 548 - 549 - return 0; 550 - } 551 - 552 543 static int exynos_adc_probe(struct platform_device *pdev) 553 544 { 554 545 struct exynos_adc *info = NULL; ··· 651 660 return 0; 652 661 653 662 err_of_populate: 654 - device_for_each_child(&indio_dev->dev, NULL, 655 - exynos_adc_remove_devices); 663 + of_platform_depopulate(&indio_dev->dev); 656 664 iio_device_unregister(indio_dev); 657 665 err_irq: 658 666 free_irq(info->irq, info); ··· 671 681 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 672 682 struct exynos_adc *info = iio_priv(indio_dev); 673 683 674 - device_for_each_child(&indio_dev->dev, NULL, 675 - exynos_adc_remove_devices); 684 + of_platform_depopulate(&indio_dev->dev); 676 685 iio_device_unregister(indio_dev); 677 686 free_irq(info->irq, info); 678 687 if (info->data->exit_hw)
+3 -3
drivers/iio/adc/pac1934.c
··· 665 665 /* add the power_acc field */ 666 666 curr_energy += inc; 667 667 668 - clamp(curr_energy, PAC_193X_MIN_POWER_ACC, PAC_193X_MAX_POWER_ACC); 669 - 670 - reg_data->energy_sec_acc[cnt] = curr_energy; 668 + reg_data->energy_sec_acc[cnt] = clamp(curr_energy, 669 + PAC_193X_MIN_POWER_ACC, 670 + PAC_193X_MAX_POWER_ACC); 671 671 } 672 672 673 673 offset_reg_data_p += PAC1934_VPOWER_ACC_REG_LEN;
+3 -3
drivers/iio/chemical/scd4x.c
··· 584 584 .sign = 'u', 585 585 .realbits = 16, 586 586 .storagebits = 16, 587 - .endianness = IIO_BE, 587 + .endianness = IIO_CPU, 588 588 }, 589 589 }, 590 590 { ··· 599 599 .sign = 'u', 600 600 .realbits = 16, 601 601 .storagebits = 16, 602 - .endianness = IIO_BE, 602 + .endianness = IIO_CPU, 603 603 }, 604 604 }, 605 605 { ··· 612 612 .sign = 'u', 613 613 .realbits = 16, 614 614 .storagebits = 16, 615 - .endianness = IIO_BE, 615 + .endianness = IIO_CPU, 616 616 }, 617 617 }, 618 618 };
+4 -1
drivers/iio/dac/ad3552r-hs.c
··· 549 549 550 550 guard(mutex)(&st->lock); 551 551 552 + if (count >= sizeof(buf)) 553 + return -ENOSPC; 554 + 552 555 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, userbuf, 553 556 count); 554 557 if (ret < 0) 555 558 return ret; 556 559 557 - buf[count] = '\0'; 560 + buf[ret] = '\0'; 558 561 559 562 ret = match_string(dbgfs_attr_source, ARRAY_SIZE(dbgfs_attr_source), 560 563 buf);
+6
drivers/iio/dac/ad5686.c
··· 434 434 .num_channels = 4, 435 435 .regmap_type = AD5686_REGMAP, 436 436 }, 437 + [ID_AD5695R] = { 438 + .channels = ad5685r_channels, 439 + .int_vref_mv = 2500, 440 + .num_channels = 4, 441 + .regmap_type = AD5686_REGMAP, 442 + }, 437 443 [ID_AD5696] = { 438 444 .channels = ad5686_channels, 439 445 .num_channels = 4,
+5 -4
drivers/iio/imu/inv_icm45600/inv_icm45600_core.c
··· 960 960 return IIO_VAL_INT; 961 961 /* 962 962 * T°C = (temp / 128) + 25 963 - * Tm°C = 1000 * ((temp * 100 / 12800) + 25) 964 - * scale: 100000 / 13248 = 7.8125 965 - * offset: 25000 963 + * Tm°C = ((temp + 25 * 128) / 128)) * 1000 964 + * Tm°C = (temp + 3200) * (1000 / 128) 965 + * scale: 1000 / 128 = 7.8125 966 + * offset: 3200 966 967 */ 967 968 case IIO_CHAN_INFO_SCALE: 968 969 *val = 7; 969 970 *val2 = 812500; 970 971 return IIO_VAL_INT_PLUS_MICRO; 971 972 case IIO_CHAN_INFO_OFFSET: 972 - *val = 25000; 973 + *val = 3200; 973 974 return IIO_VAL_INT; 974 975 default: 975 976 return -EINVAL;
+11 -4
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
··· 101 101 IIO_CHAN_SOFT_TIMESTAMP(3), 102 102 }; 103 103 104 + static const struct iio_chan_spec st_lsm6ds0_acc_channels[] = { 105 + ST_LSM6DSX_CHANNEL(IIO_ACCEL, 0x28, IIO_MOD_X, 0), 106 + ST_LSM6DSX_CHANNEL(IIO_ACCEL, 0x2a, IIO_MOD_Y, 1), 107 + ST_LSM6DSX_CHANNEL(IIO_ACCEL, 0x2c, IIO_MOD_Z, 2), 108 + IIO_CHAN_SOFT_TIMESTAMP(3), 109 + }; 110 + 104 111 static const struct iio_chan_spec st_lsm6dsx_gyro_channels[] = { 105 112 ST_LSM6DSX_CHANNEL(IIO_ANGL_VEL, 0x22, IIO_MOD_X, 0), 106 113 ST_LSM6DSX_CHANNEL(IIO_ANGL_VEL, 0x24, IIO_MOD_Y, 1), ··· 149 142 }, 150 143 .channels = { 151 144 [ST_LSM6DSX_ID_ACC] = { 152 - .chan = st_lsm6dsx_acc_channels, 153 - .len = ARRAY_SIZE(st_lsm6dsx_acc_channels), 145 + .chan = st_lsm6ds0_acc_channels, 146 + .len = ARRAY_SIZE(st_lsm6ds0_acc_channels), 154 147 }, 155 148 [ST_LSM6DSX_ID_GYRO] = { 156 149 .chan = st_lsm6ds0_gyro_channels, ··· 1456 1449 }, 1457 1450 .channels = { 1458 1451 [ST_LSM6DSX_ID_ACC] = { 1459 - .chan = st_lsm6dsx_acc_channels, 1460 - .len = ARRAY_SIZE(st_lsm6dsx_acc_channels), 1452 + .chan = st_lsm6ds0_acc_channels, 1453 + .len = ARRAY_SIZE(st_lsm6ds0_acc_channels), 1461 1454 }, 1462 1455 [ST_LSM6DSX_ID_GYRO] = { 1463 1456 .chan = st_lsm6dsx_gyro_channels,
+3 -1
drivers/iio/industrialio-core.c
··· 1657 1657 mutex_destroy(&iio_dev_opaque->info_exist_lock); 1658 1658 mutex_destroy(&iio_dev_opaque->mlock); 1659 1659 1660 + lockdep_unregister_key(&iio_dev_opaque->info_exist_key); 1660 1661 lockdep_unregister_key(&iio_dev_opaque->mlock_key); 1661 1662 1662 1663 ida_free(&iio_ida, iio_dev_opaque->id); ··· 1718 1717 INIT_LIST_HEAD(&iio_dev_opaque->ioctl_handlers); 1719 1718 1720 1719 lockdep_register_key(&iio_dev_opaque->mlock_key); 1720 + lockdep_register_key(&iio_dev_opaque->info_exist_key); 1721 1721 1722 1722 mutex_init_with_key(&iio_dev_opaque->mlock, &iio_dev_opaque->mlock_key); 1723 - mutex_init(&iio_dev_opaque->info_exist_lock); 1723 + mutex_init_with_key(&iio_dev_opaque->info_exist_lock, &iio_dev_opaque->info_exist_key); 1724 1724 1725 1725 indio_dev->dev.parent = parent; 1726 1726 indio_dev->dev.type = &iio_device_type;
+2
include/linux/iio/iio-opaque.h
··· 14 14 * @mlock: lock used to prevent simultaneous device state changes 15 15 * @mlock_key: lockdep class for iio_dev lock 16 16 * @info_exist_lock: lock to prevent use during removal 17 + * @info_exist_key: lockdep class for info_exist lock 17 18 * @trig_readonly: mark the current trigger immutable 18 19 * @event_interface: event chrdevs associated with interrupt lines 19 20 * @attached_buffers: array of buffers statically attached by the driver ··· 48 47 struct mutex mlock; 49 48 struct lock_class_key mlock_key; 50 49 struct mutex info_exist_lock; 50 + struct lock_class_key info_exist_key; 51 51 bool trig_readonly; 52 52 struct iio_event_interface *event_interface; 53 53 struct iio_buffer **attached_buffers;