ACPI: remove acpi_device_set_context() "type" argument
We only pass the "type" to acpi_device_set_context() so we know whether the device has a handle to which we can attach the acpi_device pointer. But it's safer to just check for the handle directly, since it's in the acpi_device already. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
ccba2a36d7
commit
bc3b07726a
1 changed files with 15 additions and 17 deletions
|
@ -1171,29 +1171,27 @@ static void acpi_device_set_id(struct acpi_device *device, int type)
|
||||||
kfree(info);
|
kfree(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_device_set_context(struct acpi_device *device, int type)
|
static int acpi_device_set_context(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status;
|
||||||
int result = 0;
|
|
||||||
/*
|
/*
|
||||||
* Context
|
* Context
|
||||||
* -------
|
* -------
|
||||||
* Attach this 'struct acpi_device' to the ACPI object. This makes
|
* Attach this 'struct acpi_device' to the ACPI object. This makes
|
||||||
* resolutions from handle->device very efficient. Note that we need
|
* resolutions from handle->device very efficient. Fixed hardware
|
||||||
* to be careful with fixed-feature devices as they all attach to the
|
* devices have no handles, so we skip them.
|
||||||
* root object.
|
|
||||||
*/
|
*/
|
||||||
if (type != ACPI_BUS_TYPE_POWER_BUTTON &&
|
if (!device->handle)
|
||||||
type != ACPI_BUS_TYPE_SLEEP_BUTTON) {
|
return 0;
|
||||||
|
|
||||||
status = acpi_attach_data(device->handle,
|
status = acpi_attach_data(device->handle,
|
||||||
acpi_bus_data_handler, device);
|
acpi_bus_data_handler, device);
|
||||||
|
if (ACPI_SUCCESS(status))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (ACPI_FAILURE(status)) {
|
|
||||||
printk(KERN_ERR PREFIX "Error attaching device data\n");
|
printk(KERN_ERR PREFIX "Error attaching device data\n");
|
||||||
result = -ENODEV;
|
return -ENODEV;
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
|
static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
|
||||||
|
@ -1338,7 +1336,7 @@ acpi_add_single_object(struct acpi_device **child,
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result = acpi_device_set_context(device, type)))
|
if ((result = acpi_device_set_context(device)))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
result = acpi_device_register(device);
|
result = acpi_device_register(device);
|
||||||
|
|
Loading…
Add table
Reference in a new issue