[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4b4f9da3-27fd-42f6-a94f-f8d7017fd07b@kernel.org>
Date: Thu, 27 Nov 2025 07:58:36 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: david laight <david.laight@...box.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] w1: Use container_of_const() when all types are const
On 26/11/2025 20:27, david laight wrote:
> On Wed, 26 Nov 2025 18:18:42 +0100
> Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com> wrote:
>
>> Use container_of_const(), which is preferred over container_of(), when
>> the argument 'ptr' and returned pointer are already const, for better
>> code safety and readability.
>
> I thought there was a plan to make container_of() return a const pointer
> when the input is const?
>
> Can't be done yet because a few things need some 'const' sprinkles
> to compile.
>
You mean to use _Generic for container_of, basically exactly how
container_of_const is created? Do you have any indications that this is
happening, because current code does not suggest that.
Best regards,
Krzysztof
Powered by blists - more mailing lists