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/interface.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/interface.c')
-rw-r--r-- | drivers/pnp/interface.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index a608054a3e5..e9e66ed4fa3 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -248,6 +248,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, | |||
248 | char *buf) | 248 | char *buf) |
249 | { | 249 | { |
250 | struct pnp_dev *dev = to_pnp_dev(dmdev); | 250 | struct pnp_dev *dev = to_pnp_dev(dmdev); |
251 | struct resource *res; | ||
251 | int i, ret; | 252 | int i, ret; |
252 | pnp_info_buffer_t *buffer; | 253 | pnp_info_buffer_t *buffer; |
253 | 254 | ||
@@ -267,50 +268,46 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, | |||
267 | else | 268 | else |
268 | pnp_printf(buffer, "disabled\n"); | 269 | pnp_printf(buffer, "disabled\n"); |
269 | 270 | ||
270 | for (i = 0; i < PNP_MAX_PORT; i++) { | 271 | for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_IO, i)); i++) { |
271 | if (pnp_port_valid(dev, i)) { | 272 | if (pnp_resource_valid(res)) { |
272 | pnp_printf(buffer, "io"); | 273 | pnp_printf(buffer, "io"); |
273 | if (pnp_port_flags(dev, i) & IORESOURCE_DISABLED) | 274 | if (res->flags & IORESOURCE_DISABLED) |
274 | pnp_printf(buffer, " disabled\n"); | 275 | pnp_printf(buffer, " disabled\n"); |
275 | else | 276 | else |
276 | pnp_printf(buffer, " 0x%llx-0x%llx\n", | 277 | pnp_printf(buffer, " 0x%llx-0x%llx\n", |
277 | (unsigned long long) | 278 | (unsigned long long) res->start, |
278 | pnp_port_start(dev, i), | 279 | (unsigned long long) res->end); |
279 | (unsigned long long)pnp_port_end(dev, | ||
280 | i)); | ||
281 | } | 280 | } |
282 | } | 281 | } |
283 | for (i = 0; i < PNP_MAX_MEM; i++) { | 282 | for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) { |
284 | if (pnp_mem_valid(dev, i)) { | 283 | if (pnp_resource_valid(res)) { |
285 | pnp_printf(buffer, "mem"); | 284 | pnp_printf(buffer, "mem"); |
286 | if (pnp_mem_flags(dev, i) & IORESOURCE_DISABLED) | 285 | if (res->flags & IORESOURCE_DISABLED) |
287 | pnp_printf(buffer, " disabled\n"); | 286 | pnp_printf(buffer, " disabled\n"); |
288 | else | 287 | else |
289 | pnp_printf(buffer, " 0x%llx-0x%llx\n", | 288 | pnp_printf(buffer, " 0x%llx-0x%llx\n", |
290 | (unsigned long long) | 289 | (unsigned long long) res->start, |
291 | pnp_mem_start(dev, i), | 290 | (unsigned long long) res->end); |
292 | (unsigned long long)pnp_mem_end(dev, | ||
293 | i)); | ||
294 | } | 291 | } |
295 | } | 292 | } |
296 | for (i = 0; i < PNP_MAX_IRQ; i++) { | 293 | for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_IRQ, i)); i++) { |
297 | if (pnp_irq_valid(dev, i)) { | 294 | if (pnp_resource_valid(res)) { |
298 | pnp_printf(buffer, "irq"); | 295 | pnp_printf(buffer, "irq"); |
299 | if (pnp_irq_flags(dev, i) & IORESOURCE_DISABLED) | 296 | if (res->flags & IORESOURCE_DISABLED) |
300 | pnp_printf(buffer, " disabled\n"); | 297 | pnp_printf(buffer, " disabled\n"); |
301 | else | 298 | else |
302 | pnp_printf(buffer, " %lld\n", | 299 | pnp_printf(buffer, " %lld\n", |
303 | (unsigned long long)pnp_irq(dev, i)); | 300 | (unsigned long long) res->start); |
304 | } | 301 | } |
305 | } | 302 | } |
306 | for (i = 0; i < PNP_MAX_DMA; i++) { | 303 | for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_DMA, i)); i++) { |
307 | if (pnp_dma_valid(dev, i)) { | 304 | if (pnp_resource_valid(res)) { |
308 | pnp_printf(buffer, "dma"); | 305 | pnp_printf(buffer, "dma"); |
309 | if (pnp_dma_flags(dev, i) & IORESOURCE_DISABLED) | 306 | if (res->flags & IORESOURCE_DISABLED) |
310 | pnp_printf(buffer, " disabled\n"); | 307 | pnp_printf(buffer, " disabled\n"); |
311 | else | 308 | else |
312 | pnp_printf(buffer, " %lld\n", | 309 | pnp_printf(buffer, " %lld\n", |
313 | (unsigned long long)pnp_dma(dev, i)); | 310 | (unsigned long long) res->start); |
314 | } | 311 | } |
315 | } | 312 | } |
316 | ret = (buffer->curr - buf); | 313 | ret = (buffer->curr - buf); |