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. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABAgAGBQJTsCLrAAoJEFSFNJnE9BaI0VYQAKLnNrpueb63Yuh+GHg0Qpps 8sOUzPYf3x4NYHoQ4iI/ZTMVRneY1tO9AdweTnHlDJrtUnzBvpi53ctxu5dG0e+P FvarQ7cMni0lWumC9VeBMaBZclT6ReyWEpQQKfPI+EeCaatlBtgzfe76SpRqSaMc 9lSwFTVCU0S3wSWIfa24rLTt0YPmNfLe31htjoY7nqdi2FRGTeARySCaIR9KAMmt uZDcFNcZ0b5FvO8EZIXzp0Y9GqkLqjYeBMeuduOAIB/ukgTKV4z41vZG/zAy034O EE0XTp1wyR1sHAk2xnYzAd8kpCsqGHYxJc287MsgQAfS1nuayzRByraxA+7XhLIy kWHT8qXT3OvQ39iq/xQH2xL3V3NGXF/h+apRlEdNOnXDP8xVTI4ue4IdoiLNG4z0 UdybXjJshsWUOWZS6sVITPmj2RCnTqoPsO+fJRHA0Ws9sGDFpM+B1D3SONudfU/a I3B7C3rJfGdONS99sDqq0i+cyTe5LzSl1Yb9es+iUfrtQ7NVmX1jbtT33wgTzgqZ mbf0PBr+QWCS6KeWVl7zUJDv1iN7m0jX8gfjWHdWRWDJMriM2d23O4YLXjR7nMYM uOr80Tg1yHPs9uAv3Qfa0iG2ippZ68M0dEKbButDbwg2ex1tmghnR3qjGag+Yeme dxnW1PLYQpGQaEilYByZ =a4UI -----END PGP SIGNATURE----- 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.
This commit is contained in:
commit
6b64168de8
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user