From: Jesper Juhl <jesper.juhl@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
cort@cs.nmt.edu, hozer@drgw.net, paulus@samba.org,
Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH 05/13] request_region fixes for ppc prep_request_io
Date: Fri, 24 Feb 2006 21:47:42 +0100 [thread overview]
Message-ID: <200602242147.43197.jesper.juhl@gmail.com> (raw)
request_region fixes for ppc prep_request_io.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
arch/ppc/platforms/prep_setup.c | 51 ++++++++++++++++++++++++++++++++++------
1 files changed, 44 insertions(+), 7 deletions(-)
--- linux-2.6.16-rc4-mm2-orig/arch/ppc/platforms/prep_setup.c 2006-02-24 19:25:30.000000000 +0100
+++ linux-2.6.16-rc4-mm2/arch/ppc/platforms/prep_setup.c 2006-02-24 21:22:33.000000000 +0100
@@ -1064,20 +1064,57 @@ prep_map_io(void)
io_block_mapping(0xf0000000, PREP_ISA_MEM_BASE, 0x08000000, _PAGE_IO);
}
+static inline int
+prep_request_region(unsigned long start, unsigned long n, const char *name)
+{
+ struct resource *region;
+
+ region = request_region(start, n, name);
+ if (!region) {
+ printk(KERN_WARNING "prep_request_io: could not allocate "
+ "%s region\n", name);
+ return 0;
+ }
+ return 1;
+}
+
static int __init
prep_request_io(void)
{
- if (_machine == _MACH_prep) {
+ int tmp;
+
+ if (_machine != _MACH_prep)
+ return 0;
+
#ifdef CONFIG_NVRAM
- request_region(PREP_NVRAM_AS0, 0x8, "nvram");
+ tmp = prep_request_region(PREP_NVRAM_AS0, 0x8, "nvram");
+ if (!tmp)
+ goto out_nvram;
#endif
- request_region(0x00,0x20,"dma1");
- request_region(0x40,0x20,"timer");
- request_region(0x80,0x10,"dma page reg");
- request_region(0xc0,0x20,"dma2");
- }
+ tmp = prep_request_region(0x00,0x20,"dma1");
+ if (!tmp)
+ goto out_dma1;
+ tmp = prep_request_region(0x40,0x20,"timer");
+ if (!tmp)
+ goto out_timer;
+ tmp = prep_request_region(0x80,0x10,"dma page reg");
+ if (!tmp)
+ goto out_dma_page;
+ tmp = prep_request_region(0xc0,0x20,"dma2");
+ if (!tmp)
+ goto out_dma2;
return 0;
+ out_dma2:
+ release_region(0x80,0x10);
+ out_dma_page:
+ release_region(0x40,0x20);
+ out_timer:
+ release_region(0x00,0x20);
+ out_dma1:
+ release_region(PREP_NVRAM_AS0, 0x8);
+ out_nvram:
+ return -EBUSY;
}
device_initcall(prep_request_io);
reply other threads:[~2006-02-24 20:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200602242147.43197.jesper.juhl@gmail.com \
--to=jesper.juhl@gmail.com \
--cc=akpm@osdl.org \
--cc=cort@cs.nmt.edu \
--cc=hozer@drgw.net \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=torvalds@osdl.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