From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: Len Brown <lenb@kernel.org>
Cc: ibm-acpi-devel@lists.sourceforge.net, linux-acpi@vger.kernel.org,
Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Subject: [PATCH 4/9] ACPI: thinkpad-acpi: keep track of module state
Date: Sun, 23 Sep 2007 11:39:02 -0300 [thread overview]
Message-ID: <1190558347280-git-send-email-hmh@hmh.eng.br> (raw)
In-Reply-To: <11905583473293-git-send-email-hmh@hmh.eng.br>
Keep track of module state (init, running, exit). This makes it trivially
easy to avoid running any interrupt handlers, threads, or any other async
activity before we are ready, or when we want to go away.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
---
drivers/misc/thinkpad_acpi.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 0ced9d6..2155139 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -117,6 +117,12 @@ IBM_BIOS_MODULE_ALIAS("K[U,X-Z]");
#define __unused __attribute__ ((unused))
+static enum {
+ TPACPI_LIFE_INIT = 0,
+ TPACPI_LIFE_RUNNING,
+ TPACPI_LIFE_EXITING,
+} tpacpi_lifecycle;
+
/****************************************************************************
****************************************************************************
*
@@ -342,6 +348,9 @@ static void dispatch_acpi_notify(acpi_handle handle, u32 event, void *data)
{
struct ibm_struct *ibm = data;
+ if (tpacpi_lifecycle != TPACPI_LIFE_RUNNING)
+ return;
+
if (!ibm || !ibm->acpi || !ibm->acpi->notify)
return;
@@ -3899,6 +3908,9 @@ static void fan_watchdog_fire(struct work_struct *ignored)
{
int rc;
+ if (tpacpi_lifecycle != TPACPI_LIFE_RUNNING)
+ return;
+
printk(IBM_NOTICE "fan watchdog: enabling fan\n");
rc = fan_set_enable();
if (rc < 0) {
@@ -3919,7 +3931,8 @@ static void fan_watchdog_reset(void)
if (fan_watchdog_active)
cancel_delayed_work(&fan_watchdog_task);
- if (fan_watchdog_maxinterval > 0) {
+ if (fan_watchdog_maxinterval > 0 &&
+ tpacpi_lifecycle != TPACPI_LIFE_EXITING) {
fan_watchdog_active = 1;
if (!schedule_delayed_work(&fan_watchdog_task,
msecs_to_jiffies(fan_watchdog_maxinterval
@@ -4685,6 +4698,8 @@ static int __init thinkpad_acpi_module_init(void)
{
int ret, i;
+ tpacpi_lifecycle = TPACPI_LIFE_INIT;
+
/* Parameter checking */
if (hotkey_report_mode > 2)
return -EINVAL;
@@ -4781,6 +4796,7 @@ static int __init thinkpad_acpi_module_init(void)
tp_features.input_device_registered = 1;
}
+ tpacpi_lifecycle = TPACPI_LIFE_RUNNING;
return 0;
}
@@ -4788,6 +4804,8 @@ static void thinkpad_acpi_module_exit(void)
{
struct ibm_struct *ibm, *itmp;
+ tpacpi_lifecycle = TPACPI_LIFE_EXITING;
+
list_for_each_entry_safe_reverse(ibm, itmp,
&tpacpi_all_drivers,
all_drivers) {
--
1.5.3.1
next prev parent reply other threads:[~2007-09-23 14:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-23 14:38 [GIT PATCH v3.1] thinkpad-acpi changes for the merge window (part 1) Henrique de Moraes Holschuh
2007-09-23 14:38 ` [PATCH 1/9] ACPI: thinkpad-acpi: make room for more features in tp_features bitfield Henrique de Moraes Holschuh
2007-09-23 14:39 ` [PATCH 2/9] ACPI: thinkpad-acpi: issue EV_SYNC after EV_SWITCH Henrique de Moraes Holschuh
2007-09-23 14:39 ` [PATCH 3/9] ACPI: thinkpad-acpi: add mutex-based locking to input device event send path Henrique de Moraes Holschuh
2007-09-23 14:39 ` Henrique de Moraes Holschuh [this message]
2007-09-23 14:39 ` [PATCH 5/9] ACPI: thinkpad-acpi: check version of hot key firmware Henrique de Moraes Holschuh
2007-09-23 14:39 ` [PATCH 6/9] ACPI: thinkpad-acpi: dequeue all pending hot key events at once (v2.2) Henrique de Moraes Holschuh
2007-09-23 14:39 ` [PATCH 7/9] ACPI: thinkpad-acpi: fix regression on HKEY LID event handling Henrique de Moraes Holschuh
2007-09-23 14:39 ` [PATCH 8/9] ACPI: thinkpad-acpi: use a separate platform device for hwmon and name it Henrique de Moraes Holschuh
2007-09-23 14:39 ` [PATCH 9/9] ACPI: thinkpad-acpi: duplicate driver attributes to new hwmon pdrv Henrique de Moraes Holschuh
2007-09-24 2:43 ` [GIT PATCH v3.1] thinkpad-acpi changes for the merge window (part 1) Len Brown
-- strict thread matches above, loose matches on Subject: below --
2007-09-23 14:24 [GIT PATCH v3] " Henrique de Moraes Holschuh
2007-09-23 14:24 ` [PATCH 4/9] ACPI: thinkpad-acpi: keep track of module state Henrique de Moraes Holschuh
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=1190558347280-git-send-email-hmh@hmh.eng.br \
--to=hmh@hmh.eng.br \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=lenb@kernel.org \
--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).