lkml.org 
[lkml]   [2007]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH 2.6.20] arch M68K: user ARRAY_SIZE macro when appropriate
From
Hi all,

A patch to use ARRAY_SIZE macro already defined in linux/kernel.h

Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
---
Patch isn't compile checked since I have no m68k machine at hand.

diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c
index ef89060..7fd2720 100644
--- a/arch/m68k/kernel/ptrace.c
+++ b/arch/m68k/kernel/ptrace.c
@@ -76,7 +76,7 @@ static inline long get_reg(struct task_struct *task, int regno)

if (regno == PT_USP)
addr = &task->thread.usp;
- else if (regno < sizeof(regoff)/sizeof(regoff[0]))
+ else if (regno < ARRAY_SIZE(regoff))
addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
else
return 0;
@@ -93,7 +93,7 @@ static inline int put_reg(struct task_struct *task, int regno,

if (regno == PT_USP)
addr = &task->thread.usp;
- else if (regno < sizeof(regoff)/sizeof(regoff[0]))
+ else if (regno < ARRAY_SIZE(regoff))
addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
else
return -1;
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index 759fa24..a27a4fa 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -1011,7 +1011,7 @@ EXPORT_SYMBOL(dump_stack);
void bad_super_trap (struct frame *fp)
{
console_verbose();
- if (fp->ptregs.vector < 4*sizeof(vec_names)/sizeof(vec_names[0]))
+ if (fp->ptregs.vector < 4 * ARRAY_SIZE(vec_names))
printk ("*** %s *** FORMAT=%X\n",
vec_names[(fp->ptregs.vector) >> 2],
fp->ptregs.format);

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

\
 
 \ /
  Last update: 2007-02-05 03:47    [W:0.074 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site