aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:39 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:30 -0400
commitd152cf5d0c3325979e71ee53b425fdd51a1a285a (patch)
tree1a8698b8bc188c1ea222c738ec4f6339a615e5ce /drivers
parent01115e7d41c4eaeffa064d818b4abbd3efa94f80 (diff)
PNPACPI: move _CRS/_PRS warnings closer to the action
Move warnings about _CRS and _PRS problems to the place where we actually make the ACPI calls. Then we don't have to pass around acpi_status values any more than necessary. 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pnp/pnpacpi/core.c24
-rw-r--r--drivers/pnp/pnpacpi/pnpacpi.h4
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c30
3 files changed, 29 insertions, 29 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 7e4512a60f58..0950b711f19e 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -75,11 +75,8 @@ static int __init ispnpidacpi(char *id)
75 75
76static int pnpacpi_get_resources(struct pnp_dev *dev) 76static int pnpacpi_get_resources(struct pnp_dev *dev)
77{ 77{
78 acpi_status status;
79
80 dev_dbg(&dev->dev, "get resources\n"); 78 dev_dbg(&dev->dev, "get resources\n");
81 status = pnpacpi_parse_allocated_resource(dev); 79 return pnpacpi_parse_allocated_resource(dev);
82 return ACPI_FAILURE(status) ? -ENODEV : 0;
83} 80}
84 81
85static int pnpacpi_set_resources(struct pnp_dev *dev) 82static int pnpacpi_set_resources(struct pnp_dev *dev)
@@ -182,22 +179,11 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
182 else 179 else
183 strncpy(dev->name, acpi_device_bid(device), sizeof(dev->name)); 180 strncpy(dev->name, acpi_device_bid(device), sizeof(dev->name));
184 181
185 if (dev->active) { 182 if (dev->active)
186 /* parse allocated resource */ 183 pnpacpi_parse_allocated_resource(dev);
187 status = pnpacpi_parse_allocated_resource(dev);
188 if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
189 pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s",
190 acpi_device_hid(device));
191 }
192 }
193 184
194 if (dev->capabilities & PNP_CONFIGURABLE) { 185 if (dev->capabilities & PNP_CONFIGURABLE)
195 status = pnpacpi_parse_resource_option_data(dev); 186 pnpacpi_parse_resource_option_data(dev);
196 if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
197 pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s",
198 acpi_device_hid(device));
199 }
200 }
201 187
202 if (device->flags.compatible_ids) { 188 if (device->flags.compatible_ids) {
203 struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; 189 struct acpi_compatible_id_list *cid_list = device->pnp.cid_list;
diff --git a/drivers/pnp/pnpacpi/pnpacpi.h b/drivers/pnp/pnpacpi/pnpacpi.h
index db0c4f25c2a3..3e60225b0227 100644
--- a/drivers/pnp/pnpacpi/pnpacpi.h
+++ b/drivers/pnp/pnpacpi/pnpacpi.h
@@ -5,8 +5,8 @@
5#include <linux/acpi.h> 5#include <linux/acpi.h>
6#include <linux/pnp.h> 6#include <linux/pnp.h>
7 7
8acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *); 8int pnpacpi_parse_allocated_resource(struct pnp_dev *);
9acpi_status pnpacpi_parse_resource_option_data(struct pnp_dev *); 9int pnpacpi_parse_resource_option_data(struct pnp_dev *);
10int pnpacpi_encode_resources(struct pnp_dev *, struct acpi_buffer *); 10int pnpacpi_encode_resources(struct pnp_dev *, struct acpi_buffer *);
11int pnpacpi_build_resource_template(struct pnp_dev *, struct acpi_buffer *); 11int pnpacpi_build_resource_template(struct pnp_dev *, struct acpi_buffer *);
12#endif 12#endif
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index a512908bf4e3..0201c8adfda7 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -339,16 +339,24 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
339 return AE_OK; 339 return AE_OK;
340} 340}
341 341
342acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *dev) 342int pnpacpi_parse_allocated_resource(struct pnp_dev *dev)
343{ 343{
344 acpi_handle handle = dev->data; 344 acpi_handle handle = dev->data;
345 acpi_status status;
345 346
346 dev_dbg(&dev->dev, "parse allocated resources\n"); 347 dev_dbg(&dev->dev, "parse allocated resources\n");
347 348
348 pnp_init_resources(dev); 349 pnp_init_resources(dev);
349 350
350 return acpi_walk_resources(handle, METHOD_NAME__CRS, 351 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
351 pnpacpi_allocated_resource, dev); 352 pnpacpi_allocated_resource, dev);
353
354 if (ACPI_FAILURE(status)) {
355 if (status != AE_NOT_FOUND)
356 dev_err(&dev->dev, "can't evaluate _CRS: %d", status);
357 return -EPERM;
358 }
359 return 0;
352} 360}
353 361
354static __init void pnpacpi_parse_dma_option(struct pnp_dev *dev, 362static __init void pnpacpi_parse_dma_option(struct pnp_dev *dev,
@@ -670,7 +678,7 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res,
670 return AE_OK; 678 return AE_OK;
671} 679}
672 680
673acpi_status __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev) 681int __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev)
674{ 682{
675 acpi_handle handle = dev->data; 683 acpi_handle handle = dev->data;
676 acpi_status status; 684 acpi_status status;
@@ -680,13 +688,19 @@ acpi_status __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev)
680 688
681 parse_data.option = pnp_register_independent_option(dev); 689 parse_data.option = pnp_register_independent_option(dev);
682 if (!parse_data.option) 690 if (!parse_data.option)
683 return AE_ERROR; 691 return -ENOMEM;
692
684 parse_data.option_independent = parse_data.option; 693 parse_data.option_independent = parse_data.option;
685 parse_data.dev = dev; 694 parse_data.dev = dev;
686 status = acpi_walk_resources(handle, METHOD_NAME__PRS, 695 status = acpi_walk_resources(handle, METHOD_NAME__PRS,
687 pnpacpi_option_resource, &parse_data); 696 pnpacpi_option_resource, &parse_data);
688 697
689 return status; 698 if (ACPI_FAILURE(status)) {
699 if (status != AE_NOT_FOUND)
700 dev_err(&dev->dev, "can't evaluate _PRS: %d", status);
701 return -EPERM;
702 }
703 return 0;
690} 704}
691 705
692static int pnpacpi_supported_resource(struct acpi_resource *res) 706static int pnpacpi_supported_resource(struct acpi_resource *res)
@@ -745,7 +759,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev,
745 status = acpi_walk_resources(handle, METHOD_NAME__CRS, 759 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
746 pnpacpi_count_resources, &res_cnt); 760 pnpacpi_count_resources, &res_cnt);
747 if (ACPI_FAILURE(status)) { 761 if (ACPI_FAILURE(status)) {
748 dev_err(&dev->dev, "can't evaluate _CRS\n"); 762 dev_err(&dev->dev, "can't evaluate _CRS: %d\n", status);
749 return -EINVAL; 763 return -EINVAL;
750 } 764 }
751 if (!res_cnt) 765 if (!res_cnt)
@@ -760,7 +774,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev,
760 pnpacpi_type_resources, &resource); 774 pnpacpi_type_resources, &resource);
761 if (ACPI_FAILURE(status)) { 775 if (ACPI_FAILURE(status)) {
762 kfree(buffer->pointer); 776 kfree(buffer->pointer);
763 dev_err(&dev->dev, "can't evaluate _CRS\n"); 777 dev_err(&dev->dev, "can't evaluate _CRS: %d\n", status);
764 return -EINVAL; 778 return -EINVAL;
765 } 779 }
766 /* resource will pointer the end resource now */ 780 /* resource will pointer the end resource now */