diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-09-21 15:29:20 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-09-25 14:24:26 -0400 |
commit | bc3b07726aa288e2a5e60d9a1dd8188b3faa7385 (patch) | |
tree | db83a1e3df8c2867710562462943939a3895f119 /drivers/acpi/scan.c | |
parent | ccba2a36d74a9da815e597ac727cfd096fa8e750 (diff) |
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>
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index c8e867b4a842..44383fe35082 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1171,29 +1171,27 @@ static void acpi_device_set_id(struct acpi_device *device, int type) | |||
1171 | kfree(info); | 1171 | kfree(info); |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | static int acpi_device_set_context(struct acpi_device *device, int type) | 1174 | static int acpi_device_set_context(struct acpi_device *device) |
1175 | { | 1175 | { |
1176 | acpi_status status = AE_OK; | 1176 | acpi_status status; |
1177 | int result = 0; | 1177 | |
1178 | /* | 1178 | /* |
1179 | * Context | 1179 | * Context |
1180 | * ------- | 1180 | * ------- |
1181 | * Attach this 'struct acpi_device' to the ACPI object. This makes | 1181 | * Attach this 'struct acpi_device' to the ACPI object. This makes |
1182 | * resolutions from handle->device very efficient. Note that we need | 1182 | * resolutions from handle->device very efficient. Fixed hardware |
1183 | * to be careful with fixed-feature devices as they all attach to the | 1183 | * devices have no handles, so we skip them. |
1184 | * root object. | ||
1185 | */ | 1184 | */ |
1186 | if (type != ACPI_BUS_TYPE_POWER_BUTTON && | 1185 | if (!device->handle) |
1187 | type != ACPI_BUS_TYPE_SLEEP_BUTTON) { | 1186 | return 0; |
1188 | status = acpi_attach_data(device->handle, | ||
1189 | acpi_bus_data_handler, device); | ||
1190 | 1187 | ||
1191 | if (ACPI_FAILURE(status)) { | 1188 | status = acpi_attach_data(device->handle, |
1192 | printk(KERN_ERR PREFIX "Error attaching device data\n"); | 1189 | acpi_bus_data_handler, device); |
1193 | result = -ENODEV; | 1190 | if (ACPI_SUCCESS(status)) |
1194 | } | 1191 | return 0; |
1195 | } | 1192 | |
1196 | return result; | 1193 | printk(KERN_ERR PREFIX "Error attaching device data\n"); |
1194 | return -ENODEV; | ||
1197 | } | 1195 | } |
1198 | 1196 | ||
1199 | static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) | 1197 | static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) |
@@ -1338,7 +1336,7 @@ acpi_add_single_object(struct acpi_device **child, | |||
1338 | goto end; | 1336 | goto end; |
1339 | } | 1337 | } |
1340 | 1338 | ||
1341 | if ((result = acpi_device_set_context(device, type))) | 1339 | if ((result = acpi_device_set_context(device))) |
1342 | goto end; | 1340 | goto end; |
1343 | 1341 | ||
1344 | result = acpi_device_register(device); | 1342 | result = acpi_device_register(device); |