lkml.org 
[lkml]   [2023]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/4] iio: dac: mcp4922: get and enable vdd regulator
From
On 4/5/23 07:01, Nicolas Frattaroli wrote:
> [...]
> + state->vdd_reg = devm_regulator_get(&spi->dev, "vdd");
> + if (IS_ERR(state->vdd_reg)) {
> + ret = dev_err_probe(&spi->dev, PTR_ERR(state->vdd_reg),
> + "vdd regulator not specified\n");
> + goto error_disable_vref_reg;
> + }
> + ret = regulator_enable(state->vdd_reg);
> + if (ret) {
> + dev_err(&spi->dev, "Failed to enable vdd regulator: %d\n",
> + ret);
> + goto error_disable_vref_reg;
> + }
The two above can be combined into `devm_regulator_get_enable()`. This
will also take care of automatically disabling the regulator on the
error path and on remove.
> +
> spi_set_drvdata(spi, indio_dev);
> id = spi_get_device_id(spi);
> indio_dev->info = &mcp4922_info;
> [...]


\
 
 \ /
  Last update: 2023-04-05 16:27    [W:0.088 / U:2.988 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site