Re: [PATCH][next] container_of: add container_first() macro
From: Greg KH
Date: Sat Sep 21 2024 - 01:52:53 EST
On Sat, Sep 21, 2024 at 08:45:28AM +0300, Dan Carpenter wrote:
> On Fri, Sep 20, 2024 at 02:50:02PM +0200, Gustavo A. R. Silva wrote:
> > This is like container_of() but it has an assert to ensure that it's
> > using the first struct member.
> >
>
> I just remembered that Greg wanted this based on container_of_const().
Yes, that would be best.
> Really container_of_const() should be renamed to container_of() and
> container_of() should be renamed to container_of_helper() and we
> would add a #define container_of_const container_of for the transition.
I agree, but I wonder if it's safe to just do that already and how many
build warnings would happen. Last I checked it was a lot.
thanks,
greg k-h