static int pnpacpi_set_resources(struct pnp_dev * dev, struct pnp_resource_table * res) { acpi_handle handle = dev->data; struct acpi_buffer buffer; int ret = 0; acpi_status status; ret = pnpacpi_build_resource_template(handle, &buffer); if (ret) return ret; ret = pnpacpi_encode_resources(res, &buffer); if (ret) { kfree(buffer.pointer); return ret; } status = acpi_set_current_resources(handle, &buffer); if (ACPI_FAILURE(status)) ret = -EINVAL; kfree(buffer.pointer); return ret; }
static int pnpacpi_set_resources(struct pnp_dev *dev) { acpi_handle handle = dev->data; struct acpi_buffer buffer; int ret; pnp_dbg(&dev->dev, "set resources\n"); ret = pnpacpi_build_resource_template(dev, &buffer); if (ret) return ret; ret = pnpacpi_encode_resources(dev, &buffer); if (ret) { kfree(buffer.pointer); return ret; } if (ACPI_FAILURE(acpi_set_current_resources(handle, &buffer))) ret = -EINVAL; else if (acpi_bus_power_manageable(handle)) ret = acpi_bus_set_power(handle, ACPI_STATE_D0); kfree(buffer.pointer); return ret; }