PNP used to have a fixed-size pnp_resource_table for tracking the
resources used by a device. This table often overflowed, so we've
had to increase the table size, which wastes memory because most
devices have very few resources.
This patch replaces the table with a linked list of resources where
the entries are allocated on demand.
This removes messages like these:
pnpacpi: exceeded the max number of IO resources
00:01: too many PORTs (max 40)
References:
http://bugzilla.kernel.org/show_bug.cgi?id=9535
http://bugzilla.kernel.org/show_bug.cgi?id=9740
http://lkml.org/lkml/2007/11/30/110
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
drivers/pnp/base.h | 13 --------
drivers/pnp/core.c | 20 +++++++-----
drivers/pnp/isapnp/core.c | 56 ++++++++++++++--------------------
drivers/pnp/manager.c | 33 +++++---------------
drivers/pnp/resource.c | 74 +++++++++++++---------------------------------
include/linux/pnp.h | 3 -
6 files changed, 68 insertions(+), 131 deletions(-)
Index: work8/drivers/pnp/base.h
===================================================================
--- work8.orig/drivers/pnp/base.h 2008-04-18 12:33:55.000000000 -0600
+++ work8/drivers/pnp/base.h 2008-04-18 12:33:56.000000000 -0600
@@ -20,23 +20,12 @@
void pnp_init_resource(struct resource *res);
int pnp_resource_type(struct resource *res);
-#define PNP_MAX_PORT 40
-#define PNP_MAX_MEM 24
-#define PNP_MAX_IRQ 2
-#define PNP_MAX_DMA 2
-
struct pnp_resource {
+ struct list_head list;
struct resource res;
unsigned int index; /* ISAPNP config register index */
};
-struct pnp_resource_table {
- struct pnp_resource port[PNP_MAX_PORT];
- struct pnp_resource mem[PNP_MAX_MEM];
- struct pnp_resource dma[PNP_MAX_DMA];
- struct pnp_resource irq[PNP_MAX_IRQ];
-};
-
struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq,
int flags);
struct pnp_resource ...