aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/system.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/system.c')
-rw-r--r--drivers/pnp/system.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c
index 55c4563986b..9c2496dbeee 100644
--- a/drivers/pnp/system.c
+++ b/drivers/pnp/system.c
@@ -56,14 +56,15 @@ static void reserve_range(struct pnp_dev *dev, resource_size_t start,
56 56
57static void reserve_resources_of_dev(struct pnp_dev *dev) 57static void reserve_resources_of_dev(struct pnp_dev *dev)
58{ 58{
59 struct resource *res;
59 int i; 60 int i;
60 61
61 for (i = 0; i < PNP_MAX_PORT; i++) { 62 for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_IO, i)); i++) {
62 if (!pnp_port_valid(dev, i)) 63 if (res->flags & IORESOURCE_UNSET)
63 continue; 64 continue;
64 if (pnp_port_start(dev, i) == 0) 65 if (res->start == 0)
65 continue; /* disabled */ 66 continue; /* disabled */
66 if (pnp_port_start(dev, i) < 0x100) 67 if (res->start < 0x100)
67 /* 68 /*
68 * Below 0x100 is only standard PC hardware 69 * Below 0x100 is only standard PC hardware
69 * (pics, kbd, timer, dma, ...) 70 * (pics, kbd, timer, dma, ...)
@@ -73,19 +74,17 @@ static void reserve_resources_of_dev(struct pnp_dev *dev)
73 * So, do nothing 74 * So, do nothing
74 */ 75 */
75 continue; 76 continue;
76 if (pnp_port_end(dev, i) < pnp_port_start(dev, i)) 77 if (res->end < res->start)
77 continue; /* invalid */ 78 continue; /* invalid */
78 79
79 reserve_range(dev, pnp_port_start(dev, i), 80 reserve_range(dev, res->start, res->end, 1);
80 pnp_port_end(dev, i), 1);
81 } 81 }
82 82
83 for (i = 0; i < PNP_MAX_MEM; i++) { 83 for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) {
84 if (!pnp_mem_valid(dev, i)) 84 if (res->flags & IORESOURCE_UNSET)
85 continue; 85 continue;
86 86
87 reserve_range(dev, pnp_mem_start(dev, i), 87 reserve_range(dev, res->start, res->end, 0);
88 pnp_mem_end(dev, i), 0);
89 } 88 }
90} 89}
91 90