Message ID | 20230808110432.240773-1-marcus.folkesson@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | [v4,1/4] dt-bindings: iio: adc: mcp3911: add support for the whole MCP39xx family | expand |
On Tue, Aug 08, 2023 at 01:04:30PM +0200, Marcus Folkesson wrote: > Replace the usage of adc->spi->dev with spi->dev to make the code prettier. Suggested-by: ? > Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> ... > - adc->vref = devm_regulator_get_optional(&adc->spi->dev, "vref"); > + adc->vref = devm_regulator_get_optional(&spi->dev, "vref"); Why not struct device *dev = &spi->dev; and all the rest accordingly? > 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); Actually, you may first to switch to dev_err_probe() with the above introduced struct device *dev = &spi->dev; ... return dev_err_probe(dev, PTR_ERR(adc->vref), "failed to get regulator\n", and in the second patch do what you are doing here. Will be much less changes and neater code at the end.
diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml index f7b3fde4115a..06951ec5f5da 100644 --- a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml +++ b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml @@ -18,7 +18,13 @@ description: | properties: compatible: enum: + - microchip,mcp3910 - microchip,mcp3911 + - microchip,mcp3912 + - microchip,mcp3913 + - microchip,mcp3914 + - microchip,mcp3918 + - microchip,mcp3919 reg: maxItems: 1