Commit 38e9f21f authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'iio-fixes-for-6.1b' of...

Merge tag 'iio-fixes-for-6.1b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus

Jonathan writes:
  "2nd set of IIO fixes for 6.1

   Another mixed bag of driver fixes.
   * atmel,at91-sama5d2
    - Drop a 5 degree offset as not needed for production devices.
    - Missing iio_trigger_free() in error path.
  * bosch,bma400
    - Turn power on before trying to read chip ID.
  * bosch,bno055
    - Avoid uninitialized variable warning (no actual impact)
  * meas,ms5611
    - Fix multiple instances of driver sharing single prom array.
    - Stop forcing SPI speed to max devices supports
  * mps,mp2629
    - Wrong structure field used to match channel.
    - Missing NULL terminator.
  * sysfs-trigger
    - Fix memory leak in error path.
  * tools
    - Fix wrong read size when calling with noevents."

* tag 'iio-fixes-for-6.1b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  tools: iio: iio_generic_buffer: Fix read size
  iio: imu: bno055: uninitialized variable bug in bno055_trigger_handler()
  iio: adc: at91_adc: fix possible memory leak in at91_adc_allocate_trigger()
  iio: adc: mp2629: fix potential array out of bound access
  iio: adc: mp2629: fix wrong comparison of channel
  iio: pressure: ms5611: changed hardcoded SPI speed to value limited
  iio: pressure: ms5611: fixed value compensation bug
  iio: accel: bma400: Ensure VDDIO is enable defore reading the chip ID.
  iio: adc: at91-sama5d2_adc: get rid of 5 degrees Celsius adjustment
  iio: trigger: sysfs: fix possible memory leak in iio_sysfs_trig_init()
parents 30a0b95b 7c919b61
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -869,18 +869,6 @@ static int bma400_init(struct bma400_data *data)
	unsigned int val;
	int ret;

	/* Try to read chip_id register. It must return 0x90. */
	ret = regmap_read(data->regmap, BMA400_CHIP_ID_REG, &val);
	if (ret) {
		dev_err(data->dev, "Failed to read chip id register\n");
		return ret;
	}

	if (val != BMA400_ID_REG_VAL) {
		dev_err(data->dev, "Chip ID mismatch\n");
		return -ENODEV;
	}

	data->regulators[BMA400_VDD_REGULATOR].supply = "vdd";
	data->regulators[BMA400_VDDIO_REGULATOR].supply = "vddio";
	ret = devm_regulator_bulk_get(data->dev,
@@ -906,6 +894,18 @@ static int bma400_init(struct bma400_data *data)
	if (ret)
		return ret;

	/* Try to read chip_id register. It must return 0x90. */
	ret = regmap_read(data->regmap, BMA400_CHIP_ID_REG, &val);
	if (ret) {
		dev_err(data->dev, "Failed to read chip id register\n");
		return ret;
	}

	if (val != BMA400_ID_REG_VAL) {
		dev_err(data->dev, "Chip ID mismatch\n");
		return -ENODEV;
	}

	ret = bma400_get_power_mode(data);
	if (ret) {
		dev_err(data->dev, "Failed to get the initial power-mode\n");
+2 −4
Original line number Diff line number Diff line
@@ -2307,11 +2307,9 @@ static int at91_adc_temp_sensor_init(struct at91_adc_state *st,
	clb->p6 = buf[AT91_ADC_TS_CLB_IDX_P6];

	/*
	 * We prepare here the conversion to milli and also add constant
	 * factor (5 degrees Celsius) to p1 here to avoid doing it on
	 * hotpath.
	 * We prepare here the conversion to milli to avoid doing it on hotpath.
	 */
	clb->p1 = clb->p1 * 1000 + 5000;
	clb->p1 = clb->p1 * 1000;

free_buf:
	kfree(buf);
+3 −1
Original line number Diff line number Diff line
@@ -634,8 +634,10 @@ static struct iio_trigger *at91_adc_allocate_trigger(struct iio_dev *idev,
	trig->ops = &at91_adc_trigger_ops;

	ret = iio_trigger_register(trig);
	if (ret)
	if (ret) {
		iio_trigger_free(trig);
		return NULL;
	}

	return trig;
}
+3 −2
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ static struct iio_map mp2629_adc_maps[] = {
	MP2629_MAP(SYSTEM_VOLT, "system-volt"),
	MP2629_MAP(INPUT_VOLT, "input-volt"),
	MP2629_MAP(BATT_CURRENT, "batt-current"),
	MP2629_MAP(INPUT_CURRENT, "input-current")
	MP2629_MAP(INPUT_CURRENT, "input-current"),
	{ }
};

static int mp2629_read_raw(struct iio_dev *indio_dev,
@@ -74,7 +75,7 @@ static int mp2629_read_raw(struct iio_dev *indio_dev,
		if (ret)
			return ret;

		if (chan->address == MP2629_INPUT_VOLT)
		if (chan->channel == MP2629_INPUT_VOLT)
			rval &= GENMASK(6, 0);
		*val = rval;
		return IIO_VAL_INT;
+1 −1
Original line number Diff line number Diff line
@@ -632,7 +632,7 @@ static int bno055_set_regmask(struct bno055_priv *priv, int val, int val2,
			return -EINVAL;
		}
		delta = abs(tbl_val - req_val);
		if (delta < best_delta || first) {
		if (first || delta < best_delta) {
			best_delta = delta;
			hwval = i;
			first = false;
Loading