diff options
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/interface.c | 36 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 8 | ||||
-rw-r--r-- | drivers/pnp/quirks.c | 13 | ||||
-rw-r--r-- | drivers/pnp/resource.c | 10 | ||||
-rw-r--r-- | drivers/pnp/support.c | 43 | ||||
-rw-r--r-- | drivers/pnp/system.c | 14 |
6 files changed, 33 insertions, 91 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index c3f1c8e9d254..68b0c04987e4 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -310,8 +310,7 @@ static ssize_t pnp_set_current_resources(struct device *dmdev, | |||
310 | goto done; | 310 | goto done; |
311 | } | 311 | } |
312 | 312 | ||
313 | while (isspace(*buf)) | 313 | buf = skip_spaces(buf); |
314 | ++buf; | ||
315 | if (!strnicmp(buf, "disable", 7)) { | 314 | if (!strnicmp(buf, "disable", 7)) { |
316 | retval = pnp_disable_dev(dev); | 315 | retval = pnp_disable_dev(dev); |
317 | goto done; | 316 | goto done; |
@@ -353,19 +352,13 @@ static ssize_t pnp_set_current_resources(struct device *dmdev, | |||
353 | pnp_init_resources(dev); | 352 | pnp_init_resources(dev); |
354 | mutex_lock(&pnp_res_mutex); | 353 | mutex_lock(&pnp_res_mutex); |
355 | while (1) { | 354 | while (1) { |
356 | while (isspace(*buf)) | 355 | buf = skip_spaces(buf); |
357 | ++buf; | ||
358 | if (!strnicmp(buf, "io", 2)) { | 356 | if (!strnicmp(buf, "io", 2)) { |
359 | buf += 2; | 357 | buf = skip_spaces(buf + 2); |
360 | while (isspace(*buf)) | ||
361 | ++buf; | ||
362 | start = simple_strtoul(buf, &buf, 0); | 358 | start = simple_strtoul(buf, &buf, 0); |
363 | while (isspace(*buf)) | 359 | buf = skip_spaces(buf); |
364 | ++buf; | ||
365 | if (*buf == '-') { | 360 | if (*buf == '-') { |
366 | buf += 1; | 361 | buf = skip_spaces(buf + 1); |
367 | while (isspace(*buf)) | ||
368 | ++buf; | ||
369 | end = simple_strtoul(buf, &buf, 0); | 362 | end = simple_strtoul(buf, &buf, 0); |
370 | } else | 363 | } else |
371 | end = start; | 364 | end = start; |
@@ -373,16 +366,11 @@ static ssize_t pnp_set_current_resources(struct device *dmdev, | |||
373 | continue; | 366 | continue; |
374 | } | 367 | } |
375 | if (!strnicmp(buf, "mem", 3)) { | 368 | if (!strnicmp(buf, "mem", 3)) { |
376 | buf += 3; | 369 | buf = skip_spaces(buf + 3); |
377 | while (isspace(*buf)) | ||
378 | ++buf; | ||
379 | start = simple_strtoul(buf, &buf, 0); | 370 | start = simple_strtoul(buf, &buf, 0); |
380 | while (isspace(*buf)) | 371 | buf = skip_spaces(buf); |
381 | ++buf; | ||
382 | if (*buf == '-') { | 372 | if (*buf == '-') { |
383 | buf += 1; | 373 | buf = skip_spaces(buf + 1); |
384 | while (isspace(*buf)) | ||
385 | ++buf; | ||
386 | end = simple_strtoul(buf, &buf, 0); | 374 | end = simple_strtoul(buf, &buf, 0); |
387 | } else | 375 | } else |
388 | end = start; | 376 | end = start; |
@@ -390,17 +378,13 @@ static ssize_t pnp_set_current_resources(struct device *dmdev, | |||
390 | continue; | 378 | continue; |
391 | } | 379 | } |
392 | if (!strnicmp(buf, "irq", 3)) { | 380 | if (!strnicmp(buf, "irq", 3)) { |
393 | buf += 3; | 381 | buf = skip_spaces(buf + 3); |
394 | while (isspace(*buf)) | ||
395 | ++buf; | ||
396 | start = simple_strtoul(buf, &buf, 0); | 382 | start = simple_strtoul(buf, &buf, 0); |
397 | pnp_add_irq_resource(dev, start, 0); | 383 | pnp_add_irq_resource(dev, start, 0); |
398 | continue; | 384 | continue; |
399 | } | 385 | } |
400 | if (!strnicmp(buf, "dma", 3)) { | 386 | if (!strnicmp(buf, "dma", 3)) { |
401 | buf += 3; | 387 | buf = skip_spaces(buf + 3); |
402 | while (isspace(*buf)) | ||
403 | ++buf; | ||
404 | start = simple_strtoul(buf, &buf, 0); | 388 | start = simple_strtoul(buf, &buf, 0); |
405 | pnp_add_dma_resource(dev, start, 0); | 389 | pnp_add_dma_resource(dev, start, 0); |
406 | continue; | 390 | continue; |
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 87b4f49a5251..a5135ebe5f07 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -191,7 +191,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev, | |||
191 | return (unsigned char *)p; | 191 | return (unsigned char *)p; |
192 | break; | 192 | break; |
193 | 193 | ||
194 | default: /* an unkown tag */ | 194 | default: /* an unknown tag */ |
195 | len_err: | 195 | len_err: |
196 | dev_err(&dev->dev, "unknown tag %#x length %d\n", | 196 | dev_err(&dev->dev, "unknown tag %#x length %d\n", |
197 | tag, len); | 197 | tag, len); |
@@ -405,7 +405,7 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end, | |||
405 | case SMALL_TAG_END: | 405 | case SMALL_TAG_END: |
406 | return p + 2; | 406 | return p + 2; |
407 | 407 | ||
408 | default: /* an unkown tag */ | 408 | default: /* an unknown tag */ |
409 | len_err: | 409 | len_err: |
410 | dev_err(&dev->dev, "unknown tag %#x length %d\n", | 410 | dev_err(&dev->dev, "unknown tag %#x length %d\n", |
411 | tag, len); | 411 | tag, len); |
@@ -475,7 +475,7 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p, | |||
475 | return (unsigned char *)p; | 475 | return (unsigned char *)p; |
476 | break; | 476 | break; |
477 | 477 | ||
478 | default: /* an unkown tag */ | 478 | default: /* an unknown tag */ |
479 | len_err: | 479 | len_err: |
480 | dev_err(&dev->dev, "unknown tag %#x length %d\n", | 480 | dev_err(&dev->dev, "unknown tag %#x length %d\n", |
481 | tag, len); | 481 | tag, len); |
@@ -744,7 +744,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev | |||
744 | return (unsigned char *)p; | 744 | return (unsigned char *)p; |
745 | break; | 745 | break; |
746 | 746 | ||
747 | default: /* an unkown tag */ | 747 | default: /* an unknown tag */ |
748 | len_err: | 748 | len_err: |
749 | dev_err(&dev->dev, "unknown tag %#x length %d\n", | 749 | dev_err(&dev->dev, "unknown tag %#x length %d\n", |
750 | tag, len); | 750 | tag, len); |
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index 8473fe5ed7ff..dfbd5a6cc58b 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -285,15 +285,10 @@ static void quirk_system_pci_resources(struct pnp_dev *dev) | |||
285 | * the PCI region, and that might prevent a PCI | 285 | * the PCI region, and that might prevent a PCI |
286 | * driver from requesting its resources. | 286 | * driver from requesting its resources. |
287 | */ | 287 | */ |
288 | dev_warn(&dev->dev, "%s resource " | 288 | dev_warn(&dev->dev, |
289 | "(0x%llx-0x%llx) overlaps %s BAR %d " | 289 | "disabling %pR because it overlaps " |
290 | "(0x%llx-0x%llx), disabling\n", | 290 | "%s BAR %d %pR\n", res, |
291 | pnp_resource_type_name(res), | 291 | pci_name(pdev), i, &pdev->resource[i]); |
292 | (unsigned long long) pnp_start, | ||
293 | (unsigned long long) pnp_end, | ||
294 | pci_name(pdev), i, | ||
295 | (unsigned long long) pci_start, | ||
296 | (unsigned long long) pci_end); | ||
297 | res->flags |= IORESOURCE_DISABLED; | 292 | res->flags |= IORESOURCE_DISABLED; |
298 | } | 293 | } |
299 | } | 294 | } |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index ba9765427886..64d0596bafb5 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -517,7 +517,7 @@ struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq, | |||
517 | res->start = irq; | 517 | res->start = irq; |
518 | res->end = irq; | 518 | res->end = irq; |
519 | 519 | ||
520 | pnp_dbg(&dev->dev, " add irq %d flags %#x\n", irq, flags); | 520 | pnp_dbg(&dev->dev, " add %pr\n", res); |
521 | return pnp_res; | 521 | return pnp_res; |
522 | } | 522 | } |
523 | 523 | ||
@@ -538,7 +538,7 @@ struct pnp_resource *pnp_add_dma_resource(struct pnp_dev *dev, int dma, | |||
538 | res->start = dma; | 538 | res->start = dma; |
539 | res->end = dma; | 539 | res->end = dma; |
540 | 540 | ||
541 | pnp_dbg(&dev->dev, " add dma %d flags %#x\n", dma, flags); | 541 | pnp_dbg(&dev->dev, " add %pr\n", res); |
542 | return pnp_res; | 542 | return pnp_res; |
543 | } | 543 | } |
544 | 544 | ||
@@ -562,8 +562,7 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev, | |||
562 | res->start = start; | 562 | res->start = start; |
563 | res->end = end; | 563 | res->end = end; |
564 | 564 | ||
565 | pnp_dbg(&dev->dev, " add io %#llx-%#llx flags %#x\n", | 565 | pnp_dbg(&dev->dev, " add %pr\n", res); |
566 | (unsigned long long) start, (unsigned long long) end, flags); | ||
567 | return pnp_res; | 566 | return pnp_res; |
568 | } | 567 | } |
569 | 568 | ||
@@ -587,8 +586,7 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, | |||
587 | res->start = start; | 586 | res->start = start; |
588 | res->end = end; | 587 | res->end = end; |
589 | 588 | ||
590 | pnp_dbg(&dev->dev, " add mem %#llx-%#llx flags %#x\n", | 589 | pnp_dbg(&dev->dev, " add %pr\n", res); |
591 | (unsigned long long) start, (unsigned long long) end, flags); | ||
592 | return pnp_res; | 590 | return pnp_res; |
593 | } | 591 | } |
594 | 592 | ||
diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c index 63087d5ce609..9585c1c1cc36 100644 --- a/drivers/pnp/support.c +++ b/drivers/pnp/support.c | |||
@@ -75,47 +75,14 @@ char *pnp_resource_type_name(struct resource *res) | |||
75 | 75 | ||
76 | void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc) | 76 | void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc) |
77 | { | 77 | { |
78 | char buf[128]; | ||
79 | int len; | ||
80 | struct pnp_resource *pnp_res; | 78 | struct pnp_resource *pnp_res; |
81 | struct resource *res; | ||
82 | 79 | ||
83 | if (list_empty(&dev->resources)) { | 80 | if (list_empty(&dev->resources)) |
84 | pnp_dbg(&dev->dev, "%s: no current resources\n", desc); | 81 | pnp_dbg(&dev->dev, "%s: no current resources\n", desc); |
85 | return; | 82 | else { |
86 | } | 83 | pnp_dbg(&dev->dev, "%s: current resources:\n", desc); |
87 | 84 | list_for_each_entry(pnp_res, &dev->resources, list) | |
88 | pnp_dbg(&dev->dev, "%s: current resources:\n", desc); | 85 | pnp_dbg(&dev->dev, "%pr\n", &pnp_res->res); |
89 | list_for_each_entry(pnp_res, &dev->resources, list) { | ||
90 | res = &pnp_res->res; | ||
91 | len = 0; | ||
92 | |||
93 | len += scnprintf(buf + len, sizeof(buf) - len, " %-3s ", | ||
94 | pnp_resource_type_name(res)); | ||
95 | |||
96 | if (res->flags & IORESOURCE_DISABLED) { | ||
97 | pnp_dbg(&dev->dev, "%sdisabled\n", buf); | ||
98 | continue; | ||
99 | } | ||
100 | |||
101 | switch (pnp_resource_type(res)) { | ||
102 | case IORESOURCE_IO: | ||
103 | case IORESOURCE_MEM: | ||
104 | len += scnprintf(buf + len, sizeof(buf) - len, | ||
105 | "%#llx-%#llx flags %#lx", | ||
106 | (unsigned long long) res->start, | ||
107 | (unsigned long long) res->end, | ||
108 | res->flags); | ||
109 | break; | ||
110 | case IORESOURCE_IRQ: | ||
111 | case IORESOURCE_DMA: | ||
112 | len += scnprintf(buf + len, sizeof(buf) - len, | ||
113 | "%lld flags %#lx", | ||
114 | (unsigned long long) res->start, | ||
115 | res->flags); | ||
116 | break; | ||
117 | } | ||
118 | pnp_dbg(&dev->dev, "%s\n", buf); | ||
119 | } | 86 | } |
120 | } | 87 | } |
121 | 88 | ||
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c index 59b90922da8c..49c1720df59a 100644 --- a/drivers/pnp/system.c +++ b/drivers/pnp/system.c | |||
@@ -22,11 +22,11 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
22 | {"", 0} | 22 | {"", 0} |
23 | }; | 23 | }; |
24 | 24 | ||
25 | static void reserve_range(struct pnp_dev *dev, resource_size_t start, | 25 | static void reserve_range(struct pnp_dev *dev, struct resource *r, int port) |
26 | resource_size_t end, int port) | ||
27 | { | 26 | { |
28 | char *regionid; | 27 | char *regionid; |
29 | const char *pnpid = dev_name(&dev->dev); | 28 | const char *pnpid = dev_name(&dev->dev); |
29 | resource_size_t start = r->start, end = r->end; | ||
30 | struct resource *res; | 30 | struct resource *res; |
31 | 31 | ||
32 | regionid = kmalloc(16, GFP_KERNEL); | 32 | regionid = kmalloc(16, GFP_KERNEL); |
@@ -48,10 +48,8 @@ static void reserve_range(struct pnp_dev *dev, resource_size_t start, | |||
48 | * example do reserve stuff they know about too, so we may well | 48 | * example do reserve stuff they know about too, so we may well |
49 | * have double reservations. | 49 | * have double reservations. |
50 | */ | 50 | */ |
51 | dev_info(&dev->dev, "%s range 0x%llx-0x%llx %s reserved\n", | 51 | dev_info(&dev->dev, "%pR %s reserved\n", r, |
52 | port ? "ioport" : "iomem", | 52 | res ? "has been" : "could not be"); |
53 | (unsigned long long) start, (unsigned long long) end, | ||
54 | res ? "has been" : "could not be"); | ||
55 | } | 53 | } |
56 | 54 | ||
57 | static void reserve_resources_of_dev(struct pnp_dev *dev) | 55 | static void reserve_resources_of_dev(struct pnp_dev *dev) |
@@ -77,14 +75,14 @@ static void reserve_resources_of_dev(struct pnp_dev *dev) | |||
77 | if (res->end < res->start) | 75 | if (res->end < res->start) |
78 | continue; /* invalid */ | 76 | continue; /* invalid */ |
79 | 77 | ||
80 | reserve_range(dev, res->start, res->end, 1); | 78 | reserve_range(dev, res, 1); |
81 | } | 79 | } |
82 | 80 | ||
83 | for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) { | 81 | for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) { |
84 | if (res->flags & IORESOURCE_DISABLED) | 82 | if (res->flags & IORESOURCE_DISABLED) |
85 | continue; | 83 | continue; |
86 | 84 | ||
87 | reserve_range(dev, res->start, res->end, 0); | 85 | reserve_range(dev, res, 0); |
88 | } | 86 | } |
89 | } | 87 | } |
90 | 88 | ||