aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pnp/base.h8
-rw-r--r--drivers/pnp/manager.c8
-rw-r--r--drivers/pnp/resource.c20
3 files changed, 16 insertions, 20 deletions
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index eb43fc6bff11..e739d4bba423 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -12,10 +12,10 @@ void pnp_free_option(struct pnp_option *option);
12int __pnp_add_device(struct pnp_dev *dev); 12int __pnp_add_device(struct pnp_dev *dev);
13void __pnp_remove_device(struct pnp_dev *dev); 13void __pnp_remove_device(struct pnp_dev *dev);
14 14
15int pnp_check_port(struct pnp_dev * dev, int idx); 15int pnp_check_port(struct pnp_dev *dev, struct resource *res);
16int pnp_check_mem(struct pnp_dev * dev, int idx); 16int pnp_check_mem(struct pnp_dev *dev, struct resource *res);
17int pnp_check_irq(struct pnp_dev * dev, int idx); 17int pnp_check_irq(struct pnp_dev *dev, struct resource *res);
18int pnp_check_dma(struct pnp_dev * dev, int idx); 18int pnp_check_dma(struct pnp_dev *dev, struct resource *res);
19 19
20void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc); 20void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
21 21
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index be21dec539d9..08865292fc95 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -51,7 +51,7 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
51 res->end = res->start + rule->size - 1; 51 res->end = res->start + rule->size - 1;
52 52
53 /* run through until pnp_check_port is happy */ 53 /* run through until pnp_check_port is happy */
54 while (!pnp_check_port(dev, idx)) { 54 while (!pnp_check_port(dev, res)) {
55 res->start += rule->align; 55 res->start += rule->align;
56 res->end = res->start + rule->size - 1; 56 res->end = res->start + rule->size - 1;
57 if (res->start > rule->max || !rule->align) { 57 if (res->start > rule->max || !rule->align) {
@@ -108,7 +108,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
108 res->end = res->start + rule->size - 1; 108 res->end = res->start + rule->size - 1;
109 109
110 /* run through until pnp_check_mem is happy */ 110 /* run through until pnp_check_mem is happy */
111 while (!pnp_check_mem(dev, idx)) { 111 while (!pnp_check_mem(dev, res)) {
112 res->start += rule->align; 112 res->start += rule->align;
113 res->end = res->start + rule->size - 1; 113 res->end = res->start + rule->size - 1;
114 if (res->start > rule->max || !rule->align) { 114 if (res->start > rule->max || !rule->align) {
@@ -167,7 +167,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
167 for (i = 0; i < 16; i++) { 167 for (i = 0; i < 16; i++) {
168 if (test_bit(xtab[i], rule->map)) { 168 if (test_bit(xtab[i], rule->map)) {
169 res->start = res->end = xtab[i]; 169 res->start = res->end = xtab[i];
170 if (pnp_check_irq(dev, idx)) { 170 if (pnp_check_irq(dev, res)) {
171 dev_dbg(&dev->dev, " assign irq %d %d\n", idx, 171 dev_dbg(&dev->dev, " assign irq %d %d\n", idx,
172 (int) res->start); 172 (int) res->start);
173 return 1; 173 return 1;
@@ -209,7 +209,7 @@ static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
209 for (i = 0; i < 8; i++) { 209 for (i = 0; i < 8; i++) {
210 if (rule->map & (1 << xtab[i])) { 210 if (rule->map & (1 << xtab[i])) {
211 res->start = res->end = xtab[i]; 211 res->start = res->end = xtab[i];
212 if (pnp_check_dma(dev, idx)) { 212 if (pnp_check_dma(dev, res)) {
213 dev_dbg(&dev->dev, " assign dma %d %d\n", idx, 213 dev_dbg(&dev->dev, " assign dma %d %d\n", idx,
214 (int) res->start); 214 (int) res->start);
215 return; 215 return;
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index eab16e5520ae..93bf45e01f2c 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -239,14 +239,13 @@ void pnp_free_option(struct pnp_option *option)
239#define cannot_compare(flags) \ 239#define cannot_compare(flags) \
240((flags) & (IORESOURCE_UNSET | IORESOURCE_DISABLED)) 240((flags) & (IORESOURCE_UNSET | IORESOURCE_DISABLED))
241 241
242int pnp_check_port(struct pnp_dev *dev, int idx) 242int pnp_check_port(struct pnp_dev *dev, struct resource *res)
243{ 243{
244 int i; 244 int i;
245 struct pnp_dev *tdev; 245 struct pnp_dev *tdev;
246 struct resource *res, *tres; 246 struct resource *tres;
247 resource_size_t *port, *end, *tport, *tend; 247 resource_size_t *port, *end, *tport, *tend;
248 248
249 res = &dev->res.port_resource[idx];
250 port = &res->start; 249 port = &res->start;
251 end = &res->end; 250 end = &res->end;
252 251
@@ -300,14 +299,13 @@ int pnp_check_port(struct pnp_dev *dev, int idx)
300 return 1; 299 return 1;
301} 300}
302 301
303int pnp_check_mem(struct pnp_dev *dev, int idx) 302int pnp_check_mem(struct pnp_dev *dev, struct resource *res)
304{ 303{
305 int i; 304 int i;
306 struct pnp_dev *tdev; 305 struct pnp_dev *tdev;
307 struct resource *res, *tres; 306 struct resource *tres;
308 resource_size_t *addr, *end, *taddr, *tend; 307 resource_size_t *addr, *end, *taddr, *tend;
309 308
310 res = &dev->res.mem_resource[idx];
311 addr = &res->start; 309 addr = &res->start;
312 end = &res->end; 310 end = &res->end;
313 311
@@ -366,14 +364,13 @@ static irqreturn_t pnp_test_handler(int irq, void *dev_id)
366 return IRQ_HANDLED; 364 return IRQ_HANDLED;
367} 365}
368 366
369int pnp_check_irq(struct pnp_dev *dev, int idx) 367int pnp_check_irq(struct pnp_dev *dev, struct resource *res)
370{ 368{
371 int i; 369 int i;
372 struct pnp_dev *tdev; 370 struct pnp_dev *tdev;
373 struct resource *res, *tres; 371 struct resource *tres;
374 resource_size_t *irq; 372 resource_size_t *irq;
375 373
376 res = &dev->res.irq_resource[idx];
377 irq = &res->start; 374 irq = &res->start;
378 375
379 /* if the resource doesn't exist, don't complain about it */ 376 /* if the resource doesn't exist, don't complain about it */
@@ -439,15 +436,14 @@ int pnp_check_irq(struct pnp_dev *dev, int idx)
439 return 1; 436 return 1;
440} 437}
441 438
442int pnp_check_dma(struct pnp_dev *dev, int idx) 439int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
443{ 440{
444#ifndef CONFIG_IA64 441#ifndef CONFIG_IA64
445 int i; 442 int i;
446 struct pnp_dev *tdev; 443 struct pnp_dev *tdev;
447 struct resource *res, *tres; 444 struct resource *tres;
448 resource_size_t *dma; 445 resource_size_t *dma;
449 446
450 res = &dev->res.dma_resource[idx];
451 dma = &res->start; 447 dma = &res->start;
452 448
453 /* if the resource doesn't exist, don't complain about it */ 449 /* if the resource doesn't exist, don't complain about it */