sh: Replace an explicit computation by the use of the container_of macro
authorNicolas Palix <npalix@diku.dk>
Mon, 7 Dec 2009 09:38:55 +0000 (10:38 +0100)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 9 Dec 2009 03:36:51 +0000 (12:36 +0900)
commitf701b3999890b867f87733c146d4cdf9319ead05
treeca3ca320dc28d3f4dae92f7bd096c5e13600b04f
parent87a705dde49d0c482fa818f0923af59ed0954d5d
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: Nicolas Palix <npalix@diku.dk>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/kernel/cpu/irq/ipr.c