History

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

Linus Torvalds committed 12 years ago

Commit 9911f2e2 parents 3089f54 6b641684 files · +16 −8Browse files

Unified · Split

4 files
  1. drivers/iio/adc/ad799x.c +6 −2
  2. drivers/iio/inkern.c +4 −2
  3. drivers/staging/iio/adc/ad7291.c +2 −2
  4. drivers/staging/tidspbridge/core/tiomap3430.c +4 −2
drivers/iio/adc/ad799x.c+6−2
@@ -427,9 +427,12 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev, · 426 unmodified lines
427427 int ret;
428428 struct ad799x_state *st = iio_priv(indio_dev);
429429
430+ if (val < 0 || val > RES_MASK(chan->scan_type.realbits))
431+ return -EINVAL;
432+
430433 mutex_lock(&indio_dev->mlock);
431434 ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info),
432− val);
435+ val << chan->scan_type.shift);
433436 mutex_unlock(&indio_dev->mlock);
434437
435438 return ret;
@@ -452,7 +455,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev, · 16 unmodified lines
452455 mutex_unlock(&indio_dev->mlock);
453456 if (ret < 0)
454457 return ret;
455− *val = valin;
458+ *val = (valin >> chan->scan_type.shift) &
459+ RES_MASK(chan->scan_type.realbits);
456460
457461 return IIO_VAL_INT;
458462 }
drivers/iio/inkern.c+4−2
@@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, · 182 unmodified lines
183183 else if (name && index >= 0) {
184184 pr_err("ERROR: could not get IIO channel %s:%s(%i)\n",
185185 np->full_name, name ? name : "", index);
186− return chan;
186+ return NULL;
187187 }
188188
189189 /*
@@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, · 3 unmodified lines
193193 */
194194 np = np->parent;
195195 if (np && !of_get_property(np, "io-channel-ranges", NULL))
196− break;
196+ return NULL;
197197 }
198+
198199 return chan;
199200 }
200201
@@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev, · 116 unmodified lines
317318 if (channel != NULL)
318319 return channel;
319320 }
321+
320322 return iio_channel_get_sys(name, channel_name);
321323 }
322324 EXPORT_SYMBOL_GPL(iio_channel_get);
drivers/staging/iio/adc/ad7291.c+2−2
@@ -465,7 +465,7 @@ static int ad7291_probe(struct i2c_client *client, · 464 unmodified lines
465465 struct ad7291_platform_data *pdata = client->dev.platform_data;
466466 struct ad7291_chip_info *chip;
467467 struct iio_dev *indio_dev;
468− int ret = 0;
468+ int ret;
469469
470470 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
471471 if (!indio_dev)
@@ -475,7 +475,7 @@ static int ad7291_probe(struct i2c_client *client, · 3 unmodified lines
475475 if (pdata && pdata->use_external_ref) {
476476 chip->reg = devm_regulator_get(&client->dev, "vref");
477477 if (IS_ERR(chip->reg))
478− return ret;
478+ return PTR_ERR(chip->reg);
479479
480480 ret = regulator_enable(chip->reg);
481481 if (ret)
drivers/staging/tidspbridge/core/tiomap3430.c+4−2
@@ -280,8 +280,10 @@ static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt) · 279 unmodified lines
280280 OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL);
281281
282282 /* Wait until the state has moved to ON */
283− while (*pdata->dsp_prm_read(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST)&
284− OMAP_INTRANSITION_MASK);
283+ while ((*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD,
284+ OMAP2_PM_PWSTST) &
285+ OMAP_INTRANSITION_MASK)
286+ ;
285287 /* Disable Automatic transition */
286288 (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO,
287289 OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t