diff mbox series

[v4,1/4] dt-bindings: iio: adc: mcp3911: add support for the whole MCP39xx family

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

Commit Message

Marcus Folkesson Aug. 8, 2023, 11:04 a.m. UTC
Microchip does have many similar chips, add those to the compatible
string as the driver support is extended.

The new supported chips are:
  - microchip,mcp3910
  - microchip,mcp3912
  - microchip,mcp3913
  - microchip,mcp3914
  - microchip,mcp3918
  - microchip,mcp3919

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---

Notes:
    v2:
        - No changes
    v3:
        - No changes
    v4:
        - No changes

 .../devicetree/bindings/iio/adc/microchip,mcp3911.yaml      | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Andy Shevchenko Aug. 8, 2023, 2:08 p.m. UTC | #1
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 mbox series

Patch

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