[v4,2/4] iio: adc: mcp3911: simplify usage of spi->dev in probe function
Commit Message
Replace the usage of adc->spi->dev with spi->dev to make the code prettier.
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
Notes:
v4:
- New patch in this series
drivers/iio/adc/mcp3911.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
@@ -477,12 +477,12 @@ static int mcp3911_probe(struct spi_device *spi)
adc = iio_priv(indio_dev);
adc->spi = spi;
- adc->vref = devm_regulator_get_optional(&adc->spi->dev, "vref");
+ adc->vref = devm_regulator_get_optional(&spi->dev, "vref");
if (IS_ERR(adc->vref)) {
if (PTR_ERR(adc->vref) == -ENODEV) {
adc->vref = NULL;
} else {
- dev_err(&adc->spi->dev,
+ dev_err(&spi->dev,
"failed to get regulator (%ld)\n",
PTR_ERR(adc->vref));
return PTR_ERR(adc->vref);
@@ -499,12 +499,12 @@ static int mcp3911_probe(struct spi_device *spi)
return ret;
}
- adc->clki = devm_clk_get_enabled(&adc->spi->dev, NULL);
+ adc->clki = devm_clk_get_enabled(&spi->dev, NULL);
if (IS_ERR(adc->clki)) {
if (PTR_ERR(adc->clki) == -ENOENT) {
adc->clki = NULL;
} else {
- dev_err(&adc->spi->dev,
+ dev_err(&spi->dev,
"failed to get adc clk (%ld)\n",
PTR_ERR(adc->clki));
return PTR_ERR(adc->clki);
@@ -515,7 +515,7 @@ static int mcp3911_probe(struct spi_device *spi)
if (ret)
return ret;
- if (device_property_read_bool(&adc->spi->dev, "microchip,data-ready-hiz"))
+ if (device_property_read_bool(&spi->dev, "microchip,data-ready-hiz"))
ret = mcp3911_update(adc, MCP3911_REG_STATUSCOM, MCP3911_STATUSCOM_DRHIZ,
0, 2);
else
@@ -579,7 +579,7 @@ static int mcp3911_probe(struct spi_device *spi)
if (ret)
return ret;
- return devm_iio_device_register(&adc->spi->dev, indio_dev);
+ return devm_iio_device_register(&spi->dev, indio_dev);
}
static const struct of_device_id mcp3911_dt_ids[] = {