Re: [PATCH v2][next] container_of: add container_first() macro
From: Greg KH
Date: Wed Jan 29 2025 - 00:54:59 EST
On Wed, Jan 29, 2025 at 03:56:01PM +1030, Gustavo A. R. Silva wrote:
> This is like container_of_const() but it contains an assert to
> ensure that it's using the first member in the structure.
But why? If you "know" it's the first member, just do a normal cast.
If you don't, then you probably shouldn't be caring about this anyway,
right?
>
> Co-developed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>
> ---
>
> I will be using this in my -Wflex-array-member-not-at-end patches. :)
Confused, I'd like to see some users first please.
thanks,
greg k-h