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

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

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

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

Jonathan writes:

Second set of IIO fixes for the 3.16 cycle.

* A fix for a bug in setting threshold levels within the ad799x driver
  which prevents correct setting of the thresholds.
* In ad7291 fix an case where a ERR_PTR value was returned directly
  instead of having PTR_ERR applied.  Hence it would report success
  instead of failure.
* of_iio_channel_get_by_name returned a non null pointer if it fails
  and the callee was expecting NULL to indicate failure.  Fixed by
  returning NULL in the error cases.
parents ff4f58f0 a2c12493
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -427,9 +427,12 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev,
	int ret;
	struct ad799x_state *st = iio_priv(indio_dev);

	if (val < 0 || val > RES_MASK(chan->scan_type.realbits))
		return -EINVAL;

	mutex_lock(&indio_dev->mlock);
	ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info),
		val);
		val << chan->scan_type.shift);
	mutex_unlock(&indio_dev->mlock);

	return ret;
@@ -452,7 +455,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev,
	mutex_unlock(&indio_dev->mlock);
	if (ret < 0)
		return ret;
	*val = valin;
	*val = (valin >> chan->scan_type.shift) &
		RES_MASK(chan->scan_type.realbits);

	return IIO_VAL_INT;
}
+4 −2
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
		else if (name && index >= 0) {
			pr_err("ERROR: could not get IIO channel %s:%s(%i)\n",
				np->full_name, name ? name : "", index);
			return chan;
			return NULL;
		}

		/*
@@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
		 */
		np = np->parent;
		if (np && !of_get_property(np, "io-channel-ranges", NULL))
			break;
			return NULL;
	}

	return chan;
}

@@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev,
		if (channel != NULL)
			return channel;
	}

	return iio_channel_get_sys(name, channel_name);
}
EXPORT_SYMBOL_GPL(iio_channel_get);
+2 −2
Original line number Diff line number Diff line
@@ -465,7 +465,7 @@ static int ad7291_probe(struct i2c_client *client,
	struct ad7291_platform_data *pdata = client->dev.platform_data;
	struct ad7291_chip_info *chip;
	struct iio_dev *indio_dev;
	int ret = 0;
	int ret;

	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
	if (!indio_dev)
@@ -475,7 +475,7 @@ static int ad7291_probe(struct i2c_client *client,
	if (pdata && pdata->use_external_ref) {
		chip->reg = devm_regulator_get(&client->dev, "vref");
		if (IS_ERR(chip->reg))
			return ret;
			return PTR_ERR(chip->reg);

		ret = regulator_enable(chip->reg);
		if (ret)