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

Sam Ravnborg
2008-01-27T09:23:50Z

On Sun, Jan 27, 2008 at 02:39:22PM +0530, Abhishek Sagar wrote:
> Encapsulate reusable code .
>
> Signed-off-by: Abhishek Sagar <sagar.abhishek@gmail.com>
> ---
>
> 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