diff options
author | Zhang Rui <rui.zhang@intel.com> | 2013-09-02 20:32:11 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-09-23 19:37:57 -0400 |
commit | 74da276028966f333acc97b59292f928c16c1709 (patch) | |
tree | 4d0fea1d48213218b2427199b465f6788a68a3b2 /drivers/hid/i2c-hid/i2c-hid.c | |
parent | 6a868e171c3800442f59b74ec1e0eaf7d858eb58 (diff) |
i2c-hid: convert acpi_evaluate_object() to acpi_evaluate_integer()
acpi_evaluate_integer() is an ACPI API introduced to evaluate an
ACPI control method that is known to have an integer return value.
This API can simplify the code because the calling function does not need to
use the specified acpi_buffer structure required by acpi_evaluate_object();
Convert acpi_evaluate_object() to acpi_evaluate_integer()
in drivers/hid/i2c-hid/i2c-hid.c in this patch.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.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 | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index c1336193b04b..fd7ce374f812 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c | |||
@@ -854,10 +854,10 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client, | |||
854 | 0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45, | 854 | 0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45, |
855 | 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE, | 855 | 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE, |
856 | }; | 856 | }; |
857 | struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL }; | 857 | union acpi_object params[4]; |
858 | union acpi_object params[4], *obj; | ||
859 | struct acpi_object_list input; | 858 | struct acpi_object_list input; |
860 | struct acpi_device *adev; | 859 | struct acpi_device *adev; |
860 | unsigned long long value; | ||
861 | acpi_handle handle; | 861 | acpi_handle handle; |
862 | 862 | ||
863 | handle = ACPI_HANDLE(&client->dev); | 863 | handle = ACPI_HANDLE(&client->dev); |
@@ -878,22 +878,14 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client, | |||
878 | params[3].package.count = 0; | 878 | params[3].package.count = 0; |
879 | params[3].package.elements = NULL; | 879 | params[3].package.elements = NULL; |
880 | 880 | ||
881 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DSM", &input, &buf))) { | 881 | if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_DSM", &input, |
882 | &value))) { | ||
882 | dev_err(&client->dev, "device _DSM execution failed\n"); | 883 | dev_err(&client->dev, "device _DSM execution failed\n"); |
883 | return -ENODEV; | 884 | return -ENODEV; |
884 | } | 885 | } |
885 | 886 | ||
886 | obj = (union acpi_object *)buf.pointer; | 887 | pdata->hid_descriptor_address = value; |
887 | if (obj->type != ACPI_TYPE_INTEGER) { | ||
888 | dev_err(&client->dev, "device _DSM returned invalid type: %d\n", | ||
889 | obj->type); | ||
890 | kfree(buf.pointer); | ||
891 | return -EINVAL; | ||
892 | } | ||
893 | |||
894 | pdata->hid_descriptor_address = obj->integer.value; | ||
895 | 888 | ||
896 | kfree(buf.pointer); | ||
897 | return 0; | 889 | return 0; |
898 | } | 890 | } |
899 | 891 | ||