Re: [PATCH v7 5/5] iio: mcp9600: Add support for thermocouple-type

From: Andy Shevchenko
Date: Wed Aug 20 2025 - 06:10:37 EST


On Wed, Aug 20, 2025 at 2:45 AM Ben Collins <bcollins@xxxxxxxxxx> wrote:
>
> dt-bindings documentation for this driver claims to support
> thermocouple-type, but the driver does not actually make use of
> the property.
>
> Implement usage of the property to configure the chip for the
> selected thermocouple-type.

...

> + /* Accept type from dt with default of Type-K. */
> + data->thermocouple_type = THERMOCOUPLE_TYPE_K;
> + ret = device_property_read_u32(&client->dev, "thermocouple-type",
> + &data->thermocouple_type);
> + if (ret < 0 && ret != -EINVAL)

' < 0' part is redundant.

> + return dev_err_probe(&client->dev, ret,
> + "Error reading thermocouple-type property\n");
> +
> + if (data->thermocouple_type >= ARRAY_SIZE(mcp9600_type_map))
> + return dev_err_probe(&client->dev, -EINVAL,
> + "Invalid thermocouple-type property %u.\n",
> + data->thermocouple_type);

...

> + /* Set initial config. */
> + ret = mcp9600_config(data);
> + if (ret < 0)

Maybe here as well, but I haven't checked the actual code of the callee.

> + return ret;


--
With Best Regards,
Andy Shevchenko