Re: [PATCH v3 2/2] iio: adc: ti-ads1015: Add support for label

From: Andy Shevchenko

Date: Tue Sep 08 2026 - 07:00:30 EST


On Mon, Sep 07, 2026 at 06:23:04PM +0300, Flaviu Nistor wrote:
> Add support for label sysfs attribute similar to other adc devices. This is
> particularly useful because the label can match the schematic signal name,
> identifying channel voltages easier if label is defined via device tree.

...

> +static int ads1015_read_label(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan, char *label)
> +{
> + struct ads1015_data *data = iio_priv(indio_dev);
> + const char *name = data->channel_data[chan->address].label;
> +
> + /*
> + * Avoid printing "(null)" in the console in case label property
> + * is missing for the channel, or channel is not defined.
> + */
> + if (!name)
> + name = chan->datasheet_name;

Is the datasheet_name static? Can this rather be made only once
at the probe time?

> + return sysfs_emit(label, "%s\n", name);
> +}

--
With Best Regards,
Andy Shevchenko