diff options
author | Nicolas Palix <npalix@diku.dk> | 2009-12-07 09:38:55 (GMT) |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-12-09 03:36:51 (GMT) |
commit | f701b3999890b867f87733c146d4cdf9319ead05 (patch) | |
tree | ca3ca320dc28d3f4dae92f7bd096c5e13600b04f /arch/sh/kernel/cpu | |
parent | 87a705dde49d0c482fa818f0923af59ed0954d5d (diff) | |
download | linux-fsl-qoriq-f701b3999890b867f87733c146d4cdf9319ead05.tar.xz |
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>
Diffstat (limited to 'arch/sh/kernel/cpu')
-rw-r--r-- | arch/sh/kernel/cpu/irq/ipr.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/sh/kernel/cpu/irq/ipr.c b/arch/sh/kernel/cpu/irq/ipr.c index c1508a9..9282d96 100644 --- a/arch/sh/kernel/cpu/irq/ipr.c +++ b/arch/sh/kernel/cpu/irq/ipr.c @@ -17,16 +17,17 @@ * for more details. */ #include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/io.h> #include <linux/irq.h> +#include <linux/kernel.h> #include <linux/module.h> -#include <linux/io.h> -#include <linux/interrupt.h> #include <linux/topology.h> static inline struct ipr_desc *get_ipr_desc(unsigned int irq) { struct irq_chip *chip = get_irq_chip(irq); - return (void *)((char *)chip - offsetof(struct ipr_desc, chip)); + return container_of(chip, struct ipr_desc, chip); } static void disable_ipr_irq(unsigned int irq) |