From: Rene Herman <rene.herman@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] romsignature/checksum cleanup
Date: Sun, 24 Dec 2006 22:15:35 +0100 [thread overview]
Message-ID: <458EEDF7.4000200@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
Hi Andrew.
Use adding __init to romsignature() (it's only called from probe_roms()
which is itself __init) as an excuse to submit a pedantic cleanup.
Signed-off-by: Rene Herman <rene.herman@gmail.com>
[-- Attachment #2: romsignature-checksum-cleanup.diff --]
[-- Type: text/plain, Size: 916 bytes --]
diff --git a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
index f391abc..2565fac 100644
--- a/arch/i386/kernel/e820.c
+++ b/arch/i386/kernel/e820.c
@@ -156,21 +156,22 @@ static struct resource standard_io_resou
.flags = IORESOURCE_BUSY | IORESOURCE_IO
} };
-static int romsignature(const unsigned char *x)
+#define ROMSIGNATURE 0xaa55
+
+static int __init romsignature(const unsigned char *rom)
{
unsigned short sig;
- int ret = 0;
- if (probe_kernel_address((const unsigned short *)x, sig) == 0)
- ret = (sig == 0xaa55);
- return ret;
+
+ return probe_kernel_address((const unsigned short *)rom, sig) == 0 &&
+ sig == ROMSIGNATURE;
}
static int __init romchecksum(unsigned char *rom, unsigned long length)
{
- unsigned char *p, sum = 0;
+ unsigned char sum;
- for (p = rom; p < rom + length; p++)
- sum += *p;
+ for (sum = 0; length; length--)
+ sum += *rom++;
return sum == 0;
}
next reply other threads:[~2006-12-24 22:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-24 21:15 Rene Herman [this message]
2006-12-25 0:53 ` Rene Herman
2006-12-27 0:31 ` Rusty Russell
2006-12-27 0:45 ` Rene Herman
2006-12-28 0:32 ` Zachary Amsden
2007-01-02 20:01 ` Rene Herman
2007-01-05 23:22 ` Jeremy Fitzhardinge
2007-01-06 3:46 ` Rene Herman
2007-01-07 8:59 ` Jeremy Fitzhardinge
2007-01-07 9:02 ` Rene Herman
2007-01-07 10:20 ` Jeremy Fitzhardinge
2007-01-07 10:47 ` Rene Herman
2007-01-07 18:07 ` Jeremy Fitzhardinge
2007-01-08 2:48 ` Rene Herman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=458EEDF7.4000200@gmail.com \
--to=rene.herman@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome