diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:26 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:26 -0400 |
commit | 95ab3669f7830682c7762e9c305a0c1dd44454cc (patch) | |
tree | 2a858bc0a51d46a5873b3b3fe9fbbbecc8c32aa8 /drivers/pnp/system.c | |
parent | f6505fef18644557f732468c1f22f84560d8a819 (diff) |
PNP: remove PNP_MAX_* uses
Remove some PNP_MAX_* uses. The pnp_resource_table isn't
dynamic yet, but with pnp_get_resource(), we can start moving
away from the table size constants.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/system.c')
-rw-r--r-- | drivers/pnp/system.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c index 55c4563986b3..9c2496dbeee4 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 | ||
57 | static void reserve_resources_of_dev(struct pnp_dev *dev) | 57 | static 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 | ||