Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

Merge tag 'iio-fixes-for-4.7c' of...

Merge tag 'iio-fixes-for-4.7c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

Third set of fixes for IIO in the 4.7 cycle.

A couple of really old bugs and the results of Mark taking a close look at
some nasty regulator handling.

* ad7266
  - Fix broken regulator handling that won't play well with dummy regulators.
  - Correctly handle and optional regulator.
  - Fix probe deferral for the vref regulator.
* kxsd9
  - Fix a wrong error check that leads to an inability to write or read
  the scale.
* sca3000
  - Fix a wrong error check that leads to an inability to read back the
  sampling frequency.
parents df013212 68b356eb
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -81,7 +81,7 @@ static int kxsd9_write_scale(struct iio_dev *indio_dev, int micro)


	mutex_lock(&st->buf_lock);
	mutex_lock(&st->buf_lock);
	ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
	ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
	if (ret)
	if (ret < 0)
		goto error_ret;
		goto error_ret;
	st->tx[0] = KXSD9_WRITE(KXSD9_REG_CTRL_C);
	st->tx[0] = KXSD9_WRITE(KXSD9_REG_CTRL_C);
	st->tx[1] = (ret & ~KXSD9_FS_MASK) | i;
	st->tx[1] = (ret & ~KXSD9_FS_MASK) | i;
@@ -163,7 +163,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev,
		break;
		break;
	case IIO_CHAN_INFO_SCALE:
	case IIO_CHAN_INFO_SCALE:
		ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
		ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
		if (ret)
		if (ret < 0)
			goto error_ret;
			goto error_ret;
		*val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK];
		*val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK];
		ret = IIO_VAL_INT_PLUS_MICRO;
		ret = IIO_VAL_INT_PLUS_MICRO;
+5 −2
Original line number Original line Diff line number Diff line
@@ -396,8 +396,8 @@ static int ad7266_probe(struct spi_device *spi)


	st = iio_priv(indio_dev);
	st = iio_priv(indio_dev);


	st->reg = devm_regulator_get(&spi->dev, "vref");
	st->reg = devm_regulator_get_optional(&spi->dev, "vref");
	if (!IS_ERR_OR_NULL(st->reg)) {
	if (!IS_ERR(st->reg)) {
		ret = regulator_enable(st->reg);
		ret = regulator_enable(st->reg);
		if (ret)
		if (ret)
			return ret;
			return ret;
@@ -408,6 +408,9 @@ static int ad7266_probe(struct spi_device *spi)


		st->vref_mv = ret / 1000;
		st->vref_mv = ret / 1000;
	} else {
	} else {
		/* Any other error indicates that the regulator does exist */
		if (PTR_ERR(st->reg) != -ENODEV)
			return PTR_ERR(st->reg);
		/* Use internal reference */
		/* Use internal reference */
		st->vref_mv = 2500;
		st->vref_mv = 2500;
	}
	}
+1 −1
Original line number Original line Diff line number Diff line
@@ -594,7 +594,7 @@ static ssize_t sca3000_read_frequency(struct device *dev,
		goto error_ret_mut;
		goto error_ret_mut;
	ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL);
	ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL);
	mutex_unlock(&st->lock);
	mutex_unlock(&st->lock);
	if (ret)
	if (ret < 0)
		goto error_ret;
		goto error_ret;
	val = ret;
	val = ret;
	if (base_freq > 0)
	if (base_freq > 0)