aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:05 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:21 -0400
commit59284cb4099411bc6f4915a5a4cb76414440c447 (patch)
tree2965bbad48655a6c1e0bf2ef5d51994ab28d627d
parentc1caf06ccfd3a4efd4b489f89bcdabd2362f31d0 (diff)
PNP: remove pnp_resource_table from internal get/set interfaces
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>
-rw-r--r--drivers/pnp/interface.c2
-rw-r--r--drivers/pnp/isapnp/core.c11
-rw-r--r--drivers/pnp/manager.c2
-rw-r--r--drivers/pnp/pnpacpi/core.c8
-rw-r--r--drivers/pnp/pnpbios/core.c10
-rw-r--r--include/linux/pnp.h4
6 files changed, 16 insertions, 21 deletions
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 982658477a58..e882896bdbd7 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -364,7 +364,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
364 if (!strnicmp(buf, "get", 3)) { 364 if (!strnicmp(buf, "get", 3)) {
365 mutex_lock(&pnp_res_mutex); 365 mutex_lock(&pnp_res_mutex);
366 if (pnp_can_read(dev)) 366 if (pnp_can_read(dev))
367 dev->protocol->get(dev, &dev->res); 367 dev->protocol->get(dev);
368 mutex_unlock(&pnp_res_mutex); 368 mutex_unlock(&pnp_res_mutex);
369 goto done; 369 goto done;
370 } 370 }
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 38ff64dce9c0..1ae3d8996156 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -976,21 +976,20 @@ static int isapnp_read_resources(struct pnp_dev *dev,
976 return 0; 976 return 0;
977} 977}
978 978
979static int isapnp_get_resources(struct pnp_dev *dev, 979static int isapnp_get_resources(struct pnp_dev *dev)
980 struct pnp_resource_table *res)
981{ 980{
982 int ret; 981 int ret;
983 982
984 pnp_init_resource_table(res); 983 pnp_init_resource_table(&dev->res);
985 isapnp_cfg_begin(dev->card->number, dev->number); 984 isapnp_cfg_begin(dev->card->number, dev->number);
986 ret = isapnp_read_resources(dev, res); 985 ret = isapnp_read_resources(dev, &dev->res);
987 isapnp_cfg_end(); 986 isapnp_cfg_end();
988 return ret; 987 return ret;
989} 988}
990 989
991static int isapnp_set_resources(struct pnp_dev *dev, 990static int isapnp_set_resources(struct pnp_dev *dev)
992 struct pnp_resource_table *res)
993{ 991{
992 struct pnp_resource_table *res = &dev->res;
994 int tmp; 993 int tmp;
995 994
996 isapnp_cfg_begin(dev->card->number, dev->number); 995 isapnp_cfg_begin(dev->card->number, dev->number);
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index c28caf272c11..6a1f0b0b24b3 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -473,7 +473,7 @@ int pnp_start_dev(struct pnp_dev *dev)
473 return -EINVAL; 473 return -EINVAL;
474 } 474 }
475 475
476 if (dev->protocol->set(dev, &dev->res) < 0) { 476 if (dev->protocol->set(dev) < 0) {
477 dev_err(&dev->dev, "activation failed\n"); 477 dev_err(&dev->dev, "activation failed\n");
478 return -EIO; 478 return -EIO;
479 } 479 }
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 27546873880c..590fbcb0ee89 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -73,8 +73,7 @@ static int __init ispnpidacpi(char *id)
73 return 1; 73 return 1;
74} 74}
75 75
76static int pnpacpi_get_resources(struct pnp_dev *dev, 76static int pnpacpi_get_resources(struct pnp_dev *dev)
77 struct pnp_resource_table *res)
78{ 77{
79 acpi_status status; 78 acpi_status status;
80 79
@@ -83,8 +82,7 @@ static int pnpacpi_get_resources(struct pnp_dev *dev,
83 return ACPI_FAILURE(status) ? -ENODEV : 0; 82 return ACPI_FAILURE(status) ? -ENODEV : 0;
84} 83}
85 84
86static int pnpacpi_set_resources(struct pnp_dev *dev, 85static int pnpacpi_set_resources(struct pnp_dev *dev)
87 struct pnp_resource_table *res)
88{ 86{
89 acpi_handle handle = dev->data; 87 acpi_handle handle = dev->data;
90 struct acpi_buffer buffer; 88 struct acpi_buffer buffer;
@@ -94,7 +92,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev,
94 ret = pnpacpi_build_resource_template(dev, &buffer); 92 ret = pnpacpi_build_resource_template(dev, &buffer);
95 if (ret) 93 if (ret)
96 return ret; 94 return ret;
97 ret = pnpacpi_encode_resources(res, &buffer); 95 ret = pnpacpi_encode_resources(&dev->res, &buffer);
98 if (ret) { 96 if (ret) {
99 kfree(buffer.pointer); 97 kfree(buffer.pointer);
100 return ret; 98 return ret;
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 6af2be2c1d67..9852755b5590 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -204,8 +204,7 @@ static int pnp_dock_thread(void *unused)
204 204
205#endif /* CONFIG_HOTPLUG */ 205#endif /* CONFIG_HOTPLUG */
206 206
207static int pnpbios_get_resources(struct pnp_dev *dev, 207static int pnpbios_get_resources(struct pnp_dev *dev)
208 struct pnp_resource_table *res)
209{ 208{
210 u8 nodenum = dev->number; 209 u8 nodenum = dev->number;
211 struct pnp_bios_node *node; 210 struct pnp_bios_node *node;
@@ -220,14 +219,13 @@ static int pnpbios_get_resources(struct pnp_dev *dev,
220 kfree(node); 219 kfree(node);
221 return -ENODEV; 220 return -ENODEV;
222 } 221 }
223 pnpbios_read_resources_from_node(res, node); 222 pnpbios_read_resources_from_node(&dev->res, node);
224 dev->active = pnp_is_active(dev); 223 dev->active = pnp_is_active(dev);
225 kfree(node); 224 kfree(node);
226 return 0; 225 return 0;
227} 226}
228 227
229static int pnpbios_set_resources(struct pnp_dev *dev, 228static int pnpbios_set_resources(struct pnp_dev *dev)
230 struct pnp_resource_table *res)
231{ 229{
232 u8 nodenum = dev->number; 230 u8 nodenum = dev->number;
233 struct pnp_bios_node *node; 231 struct pnp_bios_node *node;
@@ -243,7 +241,7 @@ static int pnpbios_set_resources(struct pnp_dev *dev,
243 kfree(node); 241 kfree(node);
244 return -ENODEV; 242 return -ENODEV;
245 } 243 }
246 if (pnpbios_write_resources_to_node(res, node) < 0) { 244 if (pnpbios_write_resources_to_node(&dev->res, node) < 0) {
247 kfree(node); 245 kfree(node);
248 return -1; 246 return -1;
249 } 247 }
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index a4c2bf361596..8d7c9bc2fdbb 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -328,8 +328,8 @@ struct pnp_protocol {
328 char *name; 328 char *name;
329 329
330 /* resource control functions */ 330 /* resource control functions */
331 int (*get) (struct pnp_dev *dev, struct pnp_resource_table *res); 331 int (*get) (struct pnp_dev *dev);
332 int (*set) (struct pnp_dev *dev, struct pnp_resource_table *res); 332 int (*set) (struct pnp_dev *dev);
333 int (*disable) (struct pnp_dev *dev); 333 int (*disable) (struct pnp_dev *dev);
334 334
335 /* protocol specific suspend/resume */ 335 /* protocol specific suspend/resume */