Skip to contentSkip to conversation

powerpc: use is_init()

PATCH In review Akinobu Mita 2 participants 3 messages Dec 19, 2006 – Dec 20, 2006 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: use is_init()

Use is_init() rather than hard coded pid comparison.

Cc Paul Mackerras <[email protected]>
Cc Anton Blanchard <[email protected]>
---
 arch/powerpc/kernel/traps.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/traps.c +1 -1
Index: 2.6-mm/arch/powerpc/kernel/traps.c
===================================================================
@@ -174,7 +174,7 @@ void _exception(int signr, struct pt_reg
 	 * generate the same exception over and over again and we get
 	 * nowhere.  Better to kill it and let the kernel panic.
 	 */
-	if (current->pid == 1) {
+	if (is_init(current)) {
 		__sighandler_t handler;
 
 		spin_lock_irq(&current->sighand->siglock);
#1 lore raw
Quoted 1 line · Akinobu Mita

Use is_init() rather than hard coded pid comparison.

What's the context of this patch? Why is this a good thing to do?

Doing a git grep -w is_init on Linus' current git tree reveals an is_init() in arch/parisc/kernel/module.c, which looks to be something different, but no generic definition of an is_init() function or macro.

Paul.

#2 lore raw
Quoted 6 lines · Paul Mackerras
Quoted 1 line · Akinobu Mita

Use is_init() rather than hard coded pid comparison.

What's the context of this patch? Why is this a good thing to do?

This is just minor cleanup patch.
is_init() is available on 2.6.20-rc1 (include/linux/sched.h):

/**
* is_init - check if a task structure is init
* @tsk: Task structure to be checked.
*
* Check if a task structure is the first user space task the kernel created. */
static inline int is_init(struct task_struct *tsk)

{
        return tsk->pid == 1;
}