summaryrefslogtreecommitdiff
path: root/drivers/pcmcia/rsrc_nonstatic.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-02-17 16:35:33 +0300
committerDominik Brodowski <linux@dominikbrodowski.net>2010-02-17 20:07:04 +0300
commitf309cb3e4fe79a68cb2fdedfb8a8a950a2cfe490 (patch)
tree83cc0345f890ded64800f81771a86b65be0b460e /drivers/pcmcia/rsrc_nonstatic.c
parentd801c1409ef7d45339cbe8ac9de28ade6ed4699a (diff)
downloadlinux-f309cb3e4fe79a68cb2fdedfb8a8a950a2cfe490.tar.xz
pcmcia: allow for extension of resource interval
If a new interval overlaps or extends an existing interval in add_interval(), do not fail, but extend the existing interval. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/rsrc_nonstatic.c')
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 19cecb539759..a06881c3b962 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -124,8 +124,10 @@ static int add_interval(struct resource_map *map, u_long base, u_long num)
struct resource_map *p, *q;
for (p = map; ; p = p->next) {
- if ((p != map) && (p->base+p->num-1 >= base))
- return -1;
+ if ((p != map) && (p->base+p->num >= base)) {
+ p->num = max(num + base - p->base, p->num);
+ return 0;
+ }
if ((p->next == map) || (p->next->base > base+num-1))
break;
}