From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "Moore, Robert" <robert.moore@intel.com>
Cc: Len Brown <lenb@kernel.org>, Matthew Garrett <mjg@redhat.com>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
pm list <linux-pm@lists.linux-foundation.org>
Subject: [Update][RFC][PATCH 2/3] ACPI: Modify GPE consumers to use GPE refcounting
Date: Sun, 7 Feb 2010 12:58:58 +0100 [thread overview]
Message-ID: <201002071258.59093.rjw@sisk.pl> (raw)
In-Reply-To: <201002071256.35998.rjw@sisk.pl>
From: Rafael J. Wysocki <rjw@sisk.pl>
Add GPE refcounting support to the existing GPE users. This will
currently do little until the core is changed over to fully
implement the new behaviour.
Based on a patch from Matthew Garrett <mjg@redhat.com>.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/acpi/button.c | 10 ++++++++++
drivers/acpi/ec.c | 4 +++-
drivers/acpi/sleep.c | 15 ++++++++++++---
drivers/acpi/wakeup.c | 2 ++
4 files changed, 27 insertions(+), 4 deletions(-)
Index: linux-2.6/drivers/acpi/button.c
===================================================================
--- linux-2.6.orig/drivers/acpi/button.c
+++ linux-2.6/drivers/acpi/button.c
@@ -427,6 +427,9 @@ static int acpi_button_add(struct acpi_d
ACPI_GPE_TYPE_WAKE_RUN);
acpi_enable_gpe(device->wakeup.gpe_device,
device->wakeup.gpe_number);
+ acpi_get_gpe(device->wakeup.gpe_device,
+ device->wakeup.gpe_number,
+ ACPI_GPE_TYPE_WAKE_RUN);
device->wakeup.state.enabled = 1;
}
@@ -446,6 +449,13 @@ static int acpi_button_remove(struct acp
{
struct acpi_button *button = acpi_driver_data(device);
+ if (device->wakeup.flags.valid) {
+ acpi_put_gpe(device->wakeup.gpe_device,
+ device->wakeup.gpe_number,
+ ACPI_GPE_TYPE_WAKE_RUN);
+ device->wakeup.state.enabled = 0;
+ }
+
acpi_button_remove_fs(device);
input_unregister_device(button->input);
kfree(button);
Index: linux-2.6/drivers/acpi/ec.c
===================================================================
--- linux-2.6.orig/drivers/acpi/ec.c
+++ linux-2.6/drivers/acpi/ec.c
@@ -789,7 +789,7 @@ static int ec_install_handlers(struct ac
if (ACPI_FAILURE(status))
return -ENODEV;
acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
- acpi_enable_gpe(NULL, ec->gpe);
+ acpi_get_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
status = acpi_install_address_space_handler(ec->handle,
ACPI_ADR_SPACE_EC,
&acpi_ec_space_handler,
@@ -806,6 +806,7 @@ static int ec_install_handlers(struct ac
} else {
acpi_remove_gpe_handler(NULL, ec->gpe,
&acpi_ec_gpe_handler);
+ acpi_put_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
return -ENODEV;
}
}
@@ -816,6 +817,7 @@ static int ec_install_handlers(struct ac
static void ec_remove_handlers(struct acpi_ec *ec)
{
+ acpi_put_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
pr_err(PREFIX "failed to remove space handler\n");
Index: linux-2.6/drivers/acpi/sleep.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep.c
+++ linux-2.6/drivers/acpi/sleep.c
@@ -745,9 +745,18 @@ int acpi_pm_device_sleep_wake(struct dev
return -ENODEV;
}
- error = enable ?
- acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) :
- acpi_disable_wakeup_device_power(adev);
+ if (enable) {
+ error = acpi_enable_wakeup_device_power(adev,
+ acpi_target_sleep_state);
+ if (!error)
+ acpi_get_gpe(adev->wakeup.gpe_device,
+ adev->wakeup.gpe_number,
+ ACPI_GPE_TYPE_WAKE);
+ } else {
+ acpi_put_gpe(adev->wakeup.gpe_device, adev->wakeup.gpe_number,
+ ACPI_GPE_TYPE_WAKE);
+ error = acpi_disable_wakeup_device_power(adev);
+ }
if (!error)
dev_info(dev, "wake-up capability %s by ACPI\n",
enable ? "enabled" : "disabled");
Index: linux-2.6/drivers/acpi/wakeup.c
===================================================================
--- linux-2.6.orig/drivers/acpi/wakeup.c
+++ linux-2.6/drivers/acpi/wakeup.c
@@ -141,6 +141,8 @@ int __init acpi_wakeup_device_init(void)
ACPI_GPE_TYPE_WAKE_RUN);
acpi_enable_gpe(dev->wakeup.gpe_device,
dev->wakeup.gpe_number);
+ acpi_get_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
+ ACPI_GPE_TYPE_WAKE);
dev->wakeup.state.enabled = 1;
}
mutex_unlock(&acpi_device_lock);
next prev parent reply other threads:[~2010-02-07 12:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-29 20:30 Recent GPE patches - some questions Moore, Robert
2010-02-01 22:36 ` Matthew Garrett
2010-02-02 23:02 ` Moore, Robert
2010-02-06 23:31 ` Rafael J. Wysocki
2010-02-07 2:17 ` [RFC][PATCH 0/3] Introduce GPE refcounting (was: Re: Recent GPE patches - some questions.) Rafael J. Wysocki
2010-02-07 2:22 ` [RFC][PATCH 1/3] ACPI: Add infrastructure for refcounting GPE consumers Rafael J. Wysocki
2010-02-07 2:23 ` [RFC][PATCH 2/3] ACPI: Modify GPE consumers to use GPE refcounting Rafael J. Wysocki
2010-02-07 2:24 ` [RFC][PATCH 3/3] ACPI: Remove old GPE API and transition code entirely to new one Rafael J. Wysocki
2010-02-07 11:56 ` [Update] Re: [RFC][PATCH 0/3] Introduce GPE refcounting (was: Re: Recent GPE patches - some questions.) Rafael J. Wysocki
2010-02-07 11:58 ` [Update][RFC][PATCH 1/3] ACPI: Add infrastructure for refcounting GPE consumers Rafael J. Wysocki
2010-02-07 11:58 ` Rafael J. Wysocki [this message]
2010-02-07 11:59 ` [Update][RFC][PATCH 3/3] ACPI: Remove old GPE API and transition code entirely to new one Rafael J. Wysocki
2010-02-10 21:29 ` [RFC][PATCH 0/3] Introduce GPE refcounting (was: Re: Recent GPE patches - some questions.) Maxim Levitsky
2010-02-10 21:36 ` Rafael J. Wysocki
2010-02-11 17:36 ` Maxim Levitsky
2010-02-11 20:34 ` Rafael J. Wysocki
2010-02-13 16:08 ` Maxim Levitsky
2010-02-14 2:24 ` Rafael J. Wysocki
2010-02-10 21:36 ` Recent GPE patches - some questions Moore, Robert
2010-02-11 22:51 ` [PATCH] ACPI: Use GPE reference counting to support shared GPEs (was: Re: Recent GPE patches - some questions.) Rafael J. Wysocki
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=201002071258.59093.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=jbarnes@virtuousgeek.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=mjg@redhat.com \
--cc=robert.moore@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox