[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2176d7e4-2949-e922-1988-fa5eedfc2220@rasmusvillemoes.dk>
Date: Thu, 27 Aug 2020 20:07:55 +0200
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Allen Pais <allen.lkml@...il.com>, torvalds@...ux-foundation.org
Cc: akpm@...ux-foundation.org, keescook@...omium.org,
tglx@...utronix.de, linux-kernel@...r.kernel.org,
"James E . J . Bottomley" <James.Bottomley@...senPartnership.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jens Axboe <axboe@...nel.dk>
Subject: Re: [PATCH] linux/kernel.h: add container_from()
On 27/08/2020 03.36, Allen Pais wrote:
> Introduce container_from() as a generic helper instead of
> sub-systems defining a private from_* API
> (Eg: from_tasklets recently introduced in
> 12cc923f1ccc: Tasklet: Introduce new initialization API)
>
> The helper is similar to container_of() in argument order
> with the difference of naming the containing structure instead
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> of having to specify its type.
>
> +/**
> + * container_from - cast a member of a structure out to the containing structure
> + * @ptr: the pointer to the member.
> + * @container: the type of the container struct.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This seems to have been copy-pasted from container_of? Shouldn't
@container be the (local) value we're storing into? As in foo =
container_from(..., foo, ...)? Or am I misunderstanding the purpose of this?
[And I think it would read nicer if the bikeshed was called
to_container(), but don't care deeply.]
Rasmus
Powered by blists - more mailing lists