From: Jiang Liu <jiang.liu@linux.intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Lv Zheng <lv.zheng@intel.com>, Len Brown <lenb@kernel.org>,
Jiri Kosina <jkosina@suse.cz>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Jiang Liu <jiang.liu@linux.intel.com>,
Tony Luck <tony.luck@intel.com>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-input@vger.kernel.org
Subject: [Patch v2 10/13] ACPI, i2c-hid: replace open-coded _DSM specific code with helper functions
Date: Thu, 19 Dec 2013 20:38:19 +0800 [thread overview]
Message-ID: <1387456702-4709-11-git-send-email-jiang.liu@linux.intel.com> (raw)
In-Reply-To: <1387456702-4709-1-git-send-email-jiang.liu@linux.intel.com>
Use helper functions to simplify _DSM related code in i2c-hid driver.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/hid/i2c-hid/i2c-hid.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 5f7e55f..d22668f 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;
}
--
1.7.10.4
next prev parent reply other threads:[~2013-12-19 12:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-19 12:38 [Patch v2 00/13] Introduce ACPI _DSM helper functions to simplify code Jiang Liu
2013-12-19 12:38 ` [Patch v2 01/13] ACPI: introduce helper interfaces to support ACPI _DSM method Jiang Liu
2013-12-19 12:38 ` [Patch v2 03/13] PCI, pci-label: release allocated ACPI object on error recovery path Jiang Liu
2013-12-19 18:22 ` Bjorn Helgaas
2013-12-20 2:01 ` Rafael J. Wysocki
2013-12-19 12:38 ` [Patch v2 04/13] ACPI, PCI: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-19 12:38 ` [Patch v2 05/13] PCI, pci-label: treat PCI label with index 0 as valid label Jiang Liu
2013-12-19 12:38 ` [Patch v2 06/13] ACPI, TPM: fix memory leak when walking ACPI namespace Jiang Liu
2013-12-19 12:38 ` [Patch v2 07/13] ACPI, TPM: matching node name instead of full path when searching for TPM device Jiang Liu
2013-12-19 12:38 ` [Patch v2 08/13] ACPI, TPM: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-19 12:38 ` [Patch v2 09/13] ACPI, TPM: detecting PPI features by checking availability of _DSM functions Jiang Liu
2013-12-19 12:38 ` Jiang Liu [this message]
2013-12-19 12:38 ` [Patch v2 11/13] ACPI, i915: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-19 12:38 ` Jiang Liu
2013-12-19 12:38 ` [Patch v2 12/13] nouveau: fix memory leak in ACPI _DSM related code Jiang Liu
2013-12-19 12:38 ` [Patch v2 13/13] ACPI, nouveau: replace open-coded _DSM specific code with helper functions Jiang Liu
2014-01-05 21:58 ` [Patch v2 00/13] Introduce ACPI _DSM helper functions to simplify code Rafael J. Wysocki
2014-01-06 6:18 ` Jiang Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1387456702-4709-11-git-send-email-jiang.liu@linux.intel.com \
--to=jiang.liu@linux.intel.com \
--cc=benjamin.tissoires@redhat.com \
--cc=bhelgaas@google.com \
--cc=jkosina@suse.cz \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.