Re: [PATCH] iio: adc: at91-sama5d2_adc: explain why indio_dev->name = dev_name() is wrong

From: Andy Shevchenko

Date: Sun Sep 21 2025 - 14:33:40 EST


On Sat, Sep 20, 2025 at 7:44 PM David Lechner <dlechner@xxxxxxxxxxxx> wrote:
>
> Add an explanatory comment on why indio_dev->name = dev_name(dev) is
> wrong, and that we can't fix it without breaking userspace.
>
> The idea is to prevent future drivers from making the same mistake by
> copying this code. And if this driver is ever modified again, we can
> at least make sure any new compatible IDs use the correct name.

...

> + /*
> + * The device name is supposed to be the "part number", not the kobject
> + * name. Do not copy this code for new drivers. We can't "fix" this
> + * without breaking userspace, so we have to live with it. However, if
> + * any new compatible IDs are added, please do something similar to
> + * adc/ltc2497-core.c so that at least the new part numbers are correct.

Please, use the full path from the root of the source tree, i.e.
drivers/iio/adc/ltc2497-core.c. IIRC the Sphynx might even render the
links properly (if it ever goes to this deep comment, which is not
marked as kernel-doc).

> + */
> indio_dev->name = dev_name(&pdev->dev);

--
With Best Regards,
Andy Shevchenko