From: Len Brown <lenb@kernel.org>
To: linux-acpi@vger.kernel.org
Cc: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>,
Len Brown <len.brown@intel.com>
Subject: [PATCH 16/22] ACPI: EC: Put install handlers into separate function.
Date: Fri, 9 Mar 2007 23:00:53 -0500 [thread overview]
Message-ID: <11734992733686-git-send-email-lenb@kernel.org> (raw)
Message-ID: <87340f2d12cb87a5a1e6cebe714cf61cc501b588.1173498656.git.len.brown@intel.com> (raw)
In-Reply-To: <11734992592550-git-send-email-lenb@kernel.org>
In-Reply-To: <941b1971a405f95537bc6f9a738e737eb2186e45.1173498647.git.len.brown@intel.com>
From: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
drivers/acpi/ec.c | 87 ++++++++++++++++------------------------------------
1 files changed, 27 insertions(+), 60 deletions(-)
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 1989631..399cedf 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -715,6 +715,28 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context)
return AE_OK;
}
+static int ec_install_handlers(struct acpi_ec *ec)
+{
+ acpi_status status = acpi_install_gpe_handler(NULL, ec->gpe,
+ ACPI_GPE_EDGE_TRIGGERED,
+ &acpi_ec_gpe_handler, ec);
+ if (ACPI_FAILURE(status))
+ return -ENODEV;
+ acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
+ acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
+
+ status = acpi_install_address_space_handler(ec->handle,
+ ACPI_ADR_SPACE_EC,
+ &acpi_ec_space_handler,
+ &acpi_ec_space_setup, ec);
+ if (ACPI_FAILURE(status)) {
+ acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
static int acpi_ec_start(struct acpi_device *device)
{
acpi_status status = AE_OK;
@@ -742,28 +764,7 @@ static int acpi_ec_start(struct acpi_device *device)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02lx, ports=0x%2lx,0x%2lx",
ec->gpe, ec->command_addr, ec->data_addr));
- /*
- * Install GPE handler
- */
- status = acpi_install_gpe_handler(NULL, ec->gpe,
- ACPI_GPE_EDGE_TRIGGERED,
- &acpi_ec_gpe_handler, ec);
- if (ACPI_FAILURE(status)) {
- return -ENODEV;
- }
- acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
- acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
-
- status = acpi_install_address_space_handler(ec->handle,
- ACPI_ADR_SPACE_EC,
- &acpi_ec_space_handler,
- &acpi_ec_space_setup, ec);
- if (ACPI_FAILURE(status)) {
- acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
- return -ENODEV;
- }
-
- return AE_OK;
+ return ec_install_handlers(ec);
}
static int acpi_ec_stop(struct acpi_device *device, int type)
@@ -818,56 +819,22 @@ static int __init acpi_ec_get_real_ecdt(void)
ec_ecdt->gpe = ecdt_ptr->gpe;
ec_ecdt->uid = ecdt_ptr->uid;
- status = acpi_get_handle(NULL, ecdt_ptr->id, &ec_ecdt->handle);
- if (ACPI_FAILURE(status)) {
- goto error;
- }
-
+ ec_ecdt->handle = ACPI_ROOT_OBJECT;
return 0;
- error:
- ACPI_EXCEPTION((AE_INFO, status, "Could not use ECDT"));
- kfree(ec_ecdt);
- ec_ecdt = NULL;
-
- return -ENODEV;
}
int __init acpi_ec_ecdt_probe(void)
{
- acpi_status status;
int ret;
ret = acpi_ec_get_real_ecdt();
if (ret)
return 0;
- /*
- * Install GPE handler
- */
- status = acpi_install_gpe_handler(NULL, ec_ecdt->gpe,
- ACPI_GPE_EDGE_TRIGGERED,
- &acpi_ec_gpe_handler, ec_ecdt);
- if (ACPI_FAILURE(status)) {
- goto error;
- }
- acpi_set_gpe_type(NULL, ec_ecdt->gpe, ACPI_GPE_TYPE_RUNTIME);
- acpi_enable_gpe(NULL, ec_ecdt->gpe, ACPI_NOT_ISR);
-
- status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT,
- ACPI_ADR_SPACE_EC,
- &acpi_ec_space_handler,
- &acpi_ec_space_setup,
- ec_ecdt);
- if (ACPI_FAILURE(status)) {
- acpi_remove_gpe_handler(NULL, ec_ecdt->gpe,
- &acpi_ec_gpe_handler);
- goto error;
- }
-
- return 0;
+ ret = ec_install_handlers(ec_ecdt);
+ if (!ret)
+ return 0;
- error:
- ACPI_EXCEPTION((AE_INFO, status, "Could not use ECDT"));
kfree(ec_ecdt);
ec_ecdt = NULL;
--
1.5.0.3.310.g05ef5
next prev parent reply other threads:[~2007-03-10 4:01 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-10 4:00 ACPI patches in test for Linux-2.6.22 Len Brown
[not found] ` <941b1971a405f95537bc6f9a738e737eb2186e45.1173498647.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 01/22] cpuidle take2: Core cpuidle infrastructure Len Brown
2007-03-15 12:31 ` Andi Kleen
2007-03-15 16:47 ` Len Brown
2007-03-15 13:13 ` Richard Hughes
2007-03-15 16:38 ` Len Brown
2007-03-15 16:42 ` Richard Hughes
[not found] ` <92648781fb5f44cee584da36eb569e88dddc4b8f.1173498651.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 02/22] cpuidle take2: Hookup ACPI C-states driver with cpuidle Len Brown
[not found] ` <c5bb38e598e68202e0d6f08b3fe0f30f12999357.1173498651.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 03/22] cpuidle take2: Basic documentation for cpuidle Len Brown
[not found] ` <a1f0eff21edac1bd87e397f56c4258b9611b5a50.1173498652.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 04/22] ACPI: battery: make internal names consistent with battery "state" Len Brown
[not found] ` <b6ce4083ed8e2a01a3a59301eabe0fc1e68a8a84.1173498652.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 05/22] ACPI: Cache battery status instead of re-evaluating AML Len Brown
2007-04-19 18:23 ` Andrew Morton
[not found] ` <9ea7d57576f40c6af03c8c9fa7a069f2222b498b.1173498653.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 06/22] ACPI: battery: Lindent Len Brown
[not found] ` <d98b2065c5ac31a35cbdfe9b47d421352f96fc3f.1173498653.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 07/22] cpuidle: build fix for !CPU_IDLE Len Brown
[not found] ` <bc17374e69a621c9b7f6f9624c9248f3b8e8503d.1173498653.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 08/22] cpu_idle: fix build break Len Brown
[not found] ` <3d869f55bda8b0b6f0cb55f9a85a6f855a016092.1173498654.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 09/22] cpuidle: make code static Len Brown
[not found] ` <b51f201f9a9af932c723492551f9e688d34cc468.1173498654.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 10/22] cpuidle: ladder does not depend on ACPI Len Brown
[not found] ` <705ff592931e6738926fd6d596461010a1e8977d.1173498654.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 11/22] ACPI: EC: Don't use Global Lock if not asked to do so Len Brown
2007-03-10 14:12 ` Sanjoy Mahajan
[not found] ` <e4382a15d138ea6c0d4277967e646216ce57040f.1173498654.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 12/22] ACPI: EC: Make EC to initialize first in ACPI Len Brown
[not found] ` <94418415a62ec4c88109385d8663e56aac54dfd6.1173498656.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 13/22] ACPI: EC: "Fake ECDT" workaround is not needed any longer Len Brown
[not found] ` <50a76c6beb6e41664f44239d866240952f56de78.1173498656.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 14/22] ACPI: EC: enable burst functionality in EC Len Brown
[not found] ` <388ea1ea778138553bc42b8d4aa26b9221faee23.1173498656.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 15/22] ACPI: EC: Remove casts to/from void* from ec.c Len Brown
[not found] ` <87340f2d12cb87a5a1e6cebe714cf61cc501b588.1173498656.git.len.brown@intel.com>
2007-03-10 4:00 ` Len Brown [this message]
[not found] ` <fb7d8f568d5bbb28d535bb68c0f287246d6a5fbf.1173498657.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 17/22] ACPI: EC: Clean ECDT and namespace parsing Len Brown
[not found] ` <105cfb8936ce350c426b9b2a42e52cd3a625d102.1173498657.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 18/22] ACPI: EC: Rename ec_ecdt to more informative boot_ec Len Brown
[not found] ` <4f53bd846f964c9c3c590b3bc8eb2bfe1d392b5d.1173498657.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 19/22] ACPI: EC: first_ec is better to be acpi_ec than acpi_device Len Brown
[not found] ` <2f11ffb10877e93e24ae042649666b78dd9985e6.1173498657.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 20/22] ACPI: EC: Cleanup of EC initialization Len Brown
[not found] ` <5923a5eb97e66a7678742b84352b82597673c766.1173498658.git.len.brown@intel.com>
2007-03-10 4:00 ` [PATCH 21/22] ACPI: EC: Block queries until EC is fully initialized Len Brown
2007-03-16 17:58 ` ACPI patches in test for Linux-2.6.22 Sergio Monteiro Basto
2007-03-16 18:03 ` Alexey Starikovskiy
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=11734992733686-git-send-email-lenb@kernel.org \
--to=lenb@kernel.org \
--cc=alexey.y.starikovskiy@intel.com \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).