On Fri, 10 Oct 2025 13:22:01 +0200 Luca Weiss <[email protected]> wrote:
> Register an IIO channel to allow reading the temperature using the IIO > interface. > > Signed-off-by: Luca Weiss <[email protected]> Just one question below. > static int gadc_thermal_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > struct gadc_thermal_info *gti; > + struct iio_dev *indio_dev; > + struct gadc_iio *data; > int ret; > > if (!dev->of_node) { > @@ -153,6 +192,23 @@ static int gadc_thermal_probe(struct platform_device > *pdev) > > devm_thermal_add_hwmon_sysfs(dev, gti->tz_dev); > > + indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); > + if (!indio_dev) > + return -ENOMEM; > + > + data = iio_priv(indio_dev); > + data->gti = gti; > + > + indio_dev->name = pdev->name; what does this end up as? obviously we don't really care what name the user space interface we aren't using advertises but this should be something part number like. > + indio_dev->modes = INDIO_DIRECT_MODE; > + indio_dev->info = &gadc_adc_info; > + indio_dev->channels = gadc_adc_channels; > + indio_dev->num_channels = ARRAY_SIZE(gadc_adc_channels); > + > + ret = devm_iio_device_register(dev, indio_dev); > + if (ret) > + return dev_err_probe(dev, ret, "Failed to register IIO > device\n"); > + > return 0; > } > >

