[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aQt6Z0gmNz-lCrLg@valkosipuli.retiisi.eu>
Date: Wed, 5 Nov 2025 18:25:11 +0200
From: Sakari Ailus <sakari.ailus@....fi>
To: Christoph Hellwig <hch@...radead.org>
Cc: Joe Perches <joe@...ches.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Andy Whitcroft <apw@...onical.com>, linux-kernel@...r.kernel.org,
Dwaipayan Ray <dwaipayanray1@...il.com>,
Lukas Bulwahn <lukas.bulwahn@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 1/1] checkpatch: Deprecate container_of() in favour of
container_of_const()
Hi Christoph,
On Wed, Nov 05, 2025 at 05:01:46AM -0800, Christoph Hellwig wrote:
> Well, if container_of_const is a drop-in replacement for all uses of
> container_of, just fix the implementation? If it is an almost but not
> complete replacement, find a different name for the few uses. And if
> it's not anywhere near drop in, just using container_of make a lot more
> sense.
>
> Just in case it wasn't clear: We really should keep the shorter nice
> name as the default if at all possible. Both because it reads better
> and because it avoids churn.
I'm in favour of the container_of() name instead of container_of_const(),
but there are a vast number of uses of container_of() in the kernel and
fixing these to respect const qualifier is going to take time. The intent
here is to prevent adding new uses of container_of() that do not respect
constness.
I tested this again on v6.18-rc2 and with my .config (far from
allyesconfig) there were 840 warnings from discarding const qualifier.
Presumably a lot of these are duplicates, but then again it'll be a
thankless (and possibly endless?) task to fix these if we don't make effort
to avoid new ones from being added at the same time.
--
Kind regards,
Sakari Ailus
Powered by blists - more mailing lists