Thread (44 messages) 44 messages, 10 authors, 2020-10-19

Re: [PATCH] block: convert tasklets to use new tasklet_setup() API

From: Allen <hidden>
Date: 2020-08-19 16:25:03
Also in: dri-devel, intel-gfx, linux-block, linux-hyperv, linux-input, linux-mmc, linux-s390, linux-spi, linux-um, lkml, netdev

[...]
quoted
quoted
Since both threads seem to have petered out, let me suggest in
kernel.h:

#define cast_out(ptr, container, member) \
    container_of(ptr, typeof(*container), member)

It does what you want, the argument order is the same as
container_of with the only difference being you name the containing
structure instead of having to specify its type.
Not to incessantly bike shed on the naming, but I don't like
cast_out, it's not very descriptive. And it has connotations of
getting rid of something, which isn't really true.
Um, I thought it was exactly descriptive: you're casting to the outer
container.  I thought about following the C++ dynamic casting style, so
out_cast(), but that seemed a bit pejorative.  What about outer_cast()?
quoted
FWIW, I like the from_ part of the original naming, as it has some
clues as to what is being done here. Why not just from_container()?
That should immediately tell people what it does without having to
look up the implementation, even before this becomes a part of the
accepted coding norm.
I'm not opposed to container_from() but it seems a little less
descriptive than outer_cast() but I don't really care.  I always have
to look up container_of() when I'm using it so this would just be
another macro of that type ...
 So far we have a few which have been suggested as replacement
for from_tasklet()

- out_cast() or outer_cast()
- from_member().
- container_from() or from_container()

from_container() sounds fine, would trimming it a bit work? like from_cont().

-- 
       - Allen

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help