[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250927165832.5ad37428@jic23-huawei>
Date: Sat, 27 Sep 2025 16:58:32 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: David Lechner <dlechner@...libre.com>, Nuno Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: at91-sama5d2_adc: explain why indio_dev->name
= dev_name() is wrong
On Sun, 21 Sep 2025 21:33:02 +0300
Andy Shevchenko <andy.shevchenko@...il.com> wrote:
> On Sat, Sep 20, 2025 at 7:44 PM David Lechner <dlechner@...libre.com> 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).
Other than that this looks like a good approach to me.
I was thinking maybe a reference to central doc, but that might be a bit fragile
so I think I prefer this approach of stating it fully at each place it matters.
Thanks,
Jonathan
>
> > + */
> > indio_dev->name = dev_name(&pdev->dev);
>
Powered by blists - more mailing lists