PNP: remove pnp_resource_table from internal get/set interfaces
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Mon, 28 Apr 2008 22:34:05 +0000 (16:34 -0600)
committerLen Brown <len.brown@intel.com>
Tue, 29 Apr 2008 07:22:21 +0000 (03:22 -0400)
When we call protocol->get() and protocol->set() methods, we currently
supply pointers to both the pnp_dev and the pnp_resource_table even
though the pnp_resource_table should always be the one associated with
the pnp_dev.

This removes the pnp_resource_table arguments to make it clear that
these methods only operate on the specified pnp_dev.

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/pnpbios/core.c
include/linux/pnp.h

index 982658477a58b4695df2ac979b00090cba9b1101..e882896bdbd7c09ad47bc08357af8e9a23ba5bd9 100644 (file)
@@ -364,7 +364,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
        if (!strnicmp(buf, "get", 3)) {
                mutex_lock(&pnp_res_mutex);
                if (pnp_can_read(dev))
-                       dev->protocol->get(dev, &dev->res);
+                       dev->protocol->get(dev);
                mutex_unlock(&pnp_res_mutex);
                goto done;
        }
index 38ff64dce9c047d21e69acc53a87f58f9795591e..1ae3d8996156ec3ca0ce6c3df34cb8ba3a25f0d5 100644 (file)
@@ -976,21 +976,20 @@ static int isapnp_read_resources(struct pnp_dev *dev,
        return 0;
 }
 
-static int isapnp_get_resources(struct pnp_dev *dev,
-                               struct pnp_resource_table *res)
+static int isapnp_get_resources(struct pnp_dev *dev)
 {
        int ret;
 
-       pnp_init_resource_table(res);
+       pnp_init_resource_table(&dev->res);
        isapnp_cfg_begin(dev->card->number, dev->number);
-       ret = isapnp_read_resources(dev, res);
+       ret = isapnp_read_resources(dev, &dev->res);
        isapnp_cfg_end();
        return ret;
 }
 
-static int isapnp_set_resources(struct pnp_dev *dev,
-                               struct pnp_resource_table *res)
+static int isapnp_set_resources(struct pnp_dev *dev)
 {
+       struct pnp_resource_table *res = &dev->res;
        int tmp;
 
        isapnp_cfg_begin(dev->card->number, dev->number);
index c28caf272c1167f13c761da916af4a0983d878da..6a1f0b0b24b35b6726b7f577a6db7e4eb5dbbfdc 100644 (file)
@@ -473,7 +473,7 @@ int pnp_start_dev(struct pnp_dev *dev)
                return -EINVAL;
        }
 
-       if (dev->protocol->set(dev, &dev->res) < 0) {
+       if (dev->protocol->set(dev) < 0) {
                dev_err(&dev->dev, "activation failed\n");
                return -EIO;
        }
index 27546873880c7fa0ad79f04258cf4633923d0342..590fbcb0ee89852fa3b250acd2810880dfb1c8de 100644 (file)
@@ -73,8 +73,7 @@ static int __init ispnpidacpi(char *id)
        return 1;
 }
 
-static int pnpacpi_get_resources(struct pnp_dev *dev,
-                                struct pnp_resource_table *res)
+static int pnpacpi_get_resources(struct pnp_dev *dev)
 {
        acpi_status status;
 
@@ -83,8 +82,7 @@ static int pnpacpi_get_resources(struct pnp_dev *dev,
        return ACPI_FAILURE(status) ? -ENODEV : 0;
 }
 
-static int pnpacpi_set_resources(struct pnp_dev *dev,
-                                struct pnp_resource_table *res)
+static int pnpacpi_set_resources(struct pnp_dev *dev)
 {
        acpi_handle handle = dev->data;
        struct acpi_buffer buffer;
@@ -94,7 +92,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev,
        ret = pnpacpi_build_resource_template(dev, &buffer);
        if (ret)
                return ret;
-       ret = pnpacpi_encode_resources(res, &buffer);
+       ret = pnpacpi_encode_resources(&dev->res, &buffer);
        if (ret) {
                kfree(buffer.pointer);
                return ret;
index 6af2be2c1d67b972685194b75b9cd0c57f642bcd..9852755b5590467ce1839fa31a4ea5dab1e102d3 100644 (file)
@@ -204,8 +204,7 @@ static int pnp_dock_thread(void *unused)
 
 #endif                         /* CONFIG_HOTPLUG */
 
-static int pnpbios_get_resources(struct pnp_dev *dev,
-                                struct pnp_resource_table *res)
+static int pnpbios_get_resources(struct pnp_dev *dev)
 {
        u8 nodenum = dev->number;
        struct pnp_bios_node *node;
@@ -220,14 +219,13 @@ static int pnpbios_get_resources(struct pnp_dev *dev,
                kfree(node);
                return -ENODEV;
        }
-       pnpbios_read_resources_from_node(res, node);
+       pnpbios_read_resources_from_node(&dev->res, node);
        dev->active = pnp_is_active(dev);
        kfree(node);
        return 0;
 }
 
-static int pnpbios_set_resources(struct pnp_dev *dev,
-                                struct pnp_resource_table *res)
+static int pnpbios_set_resources(struct pnp_dev *dev)
 {
        u8 nodenum = dev->number;
        struct pnp_bios_node *node;
@@ -243,7 +241,7 @@ static int pnpbios_set_resources(struct pnp_dev *dev,
                kfree(node);
                return -ENODEV;
        }
-       if (pnpbios_write_resources_to_node(res, node) < 0) {
+       if (pnpbios_write_resources_to_node(&dev->res, node) < 0) {
                kfree(node);
                return -1;
        }
index a4c2bf3615963074134c90cab56402688336ab0b..8d7c9bc2fdbbfef6ba5772738ea7c2fa73cee528 100644 (file)
@@ -328,8 +328,8 @@ struct pnp_protocol {
        char *name;
 
        /* resource control functions */
-       int (*get) (struct pnp_dev *dev, struct pnp_resource_table *res);
-       int (*set) (struct pnp_dev *dev, struct pnp_resource_table *res);
+       int (*get) (struct pnp_dev *dev);
+       int (*set) (struct pnp_dev *dev);
        int (*disable) (struct pnp_dev *dev);
 
        /* protocol specific suspend/resume */