diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-03 14:37:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-03 14:37:57 -0400 |
commit | 751144271f4b63d5de9005ea4e5e6e5c7c6fd629 (patch) | |
tree | 2e5cb8223d4f6146f01f123a9f33cf6d468205c6 /drivers/iio/dac/ad5791.c | |
parent | 542a086ac72fb193cbc1b996963a572269e57743 (diff) | |
parent | 91121c103ae93ef117e58712786864270d7f488e (diff) |
Merge tag 'staging-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree merge from Greg KH:
"Here's the bit staging tree pull request for 3.12-rc1.
Lots of staging driver updates, and fixes. Lustre is finally enabled
in the build, and lots of cleanup started happening in it. There's a
new wireless driver in here, and 2 new TTY drivers, which cause the
overall lines added/removed to be quite large on the "added" side.
The IIO driver updates are also coming through here, as they are tied
to the staging iio drivers"
* tag 'staging-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (942 commits)
staging: dwc2: make dwc2_core_params documentation more complete
staging: dwc2: validate the value for phy_utmi_width
staging: dwc2: interpret all hwcfg and related register at init time
staging: dwc2: properly mask the GRXFSIZ register
staging: dwc2: remove redundant register reads
staging: dwc2: re-use hptxfsiz variable
staging: dwc2: simplify debug output in dwc_hc_init
staging: dwc2: add missing shift
staging: dwc2: simplify register shift expressions
staging: dwc2: only read the snpsid register once
staging: dwc2: unshift non-bool register value constants
staging: dwc2: fix off-by-one in check for max_packet_count parameter
staging: dwc2: remove specific fifo size constants
Staging:BCM:DDRInit.c:Renaming __FUNCTION__
staging: bcm: remove Version.h file.
staging: rtl8188eu: off by one in rtw_set_802_11_add_wep()
staging: r8188eu: copying one byte too much
staging: rtl8188eu: || vs && typo
staging: r8188eu: off by one bugs
staging: crystalhd: Resolve sparse 'different base types' warnings.
...
Diffstat (limited to 'drivers/iio/dac/ad5791.c')
-rw-r--r-- | drivers/iio/dac/ad5791.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c index 97c1e5d780df..ce7458963309 100644 --- a/drivers/iio/dac/ad5791.c +++ b/drivers/iio/dac/ad5791.c | |||
@@ -349,17 +349,15 @@ static int ad5791_probe(struct spi_device *spi) | |||
349 | struct ad5791_state *st; | 349 | struct ad5791_state *st; |
350 | int ret, pos_voltage_uv = 0, neg_voltage_uv = 0; | 350 | int ret, pos_voltage_uv = 0, neg_voltage_uv = 0; |
351 | 351 | ||
352 | indio_dev = iio_device_alloc(sizeof(*st)); | 352 | indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); |
353 | if (indio_dev == NULL) { | 353 | if (!indio_dev) |
354 | ret = -ENOMEM; | 354 | return -ENOMEM; |
355 | goto error_ret; | ||
356 | } | ||
357 | st = iio_priv(indio_dev); | 355 | st = iio_priv(indio_dev); |
358 | st->reg_vdd = regulator_get(&spi->dev, "vdd"); | 356 | st->reg_vdd = devm_regulator_get(&spi->dev, "vdd"); |
359 | if (!IS_ERR(st->reg_vdd)) { | 357 | if (!IS_ERR(st->reg_vdd)) { |
360 | ret = regulator_enable(st->reg_vdd); | 358 | ret = regulator_enable(st->reg_vdd); |
361 | if (ret) | 359 | if (ret) |
362 | goto error_put_reg_pos; | 360 | return ret; |
363 | 361 | ||
364 | ret = regulator_get_voltage(st->reg_vdd); | 362 | ret = regulator_get_voltage(st->reg_vdd); |
365 | if (ret < 0) | 363 | if (ret < 0) |
@@ -368,11 +366,11 @@ static int ad5791_probe(struct spi_device *spi) | |||
368 | pos_voltage_uv = ret; | 366 | pos_voltage_uv = ret; |
369 | } | 367 | } |
370 | 368 | ||
371 | st->reg_vss = regulator_get(&spi->dev, "vss"); | 369 | st->reg_vss = devm_regulator_get(&spi->dev, "vss"); |
372 | if (!IS_ERR(st->reg_vss)) { | 370 | if (!IS_ERR(st->reg_vss)) { |
373 | ret = regulator_enable(st->reg_vss); | 371 | ret = regulator_enable(st->reg_vss); |
374 | if (ret) | 372 | if (ret) |
375 | goto error_put_reg_neg; | 373 | goto error_disable_reg_pos; |
376 | 374 | ||
377 | ret = regulator_get_voltage(st->reg_vss); | 375 | ret = regulator_get_voltage(st->reg_vss); |
378 | if (ret < 0) | 376 | if (ret < 0) |
@@ -428,19 +426,9 @@ static int ad5791_probe(struct spi_device *spi) | |||
428 | error_disable_reg_neg: | 426 | error_disable_reg_neg: |
429 | if (!IS_ERR(st->reg_vss)) | 427 | if (!IS_ERR(st->reg_vss)) |
430 | regulator_disable(st->reg_vss); | 428 | regulator_disable(st->reg_vss); |
431 | error_put_reg_neg: | ||
432 | if (!IS_ERR(st->reg_vss)) | ||
433 | regulator_put(st->reg_vss); | ||
434 | |||
435 | error_disable_reg_pos: | 429 | error_disable_reg_pos: |
436 | if (!IS_ERR(st->reg_vdd)) | 430 | if (!IS_ERR(st->reg_vdd)) |
437 | regulator_disable(st->reg_vdd); | 431 | regulator_disable(st->reg_vdd); |
438 | error_put_reg_pos: | ||
439 | if (!IS_ERR(st->reg_vdd)) | ||
440 | regulator_put(st->reg_vdd); | ||
441 | iio_device_free(indio_dev); | ||
442 | error_ret: | ||
443 | |||
444 | return ret; | 432 | return ret; |
445 | } | 433 | } |
446 | 434 | ||
@@ -450,16 +438,11 @@ static int ad5791_remove(struct spi_device *spi) | |||
450 | struct ad5791_state *st = iio_priv(indio_dev); | 438 | struct ad5791_state *st = iio_priv(indio_dev); |
451 | 439 | ||
452 | iio_device_unregister(indio_dev); | 440 | iio_device_unregister(indio_dev); |
453 | if (!IS_ERR(st->reg_vdd)) { | 441 | if (!IS_ERR(st->reg_vdd)) |
454 | regulator_disable(st->reg_vdd); | 442 | regulator_disable(st->reg_vdd); |
455 | regulator_put(st->reg_vdd); | ||
456 | } | ||
457 | 443 | ||
458 | if (!IS_ERR(st->reg_vss)) { | 444 | if (!IS_ERR(st->reg_vss)) |
459 | regulator_disable(st->reg_vss); | 445 | regulator_disable(st->reg_vss); |
460 | regulator_put(st->reg_vss); | ||
461 | } | ||
462 | iio_device_free(indio_dev); | ||
463 | 446 | ||
464 | return 0; | 447 | return 0; |
465 | } | 448 | } |