Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-29 Thread Dan Carpenter
On Thu, Jan 30, 2025 at 07:14:01AM +0100, Greg KH wrote: > > Anyways, so far so good. For some reason I was under the impression > > that you two guys wanted the container_first() macro. > > I don't :) Greg, container_first() is like peeing in the shower. Once you try it you'll never go back.

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-29 Thread Greg KH
On Thu, Jan 30, 2025 at 10:06:00AM +1030, Gustavo A. R. Silva wrote: > > > On 30/01/25 02:38, Greg KH wrote: > > On Wed, Jan 29, 2025 at 05:06:54PM +0300, Dan Carpenter wrote: > > > On Wed, Jan 29, 2025 at 02:14:14PM +0100, Greg KH wrote: > > > > On Wed, Jan 29, 2025 at 01:39:27PM +0300, Dan Carp

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-29 Thread Gustavo A. R. Silva
On 30/01/25 02:38, Greg KH wrote: On Wed, Jan 29, 2025 at 05:06:54PM +0300, Dan Carpenter wrote: On Wed, Jan 29, 2025 at 02:14:14PM +0100, Greg KH wrote: On Wed, Jan 29, 2025 at 01:39:27PM +0300, Dan Carpenter wrote: On Wed, Jan 29, 2025 at 09:34:07AM +0100, Greg KH wrote: On Wed, Jan 29,

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-29 Thread Greg KH
On Wed, Jan 29, 2025 at 05:06:54PM +0300, Dan Carpenter wrote: > On Wed, Jan 29, 2025 at 02:14:14PM +0100, Greg KH wrote: > > On Wed, Jan 29, 2025 at 01:39:27PM +0300, Dan Carpenter wrote: > > > On Wed, Jan 29, 2025 at 09:34:07AM +0100, Greg KH wrote: > > > > On Wed, Jan 29, 2025 at 06:35:18PM +103

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-29 Thread Dan Carpenter
On Wed, Jan 29, 2025 at 02:14:14PM +0100, Greg KH wrote: > On Wed, Jan 29, 2025 at 01:39:27PM +0300, Dan Carpenter wrote: > > On Wed, Jan 29, 2025 at 09:34:07AM +0100, Greg KH wrote: > > > On Wed, Jan 29, 2025 at 06:35:18PM +1030, Gustavo A. R. Silva wrote: > > > > > > > > > > > > On 29/01/25 16:

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-29 Thread Greg KH
On Wed, Jan 29, 2025 at 01:39:27PM +0300, Dan Carpenter wrote: > On Wed, Jan 29, 2025 at 09:34:07AM +0100, Greg KH wrote: > > On Wed, Jan 29, 2025 at 06:35:18PM +1030, Gustavo A. R. Silva wrote: > > > > > > > > > On 29/01/25 16:24, Greg KH wrote: > > > > On Wed, Jan 29, 2025 at 03:56:01PM +1030,

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-29 Thread Dan Carpenter
On Wed, Jan 29, 2025 at 09:34:07AM +0100, Greg KH wrote: > On Wed, Jan 29, 2025 at 06:35:18PM +1030, Gustavo A. R. Silva wrote: > > > > > > On 29/01/25 16:24, Greg KH wrote: > > > On Wed, Jan 29, 2025 at 03:56:01PM +1030, Gustavo A. R. Silva wrote: > > > > This is like container_of_const() but it

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-29 Thread Greg KH
On Wed, Jan 29, 2025 at 06:35:18PM +1030, Gustavo A. R. Silva wrote: > > > On 29/01/25 16:24, Greg KH wrote: > > 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

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-29 Thread Gustavo A. R. Silva
On 29/01/25 16:24, Greg KH wrote: 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 cas

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-29 Thread Greg KH
On Wed, Jan 29, 2025 at 10:33:56AM +0300, Dan Carpenter wrote: > On Wed, Jan 29, 2025 at 10:29:24AM +0300, Dan Carpenter wrote: > > drivers/iommu/iommufd/iommufd_private.h > >243 static inline struct iommufd_ioas *iommufd_get_ioas(struct > > iommufd_ctx *ictx, > >244

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-28 Thread Dan Carpenter
On Wed, Jan 29, 2025 at 10:29:24AM +0300, Dan Carpenter wrote: > drivers/iommu/iommufd/iommufd_private.h >243 static inline struct iommufd_ioas *iommufd_get_ioas(struct > iommufd_ctx *ictx, >244 u32 id) >245 { >246 ret

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-28 Thread Dan Carpenter
On Wed, Jan 29, 2025 at 06:54:48AM +0100, Greg KH wrote: > 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 firs

Re: [PATCH v2][next] container_of: add container_first() macro

2025-01-28 Thread Greg KH
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 sh