Re: [PATCH 2/3] x86: Macrofy resuable code

From: Sam Ravnborg
Date: Sun Jan 27 2008 - 04:23:52 EST


On Sun, Jan 27, 2008 at 02:39:22PM +0530, Abhishek Sagar wrote:
> Encapsulate reusable code .
>
> Signed-off-by: Abhishek Sagar <sagar.abhishek@xxxxxxxxx>
> ---
>
> diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
> index a99e764..45f2949 100644
> --- a/arch/x86/kernel/kprobes.c
> +++ b/arch/x86/kernel/kprobes.c
> @@ -74,6 +74,13 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
> #define stack_addr(regs) ((unsigned long *)&regs->sp)
> #endif
>
> +#define kprobe_bkpt_addr(regs) \
> + ((unsigned long)(regs->ip - sizeof(kprobe_opcode_t)))
> +
> +#define is_jprobe_bkpt(ptr) \
> + ((ptr > (u8 *)jprobe_return) && (ptr < (u8 *)jprobe_return_end))
> +
> +
Small static functions are preferred over macros.
Any particular reason to use a macro here?

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/