Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bjorn Helgaas and committed by
Len Brown
d152cf5d 01115e7d

+29 -29
+5 -19
drivers/pnp/pnpacpi/core.c
··· 75 75 76 76 static int pnpacpi_get_resources(struct pnp_dev *dev) 77 77 { 78 - acpi_status status; 79 - 80 78 dev_dbg(&dev->dev, "get resources\n"); 81 - status = pnpacpi_parse_allocated_resource(dev); 82 - return ACPI_FAILURE(status) ? -ENODEV : 0; 79 + return pnpacpi_parse_allocated_resource(dev); 83 80 } 84 81 85 82 static int pnpacpi_set_resources(struct pnp_dev *dev) ··· 179 182 else 180 183 strncpy(dev->name, acpi_device_bid(device), sizeof(dev->name)); 181 184 182 - if (dev->active) { 183 - /* parse allocated resource */ 184 - status = pnpacpi_parse_allocated_resource(dev); 185 - if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { 186 - pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s", 187 - acpi_device_hid(device)); 188 - } 189 - } 185 + if (dev->active) 186 + pnpacpi_parse_allocated_resource(dev); 190 187 191 - if (dev->capabilities & PNP_CONFIGURABLE) { 192 - status = pnpacpi_parse_resource_option_data(dev); 193 - if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { 194 - pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s", 195 - acpi_device_hid(device)); 196 - } 197 - } 188 + if (dev->capabilities & PNP_CONFIGURABLE) 189 + pnpacpi_parse_resource_option_data(dev); 198 190 199 191 if (device->flags.compatible_ids) { 200 192 struct acpi_compatible_id_list *cid_list = device->pnp.cid_list;
+2 -2
drivers/pnp/pnpacpi/pnpacpi.h
··· 5 5 #include <linux/acpi.h> 6 6 #include <linux/pnp.h> 7 7 8 - acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *); 9 - acpi_status pnpacpi_parse_resource_option_data(struct pnp_dev *); 8 + int pnpacpi_parse_allocated_resource(struct pnp_dev *); 9 + int pnpacpi_parse_resource_option_data(struct pnp_dev *); 10 10 int pnpacpi_encode_resources(struct pnp_dev *, struct acpi_buffer *); 11 11 int pnpacpi_build_resource_template(struct pnp_dev *, struct acpi_buffer *); 12 12 #endif
+22 -8
drivers/pnp/pnpacpi/rsparser.c
··· 339 339 return AE_OK; 340 340 } 341 341 342 - acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *dev) 342 + int pnpacpi_parse_allocated_resource(struct pnp_dev *dev) 343 343 { 344 344 acpi_handle handle = dev->data; 345 + acpi_status status; 345 346 346 347 dev_dbg(&dev->dev, "parse allocated resources\n"); 347 348 348 349 pnp_init_resources(dev); 349 350 350 - return acpi_walk_resources(handle, METHOD_NAME__CRS, 351 - pnpacpi_allocated_resource, dev); 351 + status = acpi_walk_resources(handle, METHOD_NAME__CRS, 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 354 362 static __init void pnpacpi_parse_dma_option(struct pnp_dev *dev, ··· 678 670 return AE_OK; 679 671 } 680 672 681 - acpi_status __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev) 673 + int __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev) 682 674 { 683 675 acpi_handle handle = dev->data; 684 676 acpi_status status; ··· 688 680 689 681 parse_data.option = pnp_register_independent_option(dev); 690 682 if (!parse_data.option) 691 - return AE_ERROR; 683 + return -ENOMEM; 684 + 692 685 parse_data.option_independent = parse_data.option; 693 686 parse_data.dev = dev; 694 687 status = acpi_walk_resources(handle, METHOD_NAME__PRS, 695 688 pnpacpi_option_resource, &parse_data); 696 689 697 - return status; 690 + if (ACPI_FAILURE(status)) { 691 + if (status != AE_NOT_FOUND) 692 + dev_err(&dev->dev, "can't evaluate _PRS: %d", status); 693 + return -EPERM; 694 + } 695 + return 0; 698 696 } 699 697 700 698 static int pnpacpi_supported_resource(struct acpi_resource *res) ··· 759 745 status = acpi_walk_resources(handle, METHOD_NAME__CRS, 760 746 pnpacpi_count_resources, &res_cnt); 761 747 if (ACPI_FAILURE(status)) { 762 - dev_err(&dev->dev, "can't evaluate _CRS\n"); 748 + dev_err(&dev->dev, "can't evaluate _CRS: %d\n", status); 763 749 return -EINVAL; 764 750 } 765 751 if (!res_cnt) ··· 774 760 pnpacpi_type_resources, &resource); 775 761 if (ACPI_FAILURE(status)) { 776 762 kfree(buffer->pointer); 777 - dev_err(&dev->dev, "can't evaluate _CRS\n"); 763 + dev_err(&dev->dev, "can't evaluate _CRS: %d\n", status); 778 764 return -EINVAL; 779 765 } 780 766 /* resource will pointer the end resource now */