diff options
-rw-r--r-- | drivers/pnp/interface.c | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index 7fc86bbed88e..674e8ba0377f 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -248,8 +248,9 @@ 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 pnp_resource *pnp_res; | ||
251 | struct resource *res; | 252 | struct resource *res; |
252 | int i, ret; | 253 | int ret; |
253 | pnp_info_buffer_t *buffer; | 254 | pnp_info_buffer_t *buffer; |
254 | 255 | ||
255 | if (!dev) | 256 | if (!dev) |
@@ -262,46 +263,33 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, | |||
262 | buffer->buffer = buf; | 263 | buffer->buffer = buf; |
263 | buffer->curr = buffer->buffer; | 264 | buffer->curr = buffer->buffer; |
264 | 265 | ||
265 | pnp_printf(buffer, "state = "); | 266 | pnp_printf(buffer, "state = %s\n", dev->active ? "active" : "disabled"); |
266 | if (dev->active) | ||
267 | pnp_printf(buffer, "active\n"); | ||
268 | else | ||
269 | pnp_printf(buffer, "disabled\n"); | ||
270 | 267 | ||
271 | for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_IO, i)); i++) { | 268 | list_for_each_entry(pnp_res, &dev->resources, list) { |
272 | pnp_printf(buffer, "io"); | 269 | res = &pnp_res->res; |
273 | if (res->flags & IORESOURCE_DISABLED) | 270 | |
274 | pnp_printf(buffer, " disabled\n"); | 271 | pnp_printf(buffer, pnp_resource_type_name(res)); |
275 | else | 272 | |
276 | pnp_printf(buffer, " 0x%llx-0x%llx\n", | 273 | if (res->flags & IORESOURCE_DISABLED) { |
277 | (unsigned long long) res->start, | ||
278 | (unsigned long long) res->end); | ||
279 | } | ||
280 | for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) { | ||
281 | pnp_printf(buffer, "mem"); | ||
282 | if (res->flags & IORESOURCE_DISABLED) | ||
283 | pnp_printf(buffer, " disabled\n"); | 274 | pnp_printf(buffer, " disabled\n"); |
284 | else | 275 | continue; |
285 | pnp_printf(buffer, " 0x%llx-0x%llx\n", | 276 | } |
277 | |||
278 | switch (pnp_resource_type(res)) { | ||
279 | case IORESOURCE_IO: | ||
280 | case IORESOURCE_MEM: | ||
281 | pnp_printf(buffer, " %#llx-%#llx\n", | ||
286 | (unsigned long long) res->start, | 282 | (unsigned long long) res->start, |
287 | (unsigned long long) res->end); | 283 | (unsigned long long) res->end); |
288 | } | 284 | break; |
289 | for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_IRQ, i)); i++) { | 285 | case IORESOURCE_IRQ: |
290 | pnp_printf(buffer, "irq"); | 286 | case IORESOURCE_DMA: |
291 | if (res->flags & IORESOURCE_DISABLED) | ||
292 | pnp_printf(buffer, " disabled\n"); | ||
293 | else | ||
294 | pnp_printf(buffer, " %lld\n", | ||
295 | (unsigned long long) res->start); | ||
296 | } | ||
297 | for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_DMA, i)); i++) { | ||
298 | pnp_printf(buffer, "dma"); | ||
299 | if (res->flags & IORESOURCE_DISABLED) | ||
300 | pnp_printf(buffer, " disabled\n"); | ||
301 | else | ||
302 | pnp_printf(buffer, " %lld\n", | 287 | pnp_printf(buffer, " %lld\n", |
303 | (unsigned long long) res->start); | 288 | (unsigned long long) res->start); |
289 | break; | ||
290 | } | ||
304 | } | 291 | } |
292 | |||
305 | ret = (buffer->curr - buf); | 293 | ret = (buffer->curr - buf); |
306 | kfree(buffer); | 294 | kfree(buffer); |
307 | return ret; | 295 | return ret; |