From: Krzysztof Kozlowski <krzk@kernel.org>
To: david laight <david.laight@runbox.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] w1: Use container_of_const() when all types are const
Date: Thu, 27 Nov 2025 07:58:36 +0100 [thread overview]
Message-ID: <4b4f9da3-27fd-42f6-a94f-f8d7017fd07b@kernel.org> (raw)
In-Reply-To: <20251126192705.36321d87@pumpkin>
On 26/11/2025 20:27, david laight wrote:
> On Wed, 26 Nov 2025 18:18:42 +0100
> Krzysztof Kozlowski <krzysztof.kozlowski@oss.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
prev parent reply other threads:[~2025-11-27 6:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 17:18 [PATCH] w1: Use container_of_const() when all types are const Krzysztof Kozlowski
2025-11-26 19:27 ` david laight
2025-11-27 6:58 ` Krzysztof Kozlowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4b4f9da3-27fd-42f6-a94f-f8d7017fd07b@kernel.org \
--to=krzk@kernel.org \
--cc=david.laight@runbox.com \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.