PNP: add pnp_init_resources(struct pnp_dev *) interface
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Mon, 28 Apr 2008 22:34:09 +0000 (16:34 -0600)
committerLen Brown <len.brown@intel.com>
Tue, 29 Apr 2008 07:22:22 +0000 (03:22 -0400)
Add pnp_init_resources(struct pnp_dev *) to replace
pnp_init_resource_table(), which takes a pointer to the
pnp_resource_table itself.  Passing only the pnp_dev * reduces
the possibility for error in the caller and removes the
pnp_resource_table implementation detail from the interface.

Even though pnp_init_resource_table() is exported, I did not
export pnp_init_resources() because it is used only by the PNP
core.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-By: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/pnp/interface.c
drivers/pnp/isapnp/core.c
drivers/pnp/manager.c
drivers/pnp/pnpacpi/core.c
drivers/pnp/pnpacpi/rsparser.c
drivers/pnp/pnpbios/core.c
drivers/pnp/pnpbios/rsparser.c
include/linux/pnp.h

index e882896bdbd7c09ad47bc08357af8e9a23ba5bd9..cdc3ecfde6ef37df577c3215a6a3132e0e4171f1 100644 (file)
@@ -351,14 +351,14 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
        if (!strnicmp(buf, "auto", 4)) {
                if (dev->active)
                        goto done;
-               pnp_init_resource_table(&dev->res);
+               pnp_init_resources(dev);
                retval = pnp_auto_config_dev(dev);
                goto done;
        }
        if (!strnicmp(buf, "clear", 5)) {
                if (dev->active)
                        goto done;
-               pnp_init_resource_table(&dev->res);
+               pnp_init_resources(dev);
                goto done;
        }
        if (!strnicmp(buf, "get", 3)) {
@@ -373,7 +373,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
                if (dev->active)
                        goto done;
                buf += 3;
-               pnp_init_resource_table(&dev->res);
+               pnp_init_resources(dev);
                mutex_lock(&pnp_res_mutex);
                while (1) {
                        while (isspace(*buf))
index 6740016437d986f29abe39b63fd94862e5785c85..6f1007548c93c6b93ea73e86f2b08a6ce467fde7 100644 (file)
@@ -424,7 +424,7 @@ static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card,
        dev->capabilities |= PNP_READ;
        dev->capabilities |= PNP_WRITE;
        dev->capabilities |= PNP_DISABLE;
-       pnp_init_resource_table(&dev->res);
+       pnp_init_resources(dev);
        return dev;
 }
 
@@ -981,7 +981,7 @@ static int isapnp_get_resources(struct pnp_dev *dev)
        int ret;
 
        dev_dbg(&dev->dev, "get resources\n");
-       pnp_init_resource_table(&dev->res);
+       pnp_init_resources(dev);
        isapnp_cfg_begin(dev->card->number, dev->number);
        ret = isapnp_read_resources(dev);
        isapnp_cfg_end();
index 945c6201719d06d6604246666dfa91ba4898dd73..c9af87a8fb1657995e00f577fe23d2b3b02288cd 100644 (file)
@@ -272,6 +272,11 @@ void pnp_init_resource_table(struct pnp_resource_table *table)
        }
 }
 
+void pnp_init_resources(struct pnp_dev *dev)
+{
+       pnp_init_resource_table(&dev->res);
+}
+
 /**
  * pnp_clean_resources - clears resources that were not manually set
  * @res: the resources to clean
index 1ac894d2df5a5c8f802f1f044dda8d6fd8990914..7e4512a60f582ee8eae7979d6a536deb125df2ed 100644 (file)
@@ -212,7 +212,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
 
        /* clear out the damaged flags */
        if (!dev->active)
-               pnp_init_resource_table(&dev->res);
+               pnp_init_resources(dev);
        pnp_add_device(dev);
        num++;
 
index c5adf7631ac23613beb0ac926d30ce5a71535821..33dbf3644f2b49ed75b8e67b451f14eb5a92eb00 100644 (file)
@@ -410,8 +410,7 @@ acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *dev)
 
        dev_dbg(&dev->dev, "parse allocated resources\n");
 
-       /* Blank the resource table values */
-       pnp_init_resource_table(&dev->res);
+       pnp_init_resources(dev);
 
        return acpi_walk_resources(handle, METHOD_NAME__CRS,
                                   pnpacpi_allocated_resource, dev);
index 76d398531da6704174942672813c3f7a8136024b..f5477ca859565cc2834d0c7c16db2ed8d3255cbe 100644 (file)
@@ -347,7 +347,7 @@ static int __init insert_device(struct pnp_bios_node *node)
 
        /* clear out the damaged flags */
        if (!dev->active)
-               pnp_init_resource_table(&dev->res);
+               pnp_init_resources(dev);
 
        pnp_add_device(dev);
        pnpbios_interface_attach_device(node);
index 7428f62db4d28d1ac74a58f4297598cc4b5df904..e90a3d4360b2f631220264c72e4841de14b56222 100644 (file)
@@ -145,8 +145,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev,
 
        dev_dbg(&dev->dev, "parse allocated resources\n");
 
-       /* Blank the resource table values */
-       pnp_init_resource_table(&dev->res);
+       pnp_init_resources(dev);
 
        while ((char *)p < (char *)end) {
 
index 8d7c9bc2fdbbfef6ba5772738ea7c2fa73cee528..1737f071787a68a2ddd3d0cdb0b4d35306a3de12 100644 (file)
@@ -391,6 +391,7 @@ int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option,
 int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option,
                              struct pnp_mem *data);
 void pnp_init_resource_table(struct pnp_resource_table *table);
+void pnp_init_resources(struct pnp_dev *dev);
 int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
                          int mode);
 int pnp_auto_config_dev(struct pnp_dev *dev);
@@ -438,6 +439,7 @@ static inline int pnp_register_dma_resource(struct pnp_dev *dev, struct pnp_opti
 static inline int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_port *data) { return -ENODEV; }
 static inline int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_mem *data) { return -ENODEV; }
 static inline void pnp_init_resource_table(struct pnp_resource_table *table) { }
+static inline void pnp_init_resources(struct pnp_dev *dev) { }
 static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; }
 static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; }