aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-07-03 22:11:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-07-03 22:11:48 -0400
commit9911f2e1541aacf8f7ef48fd4e35382fdb61ff6c (patch)
treeb38b57fdb8f247605dbcd84f8b378fc78e1d566d
parent3089f54a7928d28645661c2f3d829e3939d60dd3 (diff)
parent6b64168de843b16e96a22f9e98c6afc92ee1da71 (diff)
Merge tag 'staging-3.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver bugfixes from Greg KH: "Nothing major here, just 4 small bugfixes that resolve some issues reported for the IIO (staging and non-staging) and the tidspbridge driver" * tag 'staging-3.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: staging: tidspbridge: fix an erroneous removal of parentheses iio: of_iio_channel_get_by_name() returns non-null pointers for error legs staging: iio/ad7291: fix error code in ad7291_probe() iio:adc:ad799x: Fix reading and writing of event values, apply shift
-rw-r--r--drivers/iio/adc/ad799x.c8
-rw-r--r--drivers/iio/inkern.c6
-rw-r--r--drivers/staging/iio/adc/ad7291.c4
-rw-r--r--drivers/staging/tidspbridge/core/tiomap3430.c6
4 files changed, 16 insertions, 8 deletions
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index 39b4cb48d738..6eba301ee03d 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -427,9 +427,12 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev,
427 int ret; 427 int ret;
428 struct ad799x_state *st = iio_priv(indio_dev); 428 struct ad799x_state *st = iio_priv(indio_dev);
429 429
430 if (val < 0 || val > RES_MASK(chan->scan_type.realbits))
431 return -EINVAL;
432
430 mutex_lock(&indio_dev->mlock); 433 mutex_lock(&indio_dev->mlock);
431 ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), 434 ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info),
432 val); 435 val << chan->scan_type.shift);
433 mutex_unlock(&indio_dev->mlock); 436 mutex_unlock(&indio_dev->mlock);
434 437
435 return ret; 438 return ret;
@@ -452,7 +455,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev,
452 mutex_unlock(&indio_dev->mlock); 455 mutex_unlock(&indio_dev->mlock);
453 if (ret < 0) 456 if (ret < 0)
454 return ret; 457 return ret;
455 *val = valin; 458 *val = (valin >> chan->scan_type.shift) &
459 RES_MASK(chan->scan_type.realbits);
456 460
457 return IIO_VAL_INT; 461 return IIO_VAL_INT;
458} 462}
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index d833d55052ea..c7497009d60a 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
183 else if (name && index >= 0) { 183 else if (name && index >= 0) {
184 pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", 184 pr_err("ERROR: could not get IIO channel %s:%s(%i)\n",
185 np->full_name, name ? name : "", index); 185 np->full_name, name ? name : "", index);
186 return chan; 186 return NULL;
187 } 187 }
188 188
189 /* 189 /*
@@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
193 */ 193 */
194 np = np->parent; 194 np = np->parent;
195 if (np && !of_get_property(np, "io-channel-ranges", NULL)) 195 if (np && !of_get_property(np, "io-channel-ranges", NULL))
196 break; 196 return NULL;
197 } 197 }
198
198 return chan; 199 return chan;
199} 200}
200 201
@@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev,
317 if (channel != NULL) 318 if (channel != NULL)
318 return channel; 319 return channel;
319 } 320 }
321
320 return iio_channel_get_sys(name, channel_name); 322 return iio_channel_get_sys(name, channel_name);
321} 323}
322EXPORT_SYMBOL_GPL(iio_channel_get); 324EXPORT_SYMBOL_GPL(iio_channel_get);
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
index 357cef2a6f4c..7194bd138762 100644
--- a/drivers/staging/iio/adc/ad7291.c
+++ b/drivers/staging/iio/adc/ad7291.c
@@ -465,7 +465,7 @@ static int ad7291_probe(struct i2c_client *client,
465 struct ad7291_platform_data *pdata = client->dev.platform_data; 465 struct ad7291_platform_data *pdata = client->dev.platform_data;
466 struct ad7291_chip_info *chip; 466 struct ad7291_chip_info *chip;
467 struct iio_dev *indio_dev; 467 struct iio_dev *indio_dev;
468 int ret = 0; 468 int ret;
469 469
470 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); 470 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
471 if (!indio_dev) 471 if (!indio_dev)
@@ -475,7 +475,7 @@ static int ad7291_probe(struct i2c_client *client,
475 if (pdata && pdata->use_external_ref) { 475 if (pdata && pdata->use_external_ref) {
476 chip->reg = devm_regulator_get(&client->dev, "vref"); 476 chip->reg = devm_regulator_get(&client->dev, "vref");
477 if (IS_ERR(chip->reg)) 477 if (IS_ERR(chip->reg))
478 return ret; 478 return PTR_ERR(chip->reg);
479 479
480 ret = regulator_enable(chip->reg); 480 ret = regulator_enable(chip->reg);
481 if (ret) 481 if (ret)
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c
index 8945b4e3a2a6..cb50120ed7b5 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -280,8 +280,10 @@ static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt)
280 OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); 280 OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL);
281 281
282 /* Wait until the state has moved to ON */ 282 /* Wait until the state has moved to ON */
283 while (*pdata->dsp_prm_read(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST)& 283 while ((*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD,
284 OMAP_INTRANSITION_MASK); 284 OMAP2_PM_PWSTST) &
285 OMAP_INTRANSITION_MASK)
286 ;
285 /* Disable Automatic transition */ 287 /* Disable Automatic transition */
286 (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, 288 (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO,
287 OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); 289 OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL);