diff options
author | Alexey Starikovskiy <astarikovskiy@suse.de> | 2007-12-08 05:02:40 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-12-14 15:14:06 -0500 |
commit | c2d00f2d1bf8dd721f5557b0df23729addc1898d (patch) | |
tree | 6a89affd983c980589bc75409db16d7bfd114069 /drivers/acpi | |
parent | 09f1fb41ad45bc18abe07c62f7b56560571584d1 (diff) |
ACPI: SBS: Ignore alarms coming from unknown devices
http://bugzilla.kernel.org/show_bug.cgi?id=9362
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/sbs.c | 6 | ||||
-rw-r--r-- | drivers/acpi/sbshc.c | 16 | ||||
-rw-r--r-- | drivers/acpi/sbshc.h | 6 |
3 files changed, 18 insertions, 10 deletions
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 6045cdbe176b..813ef328f743 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -54,12 +54,6 @@ | |||
54 | #define ACPI_BATTERY_DIR_NAME "BAT%i" | 54 | #define ACPI_BATTERY_DIR_NAME "BAT%i" |
55 | #define ACPI_AC_DIR_NAME "AC0" | 55 | #define ACPI_AC_DIR_NAME "AC0" |
56 | 56 | ||
57 | enum acpi_sbs_device_addr { | ||
58 | ACPI_SBS_CHARGER = 0x9, | ||
59 | ACPI_SBS_MANAGER = 0xa, | ||
60 | ACPI_SBS_BATTERY = 0xb, | ||
61 | }; | ||
62 | |||
63 | #define ACPI_SBS_NOTIFY_STATUS 0x80 | 57 | #define ACPI_SBS_NOTIFY_STATUS 0x80 |
64 | #define ACPI_SBS_NOTIFY_INFO 0x81 | 58 | #define ACPI_SBS_NOTIFY_INFO 0x81 |
65 | 59 | ||
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index 12a1532513e3..fd40b6a1d639 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
@@ -202,10 +202,9 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc) | |||
202 | 202 | ||
203 | EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback); | 203 | EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback); |
204 | 204 | ||
205 | static void acpi_smbus_callback(void *context) | 205 | static inline void acpi_smbus_callback(void *context) |
206 | { | 206 | { |
207 | struct acpi_smb_hc *hc = context; | 207 | struct acpi_smb_hc *hc = context; |
208 | |||
209 | if (hc->callback) | 208 | if (hc->callback) |
210 | hc->callback(hc->context); | 209 | hc->callback(hc->context); |
211 | } | 210 | } |
@@ -214,6 +213,7 @@ static int smbus_alarm(void *context) | |||
214 | { | 213 | { |
215 | struct acpi_smb_hc *hc = context; | 214 | struct acpi_smb_hc *hc = context; |
216 | union acpi_smb_status status; | 215 | union acpi_smb_status status; |
216 | u8 address; | ||
217 | if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw)) | 217 | if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw)) |
218 | return 0; | 218 | return 0; |
219 | /* Check if it is only a completion notify */ | 219 | /* Check if it is only a completion notify */ |
@@ -222,10 +222,18 @@ static int smbus_alarm(void *context) | |||
222 | if (!status.fields.alarm) | 222 | if (!status.fields.alarm) |
223 | return 0; | 223 | return 0; |
224 | mutex_lock(&hc->lock); | 224 | mutex_lock(&hc->lock); |
225 | smb_hc_read(hc, ACPI_SMB_ALARM_ADDRESS, &address); | ||
225 | status.fields.alarm = 0; | 226 | status.fields.alarm = 0; |
226 | smb_hc_write(hc, ACPI_SMB_STATUS, status.raw); | 227 | smb_hc_write(hc, ACPI_SMB_STATUS, status.raw); |
227 | if (hc->callback) | 228 | /* We are only interested in events coming from known devices */ |
228 | acpi_os_execute(OSL_GPE_HANDLER, acpi_smbus_callback, hc); | 229 | switch (address >> 1) { |
230 | case ACPI_SBS_CHARGER: | ||
231 | case ACPI_SBS_MANAGER: | ||
232 | case ACPI_SBS_BATTERY: | ||
233 | acpi_os_execute(OSL_GPE_HANDLER, | ||
234 | acpi_smbus_callback, hc); | ||
235 | default:; | ||
236 | } | ||
229 | mutex_unlock(&hc->lock); | 237 | mutex_unlock(&hc->lock); |
230 | return 0; | 238 | return 0; |
231 | } | 239 | } |
diff --git a/drivers/acpi/sbshc.h b/drivers/acpi/sbshc.h index 3bda3491a97b..a57b0762dd7f 100644 --- a/drivers/acpi/sbshc.h +++ b/drivers/acpi/sbshc.h | |||
@@ -16,6 +16,12 @@ enum acpi_smb_protocol { | |||
16 | 16 | ||
17 | static const u8 SMBUS_PEC = 0x80; | 17 | static const u8 SMBUS_PEC = 0x80; |
18 | 18 | ||
19 | enum acpi_sbs_device_addr { | ||
20 | ACPI_SBS_CHARGER = 0x9, | ||
21 | ACPI_SBS_MANAGER = 0xa, | ||
22 | ACPI_SBS_BATTERY = 0xb, | ||
23 | }; | ||
24 | |||
19 | typedef void (*smbus_alarm_callback)(void *context); | 25 | typedef void (*smbus_alarm_callback)(void *context); |
20 | 26 | ||
21 | extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address, | 27 | extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address, |