aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/dac/ad5764.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-03 14:37:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-03 14:37:57 -0400
commit751144271f4b63d5de9005ea4e5e6e5c7c6fd629 (patch)
tree2e5cb8223d4f6146f01f123a9f33cf6d468205c6 /drivers/iio/dac/ad5764.c
parent542a086ac72fb193cbc1b996963a572269e57743 (diff)
parent91121c103ae93ef117e58712786864270d7f488e (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/ad5764.c')
-rw-r--r--drivers/iio/dac/ad5764.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/iio/dac/ad5764.c b/drivers/iio/dac/ad5764.c
index 7a53f7d70dac..df7e028d9db5 100644
--- a/drivers/iio/dac/ad5764.c
+++ b/drivers/iio/dac/ad5764.c
@@ -275,7 +275,7 @@ static int ad5764_probe(struct spi_device *spi)
275 struct ad5764_state *st; 275 struct ad5764_state *st;
276 int ret; 276 int ret;
277 277
278 indio_dev = iio_device_alloc(sizeof(*st)); 278 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
279 if (indio_dev == NULL) { 279 if (indio_dev == NULL) {
280 dev_err(&spi->dev, "Failed to allocate iio device\n"); 280 dev_err(&spi->dev, "Failed to allocate iio device\n");
281 return -ENOMEM; 281 return -ENOMEM;
@@ -298,12 +298,12 @@ static int ad5764_probe(struct spi_device *spi)
298 st->vref_reg[0].supply = "vrefAB"; 298 st->vref_reg[0].supply = "vrefAB";
299 st->vref_reg[1].supply = "vrefCD"; 299 st->vref_reg[1].supply = "vrefCD";
300 300
301 ret = regulator_bulk_get(&st->spi->dev, 301 ret = devm_regulator_bulk_get(&st->spi->dev,
302 ARRAY_SIZE(st->vref_reg), st->vref_reg); 302 ARRAY_SIZE(st->vref_reg), st->vref_reg);
303 if (ret) { 303 if (ret) {
304 dev_err(&spi->dev, "Failed to request vref regulators: %d\n", 304 dev_err(&spi->dev, "Failed to request vref regulators: %d\n",
305 ret); 305 ret);
306 goto error_free; 306 return ret;
307 } 307 }
308 308
309 ret = regulator_bulk_enable(ARRAY_SIZE(st->vref_reg), 309 ret = regulator_bulk_enable(ARRAY_SIZE(st->vref_reg),
@@ -311,7 +311,7 @@ static int ad5764_probe(struct spi_device *spi)
311 if (ret) { 311 if (ret) {
312 dev_err(&spi->dev, "Failed to enable vref regulators: %d\n", 312 dev_err(&spi->dev, "Failed to enable vref regulators: %d\n",
313 ret); 313 ret);
314 goto error_free_reg; 314 return ret;
315 } 315 }
316 } 316 }
317 317
@@ -326,12 +326,6 @@ static int ad5764_probe(struct spi_device *spi)
326error_disable_reg: 326error_disable_reg:
327 if (st->chip_info->int_vref == 0) 327 if (st->chip_info->int_vref == 0)
328 regulator_bulk_disable(ARRAY_SIZE(st->vref_reg), st->vref_reg); 328 regulator_bulk_disable(ARRAY_SIZE(st->vref_reg), st->vref_reg);
329error_free_reg:
330 if (st->chip_info->int_vref == 0)
331 regulator_bulk_free(ARRAY_SIZE(st->vref_reg), st->vref_reg);
332error_free:
333 iio_device_free(indio_dev);
334
335 return ret; 329 return ret;
336} 330}
337 331
@@ -342,12 +336,8 @@ static int ad5764_remove(struct spi_device *spi)
342 336
343 iio_device_unregister(indio_dev); 337 iio_device_unregister(indio_dev);
344 338
345 if (st->chip_info->int_vref == 0) { 339 if (st->chip_info->int_vref == 0)
346 regulator_bulk_disable(ARRAY_SIZE(st->vref_reg), st->vref_reg); 340 regulator_bulk_disable(ARRAY_SIZE(st->vref_reg), st->vref_reg);
347 regulator_bulk_free(ARRAY_SIZE(st->vref_reg), st->vref_reg);
348 }
349
350 iio_device_free(indio_dev);
351 341
352 return 0; 342 return 0;
353} 343}