aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/resource.c')
-rw-r--r--drivers/pnp/resource.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 635b11a0cf82..ea6ec14a0559 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -3,7 +3,6 @@
3 * 3 *
4 * based on isapnp.c resource management (c) Jaroslav Kysela <perex@suse.cz> 4 * based on isapnp.c resource management (c) Jaroslav Kysela <perex@suse.cz>
5 * Copyright 2003 Adam Belay <ambx1@neo.rr.com> 5 * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
6 *
7 */ 6 */
8 7
9#include <linux/module.h> 8#include <linux/module.h>
@@ -20,10 +19,10 @@
20#include <linux/pnp.h> 19#include <linux/pnp.h>
21#include "base.h" 20#include "base.h"
22 21
23static int pnp_reserve_irq[16] = {[0...15] = -1 }; /* reserve (don't use) some IRQ */ 22static int pnp_reserve_irq[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some IRQ */
24static int pnp_reserve_dma[8] = {[0...7] = -1 }; /* reserve (don't use) some DMA */ 23static int pnp_reserve_dma[8] = {[0 ... 7] = -1 }; /* reserve (don't use) some DMA */
25static int pnp_reserve_io[16] = {[0...15] = -1 }; /* reserve (don't use) some I/O region */ 24static int pnp_reserve_io[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some I/O region */
26static int pnp_reserve_mem[16] = {[0...15] = -1 }; /* reserve (don't use) some memory region */ 25static int pnp_reserve_mem[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some memory region */
27 26
28/* 27/*
29 * option registration 28 * option registration
@@ -33,7 +32,6 @@ static struct pnp_option *pnp_build_option(int priority)
33{ 32{
34 struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option)); 33 struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option));
35 34
36 /* check if pnp_alloc ran out of memory */
37 if (!option) 35 if (!option)
38 return NULL; 36 return NULL;
39 37
@@ -48,6 +46,7 @@ static struct pnp_option *pnp_build_option(int priority)
48struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) 46struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
49{ 47{
50 struct pnp_option *option; 48 struct pnp_option *option;
49
51 if (!dev) 50 if (!dev)
52 return NULL; 51 return NULL;
53 52
@@ -64,6 +63,7 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
64 int priority) 63 int priority)
65{ 64{
66 struct pnp_option *option; 65 struct pnp_option *option;
66
67 if (!dev) 67 if (!dev)
68 return NULL; 68 return NULL;
69 69
@@ -82,6 +82,7 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
82int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) 82int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
83{ 83{
84 struct pnp_irq *ptr; 84 struct pnp_irq *ptr;
85
85 if (!option) 86 if (!option)
86 return -EINVAL; 87 return -EINVAL;
87 if (!data) 88 if (!data)
@@ -110,6 +111,7 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
110int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) 111int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
111{ 112{
112 struct pnp_dma *ptr; 113 struct pnp_dma *ptr;
114
113 if (!option) 115 if (!option)
114 return -EINVAL; 116 return -EINVAL;
115 if (!data) 117 if (!data)
@@ -129,6 +131,7 @@ int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
129int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) 131int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
130{ 132{
131 struct pnp_port *ptr; 133 struct pnp_port *ptr;
134
132 if (!option) 135 if (!option)
133 return -EINVAL; 136 return -EINVAL;
134 if (!data) 137 if (!data)
@@ -148,6 +151,7 @@ int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
148int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data) 151int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data)
149{ 152{
150 struct pnp_mem *ptr; 153 struct pnp_mem *ptr;
154
151 if (!option) 155 if (!option)
152 return -EINVAL; 156 return -EINVAL;
153 if (!data) 157 if (!data)
@@ -240,6 +244,7 @@ int pnp_check_port(struct pnp_dev *dev, int idx)
240 int tmp; 244 int tmp;
241 struct pnp_dev *tdev; 245 struct pnp_dev *tdev;
242 resource_size_t *port, *end, *tport, *tend; 246 resource_size_t *port, *end, *tport, *tend;
247
243 port = &dev->res.port_resource[idx].start; 248 port = &dev->res.port_resource[idx].start;
244 end = &dev->res.port_resource[idx].end; 249 end = &dev->res.port_resource[idx].end;
245 250
@@ -297,6 +302,7 @@ int pnp_check_mem(struct pnp_dev *dev, int idx)
297 int tmp; 302 int tmp;
298 struct pnp_dev *tdev; 303 struct pnp_dev *tdev;
299 resource_size_t *addr, *end, *taddr, *tend; 304 resource_size_t *addr, *end, *taddr, *tend;
305
300 addr = &dev->res.mem_resource[idx].start; 306 addr = &dev->res.mem_resource[idx].start;
301 end = &dev->res.mem_resource[idx].end; 307 end = &dev->res.mem_resource[idx].end;
302 308
@@ -474,22 +480,12 @@ int pnp_check_dma(struct pnp_dev *dev, int idx)
474 480
475 return 1; 481 return 1;
476#else 482#else
477 /* IA64 hasn't legacy DMA */ 483 /* IA64 does not have legacy DMA */
478 return 0; 484 return 0;
479#endif 485#endif
480} 486}
481 487
482#if 0
483EXPORT_SYMBOL(pnp_register_dependent_option);
484EXPORT_SYMBOL(pnp_register_independent_option);
485EXPORT_SYMBOL(pnp_register_irq_resource);
486EXPORT_SYMBOL(pnp_register_dma_resource);
487EXPORT_SYMBOL(pnp_register_port_resource);
488EXPORT_SYMBOL(pnp_register_mem_resource);
489#endif /* 0 */
490
491/* format is: pnp_reserve_irq=irq1[,irq2] .... */ 488/* format is: pnp_reserve_irq=irq1[,irq2] .... */
492
493static int __init pnp_setup_reserve_irq(char *str) 489static int __init pnp_setup_reserve_irq(char *str)
494{ 490{
495 int i; 491 int i;
@@ -503,7 +499,6 @@ static int __init pnp_setup_reserve_irq(char *str)
503__setup("pnp_reserve_irq=", pnp_setup_reserve_irq); 499__setup("pnp_reserve_irq=", pnp_setup_reserve_irq);
504 500
505/* format is: pnp_reserve_dma=dma1[,dma2] .... */ 501/* format is: pnp_reserve_dma=dma1[,dma2] .... */
506
507static int __init pnp_setup_reserve_dma(char *str) 502static int __init pnp_setup_reserve_dma(char *str)
508{ 503{
509 int i; 504 int i;
@@ -517,7 +512,6 @@ static int __init pnp_setup_reserve_dma(char *str)
517__setup("pnp_reserve_dma=", pnp_setup_reserve_dma); 512__setup("pnp_reserve_dma=", pnp_setup_reserve_dma);
518 513
519/* format is: pnp_reserve_io=io1,size1[,io2,size2] .... */ 514/* format is: pnp_reserve_io=io1,size1[,io2,size2] .... */
520
521static int __init pnp_setup_reserve_io(char *str) 515static int __init pnp_setup_reserve_io(char *str)
522{ 516{
523 int i; 517 int i;
@@ -531,7 +525,6 @@ static int __init pnp_setup_reserve_io(char *str)
531__setup("pnp_reserve_io=", pnp_setup_reserve_io); 525__setup("pnp_reserve_io=", pnp_setup_reserve_io);
532 526
533/* format is: pnp_reserve_mem=mem1,size1[,mem2,size2] .... */ 527/* format is: pnp_reserve_mem=mem1,size1[,mem2,size2] .... */
534
535static int __init pnp_setup_reserve_mem(char *str) 528static int __init pnp_setup_reserve_mem(char *str)
536{ 529{
537 int i; 530 int i;