Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit f701b399 authored by Nicolas Palix's avatar Nicolas Palix Committed by Paul Mundt
Browse files

sh: Replace an explicit computation by the use of the container_of macro

The macro container_of from kernel.h performs the same
pointer arithmetic operation.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/

)

// <smpl>
@@
type T;
expression mptr;
expression member;
@@

- (void *)((char *)mptr - offsetof(T, member))
+ container_of(mptr, T, member)
// </smpl>

Signed-off-by: default avatarNicolas Palix <npalix@diku.dk>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 87a705dd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment