diff options
author | Jiang Liu <jiang.liu@linux.intel.com> | 2013-12-19 20:38:19 +0800 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-01-05 16:07:15 +0100 |
commit | ea547d7db031e0cb010911470cbf5ba17e27eab0 (patch) | |
tree | 04e53f62a1a8f0e35045722f3e76088c9fdbb0c1 /drivers/hid/i2c-hid/i2c-hid.c | |
parent | 1569a4c4cebaf358eff12633830baeaf6507fed0 (diff) |
ACPI / i2c-hid: replace open-coded _DSM code with helper functions
Use helper functions to simplify _DSM related code in i2c-hid driver.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/hid/i2c-hid/i2c-hid.c')
-rw-r--r-- | drivers/hid/i2c-hid/i2c-hid.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index 5f7e55f4b7f0..d22668f7d982 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -850,37 +850,23 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client, 0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45, 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE, }; - union acpi_object params[4]; - struct acpi_object_list input; + union acpi_object *obj; struct acpi_device *adev; - unsigned long long value; acpi_handle handle; handle = ACPI_HANDLE(&client->dev); if (!handle || acpi_bus_get_device(handle, &adev)) return -ENODEV; - input.count = ARRAY_SIZE(params); - input.pointer = params; - - params[0].type = ACPI_TYPE_BUFFER; - params[0].buffer.length = sizeof(i2c_hid_guid); - params[0].buffer.pointer = i2c_hid_guid; - params[1].type = ACPI_TYPE_INTEGER; - params[1].integer.value = 1; - params[2].type = ACPI_TYPE_INTEGER; - params[2].integer.value = 1; /* HID function */ - params[3].type = ACPI_TYPE_PACKAGE; - params[3].package.count = 0; - params[3].package.elements = NULL; - - if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_DSM", &input, - &value))) { + obj = acpi_evaluate_dsm_typed(handle, i2c_hid_guid, 1, 1, NULL, + ACPI_TYPE_INTEGER); + if (!obj) { dev_err(&client->dev, "device _DSM execution failed\n"); return -ENODEV; } - pdata->hid_descriptor_address = value; + pdata->hid_descriptor_address = obj->integer.value; + ACPI_FREE(obj); return 0; } |