From: Ron Gage <ron@rongage.org>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] [PATCH] request_region - ppc/platforms/prep_setup.c - Please
Date: Sat, 04 Feb 2006 21:10:24 +0000 [thread overview]
Message-ID: <200602041610.24772.ron@rongage.org> (raw)
Is this a good way to handle this problem? Original code was (in essence) 5
request_region calls in a row with no return checking.
This patch adds return value checking to request_region. No other structural
changes included...
diff -ur linux-2.6.15.orig/arch/ppc/platforms/prep_setup.c
linux-2.6.15/arch/ppc/platforms/prep_setup.c
--- linux-2.6.15.orig/arch/ppc/platforms/prep_setup.c 2006-02-04
11:00:29.000000000 -0500
+++ linux-2.6.15/arch/ppc/platforms/prep_setup.c 2006-02-04 16:04:58.000000000
-0500
@@ -1071,16 +1071,43 @@
static int __init
prep_request_io(void)
{
+ struct resource *region;
+ unsigned char ret=0;
+
+ /* if ret = 0, everything worked and we return normally.
+ if ret != 0, then something failed and we return -EBUSY. */
+
if (_machine = _MACH_prep) {
#ifdef CONFIG_NVRAM
- request_region(PREP_NVRAM_AS0, 0x8, "nvram");
+ region = request_region(PREP_NVRAM_AS0, 0x8, "nvram");
+ if (!region) {
+ printk (KERN_INFO "Could not allocate nvram region");
+ ret = 1;
+ }
#endif
- request_region(0x00,0x20,"dma1");
- request_region(0x40,0x20,"timer");
- request_region(0x80,0x10,"dma page reg");
- request_region(0xc0,0x20,"dma2");
+ region = request_region(0x00,0x20,"dma1");
+ if (!region) {
+ printk (KERN_INFO "Could not allocate dma1 region");
+ ret = 1;
+ }
+ region = request_region(0x40,0x20,"timer");
+ if (!region) {
+ printk (KERN_INFO "Could not allocate timer region");
+ ret = 1;
+ }
+ region = request_region(0x80,0x10,"dma page reg");
+ if (!region) {
+ printk (KERN_INFO "Could not allocate dma page region");
+ ret = 1;
+ }
+ region = request_region(0xc0,0x20,"dma2");
+ if (!region) {
+ printk (KERN_INFO "Could not allocate dma2 region");
+ ret = 1;
+ }
}
-
+ if (ret != 0)
+ return -EBUSY;
return 0;
}
--
Ron Gage
(LPIC1, MCP, A+, Net+)
Westland Michigan
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next reply other threads:[~2006-02-04 21:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-04 21:10 Ron Gage [this message]
2006-02-04 22:26 ` [KJ] [PATCH] request_region - ppc/platforms/prep_setup.c - Please Jesper Juhl
2006-02-04 22:32 ` Jesper Juhl
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=200602041610.24772.ron@rongage.org \
--to=ron@rongage.org \
--cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.