Skip to content

Commit

Permalink
staging: iio: ad7780: move regulator to after GPIO init
Browse files Browse the repository at this point in the history
To maintain consistency between ad7780_probe and ad7780_remove orders,
regulator initialization has been moved to after GPIO initializations.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Renato Lui Geh authored and Jonathan Cameron committed Apr 4, 2019
1 parent 4812a14 commit 5bb30e7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/staging/iio/adc/ad7780.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,6 @@ static int ad7780_probe(struct spi_device *spi)

ad_sd_init(&st->sd, indio_dev, spi, &ad7780_sigma_delta_info);

st->reg = devm_regulator_get(&spi->dev, "avdd");
if (IS_ERR(st->reg))
return PTR_ERR(st->reg);

ret = regulator_enable(st->reg);
if (ret) {
dev_err(&spi->dev, "Failed to enable specified AVdd supply\n");
return ret;
}

st->chip_info =
&ad7780_chip_info_tbl[spi_get_device_id(spi)->driver_data];

Expand All @@ -321,6 +311,16 @@ static int ad7780_probe(struct spi_device *spi)
if (ret)
goto error_cleanup_buffer_and_trigger;

st->reg = devm_regulator_get(&spi->dev, "avdd");
if (IS_ERR(st->reg))
return PTR_ERR(st->reg);

ret = regulator_enable(st->reg);
if (ret) {
dev_err(&spi->dev, "Failed to enable specified AVdd supply\n");
return ret;
}

ret = ad_sd_setup_buffer_and_trigger(indio_dev);
if (ret)
goto error_disable_reg;
Expand Down

0 comments on commit 5bb30e7

Please sign in to comment.