Skip to contentSkip to conversation

ACPI patches for 2.6.36.merge

PATCH New Len Brown 1 participant 21 messages Aug 15, 2010

Subsystems (7)
Documentation x86 ACPI libata +3 more subsystems
lore
Share & tools
lore

Len Brown

author reviewer
#0 lore raw

The following patches are queued for 2.6.36.merge Please let me know if you see problems with any of them.

thanks,
Len Brown, Intel Open Source Technology Center

author reviewer
#1 lore raw

PATCH 1/20 ACPI / Sleep: Free NVS copy if suspending of devices fails

From: Rafael J. Wysocki <[email protected]>

If suspending of devices fails or system suspend is tested in the "devices" mode, the memory allocated for storing a copy of the ACPI NVS area will not be freed, because acpi_pm_finish() is not called in that case. Fix this by moving the suspend_nvs_free() call to acpi_pm_end().

---
 drivers/acpi/sleep.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/sleep.c +1 -1
index 5b7c52e..da68ed2 100644
@@ -145,7 +145,6 @@ static void acpi_pm_finish(void)
 {
 	u32 acpi_state = acpi_target_sleep_state;
 
-	suspend_nvs_free();
 	acpi_ec_unblock_transactions();
 
 	if (acpi_state == ACPI_STATE_S0)
@@ -167,6 +166,7 @@ static void acpi_pm_finish(void)
  */
 static void acpi_pm_end(void)
 {
+	suspend_nvs_free();
 	/*
 	 * This is necessary in case acpi_pm_finish() is not called during a
 	 * failing transition to a sleep state.
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#2 lore raw

PATCH 2/20 ACPI / Sleep: Rework enabling wakeup devices

In reply to Len Brown

From: Rafael J. Wysocki <[email protected]>

There is no reason why acpi_enable_wakeup_device() should be called with interrupts disabled, because it doesn't access hardware. Thus it is possible to move it next to acpi_enable_wakeup_device_prep() and make the ACPI suspend, hibernate and poweroff code more straightforward.

---
 drivers/acpi/sleep.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/acpi/sleep.c +2 -4
index da68ed2..8704ca78 100644
@@ -70,10 +70,11 @@ static int acpi_sleep_prepare(u32 acpi_state)
 
 	}
 	ACPI_FLUSH_CPU_CACHE();
-	acpi_enable_wakeup_device_prep(acpi_state);
 #endif
 	printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n",
 		acpi_state);
+	acpi_enable_wakeup_device_prep(acpi_state);
+	acpi_enable_wakeup_device(acpi_state);
 	acpi_enter_sleep_state_prep(acpi_state);
 	return 0;
 }
@@ -238,7 +239,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
 	}
 
 	local_irq_save(flags);
-	acpi_enable_wakeup_device(acpi_state);
 	switch (acpi_state) {
 	case ACPI_STATE_S1:
 		barrier();
@@ -442,7 +442,6 @@ static int acpi_hibernation_enter(void)
 	ACPI_FLUSH_CPU_CACHE();
 
 	local_irq_save(flags);
-	acpi_enable_wakeup_device(ACPI_STATE_S4);
 	/* This shouldn't return.  If it returns, we have a problem */
 	status = acpi_enter_sleep_state(ACPI_STATE_S4);
 	/* Reprogram control registers and execute _BFS */
@@ -696,7 +695,6 @@ static void acpi_power_off(void)
 	/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
 	printk(KERN_DEBUG "%s called\n", __func__);
 	local_irq_disable();
-	acpi_enable_wakeup_device(ACPI_STATE_S5);
 	acpi_enter_sleep_state(ACPI_STATE_S5);
 }
 
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#3 lore raw

PATCH 3/20 ACPI / Wakeup: Simplify enabling of wakeup devices

In reply to Len Brown

From: Rafael J. Wysocki <[email protected]>

To simplify the enabling of wakeup devices during system suspend and hibernation, merge acpi_enable_wakeup_device_prep() with acpi_disable_wakeup_device() and remove unnecessary (and no longer valid) comments from the latter. Rename acpi_enable_wakeup_device() to acpi_enable_wakeup_devices() and acpi_disable_wakeup_device() to acpi_disable_wakeup_devices(), because these functions usually operate on multiple device objects.

---
 drivers/acpi/sleep.c  |    5 ++---
 drivers/acpi/sleep.h  |    5 ++---
 drivers/acpi/wakeup.c |   48 ++++++++++--------------------------------------
 3 files changed, 14 insertions(+), 44 deletions(-)
drivers/acpi/sleep.c +2 -3
index 8704ca78..93441c9 100644
@@ -73,8 +73,7 @@ static int acpi_sleep_prepare(u32 acpi_state)
 #endif
 	printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n",
 		acpi_state);
-	acpi_enable_wakeup_device_prep(acpi_state);
-	acpi_enable_wakeup_device(acpi_state);
+	acpi_enable_wakeup_devices(acpi_state);
 	acpi_enter_sleep_state_prep(acpi_state);
 	return 0;
 }
@@ -153,7 +152,7 @@ static void acpi_pm_finish(void)
 
 	printk(KERN_INFO PREFIX "Waking up from system sleep state S%d\n",
 		acpi_state);
-	acpi_disable_wakeup_device(acpi_state);
+	acpi_disable_wakeup_devices(acpi_state);
 	acpi_leave_sleep_state(acpi_state);
 
 	/* reset firmware waking vector */
drivers/acpi/sleep.h +2 -3
index 25b8bd1..d882180 100644
@@ -2,9 +2,8 @@
 extern u8 sleep_states[];
 extern int acpi_suspend(u32 state);
 
-extern void acpi_enable_wakeup_device_prep(u8 sleep_state);
-extern void acpi_enable_wakeup_device(u8 sleep_state);
-extern void acpi_disable_wakeup_device(u8 sleep_state);
+extern void acpi_enable_wakeup_devices(u8 sleep_state);
+extern void acpi_disable_wakeup_devices(u8 sleep_state);
 
 extern struct list_head acpi_wakeup_device_list;
 extern struct mutex acpi_device_lock;
drivers/acpi/wakeup.c +10 -38

75 lines not on this page · raw message

Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#4 lore raw

PATCH 4/20 ACPI / Sleep: Consolidate suspend and hibernation routines

In reply to Len Brown

From: Rafael J. Wysocki <[email protected]>

Some hibernation and suspend routines can be merged, which reduces the complexity of code a bit.

---
 drivers/acpi/sleep.c |   42 ++++++++++++++++--------------------------
 1 files changed, 16 insertions(+), 26 deletions(-)
drivers/acpi/sleep.c +16 -26
index 93441c9..61c5bd0 100644
@@ -105,6 +105,16 @@ static int acpi_pm_freeze(void)
 }
 
 /**
+ * acpi_pre_suspend - Enable wakeup devices, "freeze" EC and save NVS.
+ */
+static int acpi_pm_pre_suspend(void)
+{
+	acpi_pm_freeze();
+	suspend_nvs_save();
+	return 0;
+}
+
+/**
  *	__acpi_pm_prepare - Prepare the platform to enter the target state.
  *
  *	If necessary, set the firmware waking vector and do arch-specific
@@ -113,11 +123,9 @@ static int acpi_pm_freeze(void)
 static int __acpi_pm_prepare(void)
 {
 	int error = acpi_sleep_prepare(acpi_target_sleep_state);
-
-	suspend_nvs_save();
-
 	if (error)
 		acpi_target_sleep_state = ACPI_STATE_S0;
+
 	return error;
 }
 
@@ -128,9 +136,8 @@ static int __acpi_pm_prepare(void)
 static int acpi_pm_prepare(void)
 {
 	int error = __acpi_pm_prepare();
-
 	if (!error)
-		acpi_pm_freeze();
+		acpi_pm_pre_suspend();
 
 	return error;
 }
@@ -322,9 +329,9 @@ static struct platform_suspend_ops acpi_suspend_ops = {
 static int acpi_suspend_begin_old(suspend_state_t pm_state)
 {
 	int error = acpi_suspend_begin(pm_state);
-
 	if (!error)
 		error = __acpi_pm_prepare();
+
 	return error;
 }
 
@@ -335,7 +342,7 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state)
 static struct platform_suspend_ops acpi_suspend_ops_old = {
 	.valid = acpi_suspend_state_valid,
 	.begin = acpi_suspend_begin_old,
-	.prepare_late = acpi_pm_freeze,
+	.prepare_late = acpi_pm_pre_suspend,
 	.enter = acpi_suspend_enter,
 	.wake = acpi_suspend_finish,
 	.end = acpi_pm_end,
@@ -423,16 +430,6 @@ static int acpi_hibernation_begin(void)
 	return error;
 }
 
-static int acpi_hibernation_pre_snapshot(void)
-{
-	int error = acpi_pm_prepare();
-
-	if (!error)
-		suspend_nvs_save();
-
-	return error;
-}
-
 static int acpi_hibernation_enter(void)
 {
 	acpi_status status = AE_OK;
@@ -480,7 +477,7 @@ static void acpi_pm_thaw(void)
 static struct platform_hibernation_ops acpi_hibernation_ops = {
 	.begin = acpi_hibernation_begin,
 	.end = acpi_pm_end,
-	.pre_snapshot = acpi_hibernation_pre_snapshot,
+	.pre_snapshot = acpi_pm_prepare,
 	.finish = acpi_pm_finish,
 	.prepare = acpi_pm_prepare,
 	.enter = acpi_hibernation_enter,
@@ -516,13 +513,6 @@ static int acpi_hibernation_begin_old(void)
 	return error;
 }
 
-static int acpi_hibernation_pre_snapshot_old(void)
-{
-	acpi_pm_freeze();
-	suspend_nvs_save();
-	return 0;
-}
-
 /*
  * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
  * been requested.
@@ -530,7 +520,7 @@ static int acpi_hibernation_pre_snapshot_old(void)
 static struct platform_hibernation_ops acpi_hibernation_ops_old = {
 	.begin = acpi_hibernation_begin_old,
 	.end = acpi_pm_end,
-	.pre_snapshot = acpi_hibernation_pre_snapshot_old,
+	.pre_snapshot = acpi_pm_pre_suspend,
 	.prepare = acpi_pm_freeze,
 	.finish = acpi_pm_finish,
 	.enter = acpi_hibernation_enter,
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#5 lore raw

PATCH 5/20 ACPI / Sleep: Drop acpi_suspend_finish()

In reply to Len Brown

From: Rafael J. Wysocki <[email protected]>

The function acpi_suspend_finish() is not necessary any more, because acpi_pm_finish() can be used instead of it just fine. Remove it.

---
 drivers/acpi/sleep.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
drivers/acpi/sleep.c +2 -7
index 61c5bd0..5529c70 100644
@@ -290,11 +290,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
 	return ACPI_SUCCESS(status) ? 0 : -EFAULT;
 }
 
-static void acpi_suspend_finish(void)
-{
-	acpi_pm_finish();
-}
-
 static int acpi_suspend_state_valid(suspend_state_t pm_state)
 {
 	u32 acpi_state;
@@ -316,7 +311,7 @@ static struct platform_suspend_ops acpi_suspend_ops = {
 	.begin = acpi_suspend_begin,
 	.prepare_late = acpi_pm_prepare,
 	.enter = acpi_suspend_enter,
-	.wake = acpi_suspend_finish,
+	.wake = acpi_pm_finish,
 	.end = acpi_pm_end,
 };
 
@@ -344,7 +339,7 @@ static struct platform_suspend_ops acpi_suspend_ops_old = {
 	.begin = acpi_suspend_begin_old,
 	.prepare_late = acpi_pm_pre_suspend,
 	.enter = acpi_suspend_enter,
-	.wake = acpi_suspend_finish,
+	.wake = acpi_pm_finish,
 	.end = acpi_pm_end,
 	.recover = acpi_pm_finish,
 };
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#6 lore raw

PATCH 6/20 ACPI: Add the check of ADR flag in course of finding ACPI handle for PCI device

In reply to Len Brown

From: Zhao Yakui <[email protected]>

The _ADR object is used to provide OSPM with the address of one device on its parent bus. In course of finding ACPI handle for the corresponding PCI device, we will firstly evaluate the _ADR object and then compare the two addresses to see whether it is the target ACPI device. But for one PCI device(0000:00:00.0) under the PCI root bridge, the corresponding address will be constructed as zero.In such case maybe the ACPI device without _ADR object will be misdetected and then be used to create the relationship between PCI device and ACPI device.

https://bugzilla.kernel.org/show_bug.cgi?id=16422

---
 drivers/acpi/glue.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/acpi/glue.c +2 -1
index 4af6301..78b0164 100644
@@ -100,7 +100,8 @@ do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv)
 
 	status = acpi_get_object_info(handle, &info);
 	if (ACPI_SUCCESS(status)) {
-		if (info->address == find->address)
+		if ((info->address == find->address)
+			&& (info->valid & ACPI_VALID_ADR))
 			find->handle = handle;
 		kfree(info);
 	}
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#7 lore raw

PATCH 7/20 ACPI / ACPICA: Fix reference counting problems with GPE handlers

In reply to Len Brown

From: Rafael J. Wysocki <[email protected]>

If a handler is installed for a GPE associated with an AML method and such that it cannot wake up the system from sleep states, the GPE remains enabled after the handler has been installed, although it should be disabled in that case to avoid spurious execution of the handler.

Fix this issue by making acpi_install_gpe_handler() disable GPEs that were previously associated with AML methods and cannot wake up the system from sleep states.

Analogously, make acpi_remove_gpe_handler() enable the GPEs that are associated with AML methods after their handlers have been removed and cannot wake up the system from sleep states. In addition to that, fix a code ordering issue in acpi_remove_gpe_handler() that renders the locking ineffective (ACPI_MTX_EVENTS is released temporarily in the middle of the routine to wait for the completion of events already in progress).

For this purpose introduce acpi_raw_disable_gpe() and acpi_raw_enable_gpe() to be called with acpi_gbl_gpe_lock held and rework acpi_disable_gpe() and acpi_enable_gpe(), respectively, to use them. Also rework acpi_gpe_can_wake() to use acpi_raw_disable_gpe() instead of calling acpi_disable_gpe() after releasing the lock to avoid the possible theoretical race with acpi_install_gpe_handler().

---
 drivers/acpi/acpica/acevents.h |    4 ++
 drivers/acpi/acpica/aclocal.h  |    1 +
 drivers/acpi/acpica/evgpe.c    |   73 +++++++++++++++++++++++++++++++++++++
 drivers/acpi/acpica/evxface.c  |   77 +++++++++++++++++++++++++++-------------
 drivers/acpi/acpica/evxfevnt.c |   62 +++++---------------------------
 5 files changed, 139 insertions(+), 78 deletions(-)
drivers/acpi/acpica/acevents.h +4 -0
index e0e6aff..36867cd 100644
@@ -82,6 +82,10 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info);
 
 acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
+acpi_status acpi_raw_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
+
+acpi_status acpi_raw_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
+
 struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
 						       u32 gpe_number);
 
drivers/acpi/acpica/aclocal.h +1 -0
index 1ee0bcf..df85b53 100644
@@ -412,6 +412,7 @@ struct acpi_handler_info {
 	acpi_event_handler address;	/* Address of handler, if any */
 	void *context;		/* Context to be passed to handler */
 	struct acpi_namespace_node *method_node;	/* Method node for this GPE level (saved) */
+	u8 orig_flags;		/* Original misc info about this GPE */
 };
 
 union acpi_gpe_dispatch_info {
drivers/acpi/acpica/evgpe.c +73 -0

79 lines not on this page · raw message

drivers/acpi/acpica/evxface.c +52 -25

139 lines not on this page · raw message

drivers/acpi/acpica/evxfevnt.c +9 -53

105 lines not on this page · raw message

Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#8 lore raw

PATCH 8/20 ACPI, APEI, Fix a typo of error path of apei_resources_request

In reply to Len Brown

From: Huang Ying <[email protected]>

Fix a typo of error path of apei_resources_request. release_mem_region and release_region should be interchange.

---
 drivers/acpi/apei/apei-base.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/apei/apei-base.c +2 -2
index 216e1e9..73fd0c7 100644
@@ -482,14 +482,14 @@ err_unmap_ioport:
 	list_for_each_entry(res, &resources->ioport, list) {
 		if (res == res_bak)
 			break;
-		release_mem_region(res->start, res->end - res->start);
+		release_region(res->start, res->end - res->start);
 	}
 	res_bak = NULL;
 err_unmap_iomem:
 	list_for_each_entry(res, &resources->iomem, list) {
 		if (res == res_bak)
 			break;
-		release_region(res->start, res->end - res->start);
+		release_mem_region(res->start, res->end - res->start);
 	}
 	return -EINVAL;
 }
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#9 lore raw

PATCH 9/20 ACPI, APEI, Rename CPER and GHES severity constants

In reply to Len Brown

From: Huang Ying <[email protected]>

The abbreviation of severity should be SEV instead of SER, so the CPER severity constants are renamed accordingly. GHES severity constants are renamed in the same way too.

---
 arch/x86/kernel/cpu/mcheck/mce-apei.c |    4 ++--
 drivers/acpi/apei/ghes.c              |   32 ++++++++++++++++----------------
 include/linux/cper.h                  |    8 ++++----
 3 files changed, 22 insertions(+), 22 deletions(-)
arch/x86/kernel/cpu/mcheck/mce-apei.c +2 -2
index 745b54f..8209472 100644
@@ -80,7 +80,7 @@ int apei_write_mce(struct mce *m)
 	rcd.hdr.revision = CPER_RECORD_REV;
 	rcd.hdr.signature_end = CPER_SIG_END;
 	rcd.hdr.section_count = 1;
-	rcd.hdr.error_severity = CPER_SER_FATAL;
+	rcd.hdr.error_severity = CPER_SEV_FATAL;
 	/* timestamp, platform_id, partition_id are all invalid */
 	rcd.hdr.validation_bits = 0;
 	rcd.hdr.record_length = sizeof(rcd);
@@ -96,7 +96,7 @@ int apei_write_mce(struct mce *m)
 	rcd.sec_hdr.validation_bits = 0;
 	rcd.sec_hdr.flags = CPER_SEC_PRIMARY;
 	rcd.sec_hdr.section_type = CPER_SECTION_TYPE_MCE;
-	rcd.sec_hdr.section_severity = CPER_SER_FATAL;
+	rcd.sec_hdr.section_severity = CPER_SEV_FATAL;
 
 	memcpy(&rcd.mce, m, sizeof(*m));
 
drivers/acpi/apei/ghes.c +16 -16
index fd0cc01..c76aff6 100644
@@ -132,26 +132,26 @@ static void ghes_fini(struct ghes *ghes)
 }
 
 enum {
-	GHES_SER_NO = 0x0,
-	GHES_SER_CORRECTED = 0x1,
-	GHES_SER_RECOVERABLE = 0x2,
-	GHES_SER_PANIC = 0x3,
+	GHES_SEV_NO = 0x0,
+	GHES_SEV_CORRECTED = 0x1,
+	GHES_SEV_RECOVERABLE = 0x2,
+	GHES_SEV_PANIC = 0x3,
 };
 
 static inline int ghes_severity(int severity)
 {
 	switch (severity) {
-	case CPER_SER_INFORMATIONAL:
-		return GHES_SER_NO;
-	case CPER_SER_CORRECTED:
-		return GHES_SER_CORRECTED;
-	case CPER_SER_RECOVERABLE:
-		return GHES_SER_RECOVERABLE;
-	case CPER_SER_FATAL:
-		return GHES_SER_PANIC;
+	case CPER_SEV_INFORMATIONAL:
+		return GHES_SEV_NO;
+	case CPER_SEV_CORRECTED:
+		return GHES_SEV_CORRECTED;
+	case CPER_SEV_RECOVERABLE:
+		return GHES_SEV_RECOVERABLE;
+	case CPER_SEV_FATAL:
+		return GHES_SEV_PANIC;
 	default:
 		/* Unkown, go panic */
-		return GHES_SER_PANIC;
+		return GHES_SEV_PANIC;
 	}
 }
 
@@ -237,16 +237,16 @@ static void ghes_clear_estatus(struct ghes *ghes)
 
 static void ghes_do_proc(struct ghes *ghes)
 {
-	int ser, processed = 0;
+	int sev, processed = 0;
 	struct acpi_hest_generic_data *gdata;
 
-	ser = ghes_severity(ghes->estatus->error_severity);
+	sev = ghes_severity(ghes->estatus->error_severity);
 	apei_estatus_for_each_section(ghes->estatus, gdata) {
 #ifdef CONFIG_X86_MCE
 		if (!uuid_le_cmp(*(uuid_le *)gdata->section_type,
 				 CPER_SEC_PLATFORM_MEM)) {
 			apei_mce_report_mem_error(
-				ser == GHES_SER_CORRECTED,
+				sev == GHES_SEV_CORRECTED,
 				(struct cper_sec_mem_err *)(gdata+1));
 			processed = 1;
 		}
include/linux/cper.h +4 -4
index 4b38f90..bf972f8 100644
@@ -39,10 +39,10 @@
  * Severity difinition for error_severity in struct cper_record_header
  * and section_severity in struct cper_section_descriptor
  */
-#define CPER_SER_RECOVERABLE			0x0
-#define CPER_SER_FATAL				0x1
-#define CPER_SER_CORRECTED			0x2
-#define CPER_SER_INFORMATIONAL			0x3
+#define CPER_SEV_RECOVERABLE			0x0
+#define CPER_SEV_FATAL				0x1
+#define CPER_SEV_CORRECTED			0x2
+#define CPER_SEV_INFORMATIONAL			0x3
 
 /*
  * Validation bits difinition for validation_bits in struct
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#10 lore raw

PATCH 10/20 ACPI, APEI, Manage GHES as platform devices

In reply to Len Brown

From: Huang Ying <[email protected]>

Register GHES during HEST initialization as platform devices. And make GHES driver into platform device driver. So that the GHES driver module can be loaded automatically when there are GHES available.

---
 drivers/acpi/apei/ghes.c |  140 ++++++++++++++++++++++++---------------------
 drivers/acpi/apei/hest.c |   76 +++++++++++++++++++++++--
 2 files changed, 145 insertions(+), 71 deletions(-)
drivers/acpi/apei/ghes.c +75 -65
index c76aff6..385a605 100644
@@ -41,6 +41,8 @@
 #include <linux/interrupt.h>
 #include <linux/cper.h>
 #include <linux/kdebug.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
 #include <acpi/apei.h>
 #include <acpi/atomicio.h>
 #include <acpi/hed.h>
@@ -87,6 +89,7 @@ struct ghes {
  * used for that.
  */
 static LIST_HEAD(ghes_sci);
+static DEFINE_MUTEX(ghes_list_mutex);
 
 static struct ghes *ghes_new(struct acpi_hest_generic *generic)
 {
@@ -293,18 +296,15 @@ static struct notifier_block ghes_notifier_sci = {
 	.notifier_call = ghes_notify_sci,
 };
 
-static int hest_ghes_parse(struct acpi_hest_header *hest_hdr, void *data)
+static int __devinit ghes_probe(struct platform_device *ghes_dev)
 {
 	struct acpi_hest_generic *generic;
 	struct ghes *ghes = NULL;
-	int rc = 0;
+	int rc = -EINVAL;
 
-	if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR)
-		return 0;
-
-	generic = (struct acpi_hest_generic *)hest_hdr;
+	generic = ghes_dev->dev.platform_data;
 	if (!generic->enabled)
-		return 0;
+		return -ENODEV;
 
 	if (generic->error_block_length <
 	    sizeof(struct acpi_hest_generic_status)) {
@@ -327,62 +327,91 @@ static int hest_ghes_parse(struct acpi_hest_header *hest_hdr, void *data)
 		ghes = NULL;
 		goto err;
 	}
-	switch (generic->notify.type) {
-	case ACPI_HEST_NOTIFY_POLLED:
-		pr_warning(GHES_PFX
-"Generic hardware error source: %d notified via POLL is not supported!\n",
-			   generic->header.source_id);
-		break;
-	case ACPI_HEST_NOTIFY_EXTERNAL:
-	case ACPI_HEST_NOTIFY_LOCAL:
-		pr_warning(GHES_PFX
-"Generic hardware error source: %d notified via IRQ is not supported!\n",
-			   generic->header.source_id);
-		break;
-	case ACPI_HEST_NOTIFY_SCI:
+	if (generic->notify.type == ACPI_HEST_NOTIFY_SCI) {
+		mutex_lock(&ghes_list_mutex);
 		if (list_empty(&ghes_sci))
 			register_acpi_hed_notifier(&ghes_notifier_sci);
 		list_add_rcu(&ghes->list, &ghes_sci);
-		break;
-	case ACPI_HEST_NOTIFY_NMI:
-		pr_warning(GHES_PFX
-"Generic hardware error source: %d notified via NMI is not supported!\n",
-			   generic->header.source_id);
-		break;
-	default:
-		pr_warning(FW_WARN GHES_PFX
-	"Unknown notification type: %u for generic hardware error source: %d\n",
-			   generic->notify.type, generic->header.source_id);
-		break;
+		mutex_unlock(&ghes_list_mutex);
+	} else {
+		unsigned char *notify = NULL;
+
+		switch (generic->notify.type) {
+		case ACPI_HEST_NOTIFY_POLLED:
+			notify = "POLL";
+			break;
+		case ACPI_HEST_NOTIFY_EXTERNAL:
+		case ACPI_HEST_NOTIFY_LOCAL:
+			notify = "IRQ";
+			break;
+		case ACPI_HEST_NOTIFY_NMI:
+			notify = "NMI";
+			break;
+		}
+		if (notify) {
+			pr_warning(GHES_PFX
+"Generic hardware error source: %d notified via %s is not supported!\n",
+				   generic->header.source_id, notify);
+		} else {
+			pr_warning(FW_WARN GHES_PFX
+"Unknown notification type: %u for generic hardware error source: %d\n",
+			generic->notify.type, generic->header.source_id);
+		}
+		rc = -ENODEV;
+		goto err;
 	}
+	platform_set_drvdata(ghes_dev, ghes);
 
 	return 0;
 err:
-	if (ghes)
+	if (ghes) {
 		ghes_fini(ghes);
+		kfree(ghes);
+	}
 	return rc;
 }
 
-static void ghes_cleanup(void)
+static int __devexit ghes_remove(struct platform_device *ghes_dev)
 {
-	struct ghes *ghes, *nghes;
+	struct ghes *ghes;
+	struct acpi_hest_generic *generic;
 
-	if (!list_empty(&ghes_sci))
-		unregister_acpi_hed_notifier(&ghes_notifier_sci);
+	ghes = platform_get_drvdata(ghes_dev);
+	generic = ghes->generic;
+
+	switch (generic->notify.type) {
+	case ACPI_HEST_NOTIFY_SCI:
+		mutex_lock(&ghes_list_mutex);
+		list_del_rcu(&ghes->list);
+		if (list_empty(&ghes_sci))
+			unregister_acpi_hed_notifier(&ghes_notifier_sci);
+		mutex_unlock(&ghes_list_mutex);
+		break;
+	default:
+		BUG();
+		break;
+	}
 
 	synchronize_rcu();
+	ghes_fini(ghes);
+	kfree(ghes);
 
-	list_for_each_entry_safe(ghes, nghes, &ghes_sci, list) {
-		list_del(&ghes->list);
-		ghes_fini(ghes);
-		kfree(ghes);
-	}
+	platform_set_drvdata(ghes_dev, NULL);
+
+	return 0;
 }
 
+static struct platform_driver ghes_platform_driver = {
+	.driver		= {
+		.name	= "GHES",
+		.owner	= THIS_MODULE,
+	},
+	.probe		= ghes_probe,
+	.remove		= ghes_remove,
+};
+
 static int __init ghes_init(void)
 {
-	int rc;
-
 	if (acpi_disabled)
 		return -ENODEV;
 
@@ -391,32 +420,12 @@ static int __init ghes_init(void)
 		return -EINVAL;
 	}
 
-	rc = apei_hest_parse(hest_ghes_parse, NULL);
-	if (rc) {
-		pr_err(GHES_PFX
-		"Error during parsing HEST generic hardware error sources.\n");
-		goto err_cleanup;
-	}
-
-	if (list_empty(&ghes_sci)) {
-		pr_info(GHES_PFX
-			"No functional generic hardware error sources.\n");
-		rc = -ENODEV;
-		goto err_cleanup;
-	}
-
-	pr_info(GHES_PFX
-		"Generic Hardware Error Source support is initialized.\n");
-
-	return 0;
-err_cleanup:
-	ghes_cleanup();
-	return rc;
+	return platform_driver_register(&ghes_platform_driver);
 }
 
 static void __exit ghes_exit(void)
 {
-	ghes_cleanup();
+	platform_driver_unregister(&ghes_platform_driver);
 }
 
 module_init(ghes_init);
@@ -425,3 +434,4 @@ module_exit(ghes_exit);
 MODULE_AUTHOR("Huang Ying");
 MODULE_DESCRIPTION("APEI Generic Hardware Error Source support");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:GHES");
drivers/acpi/apei/hest.c +70 -6

106 lines not on this page · raw message

Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#11 lore raw

PATCH 11/20 ACPI, APEI, ERST debug support

In reply to Len Brown

From: Huang Ying <[email protected]>

This patch adds debugging/testing support to ERST. A misc device is implemented to export raw ERST read/write/clear etc operations to user space. With this patch, we can add ERST testing support to linuxfirmwarekit ISO (linuxfirmwarekit.org) to verify the kernel support and the firmware implementation.

---
 drivers/acpi/apei/Kconfig    |    9 ++
 drivers/acpi/apei/Makefile   |    1 +
 drivers/acpi/apei/erst-dbg.c |  207 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 217 insertions(+), 0 deletions(-)
 create mode 100644 drivers/acpi/apei/erst-dbg.c
drivers/acpi/apei/Kconfig +9 -0
index f8c668f..907e350 100644
@@ -28,3 +28,12 @@ config ACPI_APEI_EINJ
 	  EINJ provides a hardware error injection mechanism, it is
 	  mainly used for debugging and testing the other parts of
 	  APEI and some other RAS features.
+
+config ACPI_APEI_ERST_DEBUG
+	tristate "APEI Error Record Serialization Table (ERST) Debug Support"
+	depends on ACPI_APEI
+	help
+	  ERST is a way provided by APEI to save and retrieve hardware
+	  error infomation to and from a persistent store. Enable this
+	  if you want to debugging and testing the ERST kernel support
+	  and firmware implementation.
drivers/acpi/apei/Makefile +1 -0
index b13b03a..d1d1bc0 100644
@@ -1,5 +1,6 @@
 obj-$(CONFIG_ACPI_APEI)		+= apei.o
 obj-$(CONFIG_ACPI_APEI_GHES)	+= ghes.o
 obj-$(CONFIG_ACPI_APEI_EINJ)	+= einj.o
+obj-$(CONFIG_ACPI_APEI_ERST_DEBUG) += erst-dbg.o
 
 apei-y := apei-base.o hest.o cper.o erst.o
drivers/acpi/apei/erst-dbg.c new file +207 -0

207 lines not on this page · raw message

Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#12 lore raw

PATCH 12/20 ACPI: introduce drivers/acpi/debugfs.c

In reply to Len Brown

From: Zhang Rui <[email protected]>

Introduce drivers/acpi/debugfs.c.

Code for ACPI debugfs I/F,
i.e. /sys/kernel/debug/acpi/custom_method,
is moved to this file.

And make ACPI debugfs always built in,
even if CONFIG_ACPI_DEBUG is cleared.

BTW:this adds about 400bytes code to ACPI, when
CONFIG_ACPI_DEBUG is cleared.

[uaccess.h build fix from Andrew Morton <[email protected]>]

---
 drivers/acpi/Makefile   |    1 +
 drivers/acpi/bus.c      |    1 +
 drivers/acpi/debug.c    |   75 -----------------------------------------
 drivers/acpi/debugfs.c  |   85 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/acpi/internal.h |    6 +++
 5 files changed, 93 insertions(+), 75 deletions(-)
 create mode 100644 drivers/acpi/debugfs.c
drivers/acpi/Makefile +1 -0
index 6ee3316..7891904 100644
@@ -39,6 +39,7 @@ acpi-y				+= pci_root.o pci_link.o pci_irq.o pci_bind.o
 acpi-y				+= power.o
 acpi-y				+= system.o event.o
 acpi-$(CONFIG_ACPI_DEBUG)	+= debug.o
+acpi-$(CONFIG_DEBUG_FS)		+= debugfs.o
 acpi-$(CONFIG_ACPI_NUMA)	+= numa.o
 acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
 ifdef CONFIG_ACPI_VIDEO
drivers/acpi/bus.c +1 -0
index c1d23cd..7136f24 100644
@@ -1036,6 +1036,7 @@ static int __init acpi_init(void)
 	acpi_power_init();
 	acpi_system_init();
 	acpi_debug_init();
+	acpi_debugfs_init();
 	acpi_sleep_proc_init();
 	acpi_wakeup_device_init();
 	return result;
drivers/acpi/debug.c +0 -75

87 lines not on this page · raw message

drivers/acpi/debugfs.c new file +85 -0

85 lines not on this page · raw message

drivers/acpi/internal.h +6 -0
index f8f190e..0650e34 100644
@@ -30,6 +30,12 @@ int acpi_debug_init(void);
 static inline int acpi_debug_init(void) { return 0; }
 #endif
 
+#ifdef CONFIG_DEBUG_FS
+int acpi_debugfs_init(void);
+#else
+static inline int acpi_debugfs_init(void) { return 0; }
+#endif
+
 /* --------------------------------------------------------------------------
                                   Power Resource
    -------------------------------------------------------------------------- */
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#13 lore raw

PATCH 13/20 ACPI: introduce module parameter acpi.aml_debug_output

In reply to Len Brown

From: Zhang Rui <[email protected]>

Introduce module parameter acpi.aml_debug_output.

With acpi.aml_debug_output set, we can get AML debug object output (Store (AAA, Debug)), even with CONFIG_ACPI_DEBUG cleared.

Together with the runtime custom method mechanism, we can debug AML code problems without rebuilding the kernel.

---
 Documentation/acpi/method-customizing.txt |    2 ++
 drivers/acpi/acpica/acglobal.h            |    2 +-
 drivers/acpi/debugfs.c                    |    8 ++++++++
 include/acpi/acpixf.h                     |    2 +-
 4 files changed, 12 insertions(+), 2 deletions(-)
Documentation/acpi/method-customizing.txt +2 -0
index e628cd2..3e1d25a 100644
@@ -19,6 +19,8 @@ Note: Only ACPI METHOD can be overridden, any other object types like
       "Device", "OperationRegion", are not recognized.
 Note: The same ACPI control method can be overridden for many times,
       and it's always the latest one that used by Linux/kernel.
+Note: To get the ACPI debug object output (Store (AAAA, Debug)),
+      please run "echo 1 > /sys/module/acpi/parameters/aml_debug_output".
 
 1. override an existing method
    a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT,
drivers/acpi/acpica/acglobal.h +1 -1
index 899d68a..9212229 100644
@@ -115,7 +115,7 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
 /*
  * Optionally enable output from the AML Debug Object.
  */
-u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
+u32 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
 
 /*
  * Optionally copy the entire DSDT to local memory (instead of simply
drivers/acpi/debugfs.c +8 -0
index abfcf9f..7de27d4 100644
@@ -12,6 +12,14 @@
 #define _COMPONENT		ACPI_SYSTEM_COMPONENT
 ACPI_MODULE_NAME("debugfs");
 
+
+/* /sys/modules/acpi/parameters/aml_debug_output */
+
+module_param_named(aml_debug_output, acpi_gbl_enable_aml_debug_object,
+		   bool, 0644);
+MODULE_PARM_DESC(aml_debug_output,
+		 "To enable/disable the ACPI Debug Object output.");
+
 /* /sys/kernel/debug/acpi/custom_method */
 
 static ssize_t cm_write(struct file *file, const char __user * user_buf,
include/acpi/acpixf.h +1 -1
index 1371cc9..a6ea2ac 100644
@@ -67,7 +67,7 @@ extern u8 acpi_gbl_leave_wake_gpes_disabled;
 extern u8 acpi_gbl_use_default_register_widths;
 extern acpi_name acpi_gbl_trace_method_name;
 extern u32 acpi_gbl_trace_flags;
-extern u8 acpi_gbl_enable_aml_debug_object;
+extern u32 acpi_gbl_enable_aml_debug_object;
 extern u8 acpi_gbl_copy_dsdt_locally;
 extern u8 acpi_gbl_truncate_io_addresses;
 
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#14 lore raw

PATCH 14/20 ACPI: introduce drivers/acpi/sysfs.c

In reply to Len Brown

From: Zhang Rui <[email protected]>

Introduce drivers/acpi/sysfs.c.

code for ACPI sysfs I/F, including
#ifdef ACPI_DEBUG
/sys/module/acpi/parameters/debug_layer
/sys/module/acpi/parameters/debug_level
/sys/module/acpi/parameters/trace_method_name
/sys/module/acpi/parameters/trace_debug_layer
/sys/module/acpi/parameters/trace_debug_level
/sys/module/acpi/parameters/trace_state
#endif
/sys/module/acpi/parameters/acpica_version
/sys/firmware/acpi/tables/
/sys/firmware/acpi/interrupts/
is moved to this file.

No function change in this patch.

---
 drivers/acpi/Makefile              |    1 +
 drivers/acpi/bus.c                 |    1 +
 drivers/acpi/debug.c               |  104 -----
 drivers/acpi/internal.h            |    1 +
 drivers/acpi/{system.c => sysfs.c} |  466 ++++++++++++----------
 drivers/acpi/system.c              |  807 ++++++++----------------------------
 6 files changed, 430 insertions(+), 950 deletions(-)
 rename drivers/acpi/{system.c => sysfs.c} (57%)

rewrite drivers/acpi/system.c (72%)

drivers/acpi/Makefile +1 -0
index 7891904..03a81a8 100644
@@ -38,6 +38,7 @@ acpi-$(CONFIG_ACPI_DOCK)	+= dock.o
 acpi-y				+= pci_root.o pci_link.o pci_irq.o pci_bind.o
 acpi-y				+= power.o
 acpi-y				+= system.o event.o
+acpi-y				+= sysfs.o
 acpi-$(CONFIG_ACPI_DEBUG)	+= debug.o
 acpi-$(CONFIG_DEBUG_FS)		+= debugfs.o
 acpi-$(CONFIG_ACPI_NUMA)	+= numa.o
drivers/acpi/bus.c +1 -0
index 7136f24..bd9708b 100644
@@ -1036,6 +1036,7 @@ static int __init acpi_init(void)
 	acpi_power_init();
 	acpi_system_init();
 	acpi_debug_init();
+	acpi_sysfs_init();
 	acpi_debugfs_init();
 	acpi_sleep_proc_init();
 	acpi_wakeup_device_init();
drivers/acpi/debug.c +0 -104

110 lines not on this page · raw message

drivers/acpi/internal.h +1 -0
index 0650e34..eed8234 100644
@@ -23,6 +23,7 @@
 int init_acpi_device_notify(void);
 int acpi_scan_init(void);
 int acpi_system_init(void);
+int acpi_sysfs_init(void);
 
 #ifdef CONFIG_ACPI_DEBUG
 int acpi_debug_init(void);
drivers/acpi/sysfs.c renamed from drivers/acpi/system.c +257 -209

642 lines not on this page · raw message

drivers/acpi/system.c +170 -637

807 lines not on this page · raw message

Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#15 lore raw

PATCH 15/20 ACPI: remove deprecated ACPI procfs I/F

In reply to Len Brown

From: Zhang Rui <[email protected]>

Rmove deprecated ACPI procfs I/F, including
/proc/acpi/debug_layer
/proc/acpi/debug_level
/proc/acpi/info
/proc/acpi/dsdt
/proc/acpi/fadt
/proc/acpi/sleep

because the sysfs I/F is already available
and has been working well for years.

---
 drivers/acpi/Kconfig    |    6 --
 drivers/acpi/Makefile   |    3 +-
 drivers/acpi/bus.c      |    2 -
 drivers/acpi/debug.c    |  227 -----------------------------------------------
 drivers/acpi/internal.h |    7 --
 drivers/acpi/proc.c     |   70 ---------------
 drivers/acpi/system.c   |  170 -----------------------------------
 7 files changed, 1 insertions(+), 484 deletions(-)
 delete mode 100644 drivers/acpi/debug.c
 delete mode 100644 drivers/acpi/system.c
drivers/acpi/Kconfig +0 -6
index 7464115..d77d9c2 100644
@@ -54,12 +54,6 @@ config ACPI_PROCFS
 	  they have been replaced by functions in /sys.
 	  The deprecated files (and their replacements) include:
 
-	  /proc/acpi/sleep (/sys/power/state)
-	  /proc/acpi/info (/sys/module/acpi/parameters/acpica_version)
-	  /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT)
-	  /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP)
-	  /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
-	  /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level)
 	  /proc/acpi/processor/*/power (/sys/devices/system/cpu/*/cpuidle/*)
 	  /proc/acpi/processor/*/performance (/sys/devices/system/cpu/*/
 		cpufreq/*)
drivers/acpi/Makefile +1 -2
index 03a81a8..3f04496 100644
@@ -37,9 +37,8 @@ acpi-y				+= ec.o
 acpi-$(CONFIG_ACPI_DOCK)	+= dock.o
 acpi-y				+= pci_root.o pci_link.o pci_irq.o pci_bind.o
 acpi-y				+= power.o
-acpi-y				+= system.o event.o
+acpi-y				+= event.o
 acpi-y				+= sysfs.o
-acpi-$(CONFIG_ACPI_DEBUG)	+= debug.o
 acpi-$(CONFIG_DEBUG_FS)		+= debugfs.o
 acpi-$(CONFIG_ACPI_NUMA)	+= numa.o
 acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
drivers/acpi/bus.c +0 -2
index bd9708b..5c221ab 100644
@@ -1034,8 +1034,6 @@ static int __init acpi_init(void)
 	acpi_scan_init();
 	acpi_ec_init();
 	acpi_power_init();
-	acpi_system_init();
-	acpi_debug_init();
 	acpi_sysfs_init();
 	acpi_debugfs_init();
 	acpi_sleep_proc_init();
drivers/acpi/debug.c deleted +0 -227

227 lines not on this page · raw message

drivers/acpi/internal.h +0 -7
index eed8234..e379644 100644
@@ -22,15 +22,8 @@
 
 int init_acpi_device_notify(void);
 int acpi_scan_init(void);
-int acpi_system_init(void);
 int acpi_sysfs_init(void);
 
-#ifdef CONFIG_ACPI_DEBUG
-int acpi_debug_init(void);
-#else
-static inline int acpi_debug_init(void) { return 0; }
-#endif
-
 #ifdef CONFIG_DEBUG_FS
 int acpi_debugfs_init(void);
 #else
drivers/acpi/proc.c +0 -70

93 lines not on this page · raw message

drivers/acpi/system.c deleted +0 -170

170 lines not on this page · raw message

Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#16 lore raw

PATCH 16/20 ACPI power_resource: remove unused procfs I/F

In reply to Len Brown

From: Zhang Rui <[email protected]>

Remove unused ACPI power procfs I/F.

---
 drivers/acpi/power.c |  128 +-------------------------------------------------
 1 files changed, 1 insertions(+), 127 deletions(-)
drivers/acpi/power.c +1 -127
index f74d3b3..4fe5018 100644
@@ -40,8 +40,6 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/slab.h>
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 #include "sleep.h"
@@ -64,7 +62,6 @@ module_param_named(power_nocheck, acpi_power_nocheck, bool, 000);
 static int acpi_power_add(struct acpi_device *device);
 static int acpi_power_remove(struct acpi_device *device, int type);
 static int acpi_power_resume(struct acpi_device *device);
-static int acpi_power_open_fs(struct inode *inode, struct file *file);
 
 static const struct acpi_device_id power_device_ids[] = {
 	{ACPI_POWER_HID, 0},
@@ -99,14 +96,6 @@ struct acpi_power_resource {
 
 static struct list_head acpi_power_resource_list;
 
-static const struct file_operations acpi_power_fops = {
-	.owner = THIS_MODULE,
-	.open = acpi_power_open_fs,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
-
 /* --------------------------------------------------------------------------
                              Power Resource Management
    -------------------------------------------------------------------------- */
@@ -542,102 +531,6 @@ int acpi_power_transition(struct acpi_device *device, int state)
 }
 
 /* --------------------------------------------------------------------------
-                              FS Interface (/proc)
-   -------------------------------------------------------------------------- */
-
-static struct proc_dir_entry *acpi_power_dir;
-
-static int acpi_power_seq_show(struct seq_file *seq, void *offset)
-{
-	int count = 0;
-	int result = 0, state;
-	struct acpi_power_resource *resource = NULL;
-	struct list_head *node, *next;
-	struct acpi_power_reference *ref;
-
-
-	resource = seq->private;
-
-	if (!resource)
-		goto end;
-
-	result = acpi_power_get_state(resource->device->handle, &state);
-	if (result)
-		goto end;
-
-	seq_puts(seq, "state:                   ");
-	switch (state) {
-	case ACPI_POWER_RESOURCE_STATE_ON:
-		seq_puts(seq, "on\n");
-		break;
-	case ACPI_POWER_RESOURCE_STATE_OFF:
-		seq_puts(seq, "off\n");
-		break;
-	default:
-		seq_puts(seq, "unknown\n");
-		break;
-	}
-
-	mutex_lock(&resource->resource_lock);
-	list_for_each_safe(node, next, &resource->reference) {
-		ref = container_of(node, struct acpi_power_reference, node);
-		count++;
-	}
-	mutex_unlock(&resource->resource_lock);
-
-	seq_printf(seq, "system level:            S%d\n"
-		   "order:                   %d\n"
-		   "reference count:         %d\n",
-		   resource->system_level,
-		   resource->order, count);
-
-      end:
-	return 0;
-}
-
-static int acpi_power_open_fs(struct inode *inode, struct file *file)
-{
-	return single_open(file, acpi_power_seq_show, PDE(inode)->data);
-}
-
-static int acpi_power_add_fs(struct acpi_device *device)
-{
-	struct proc_dir_entry *entry = NULL;
-
-
-	if (!device)
-		return -EINVAL;
-
-	if (!acpi_device_dir(device)) {
-		acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-						     acpi_power_dir);
-		if (!acpi_device_dir(device))
-			return -ENODEV;
-	}
-
-	/* 'status' [R] */
-	entry = proc_create_data(ACPI_POWER_FILE_STATUS,
-				 S_IRUGO, acpi_device_dir(device),
-				 &acpi_power_fops, acpi_driver_data(device));
-	if (!entry)
-		return -EIO;
-	return 0;
-}
-
-static int acpi_power_remove_fs(struct acpi_device *device)
-{
-
-	if (acpi_device_dir(device)) {
-		remove_proc_entry(ACPI_POWER_FILE_STATUS,
-				  acpi_device_dir(device));
-		remove_proc_entry(acpi_device_bid(device), acpi_power_dir);
-		acpi_device_dir(device) = NULL;
-	}
-
-	return 0;
-}
-
-/* --------------------------------------------------------------------------
                                 Driver Interface
    -------------------------------------------------------------------------- */
 
@@ -690,10 +583,6 @@ static int acpi_power_add(struct acpi_device *device)
 		break;
 	}
 
-	result = acpi_power_add_fs(device);
-	if (result)
-		goto end;
-
 	printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device),
 	       acpi_device_bid(device), state ? "on" : "off");
 
@@ -715,8 +604,6 @@ static int acpi_power_remove(struct acpi_device *device, int type)
 
 	resource = acpi_driver_data(device);
 
-	acpi_power_remove_fs(device);
-
 	mutex_lock(&resource->resource_lock);
 	list_for_each_safe(node, next, &resource->reference) {
 		struct acpi_power_reference *ref = container_of(node, struct acpi_power_reference, node);
@@ -760,19 +647,6 @@ static int acpi_power_resume(struct acpi_device *device)
 
 int __init acpi_power_init(void)
 {
-	int result = 0;
-
 	INIT_LIST_HEAD(&acpi_power_resource_list);
-
-	acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir);
-	if (!acpi_power_dir)
-		return -ENODEV;
-
-	result = acpi_bus_register_driver(&acpi_power_driver);
-	if (result < 0) {
-		remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir);
-		return -ENODEV;
-	}
-
-	return 0;
+	return acpi_bus_register_driver(&acpi_power_driver);
 }
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#17 lore raw

PATCH 17/20 ACPI processor: remove deprecated ACPI procfs I/F

In reply to Len Brown

From: Zhang Rui <[email protected]>

Remove deprecated ACPI processor procfs I/F, including:
/proc/acpi/processor/CPUX/power /proc/acpi/processor/CPUX/limit /proc/acpi/processor/CPUX/info

/proc/acpi/processor/CPUX/throttling still exists, as we don't have sysfs I/F available for now.

---
 drivers/acpi/Kconfig                |    3 -
 drivers/acpi/processor_driver.c     |   85 ------------------------------
 drivers/acpi/processor_idle.c       |   99 -----------------------------------
 drivers/acpi/processor_thermal.c    |   83 -----------------------------
 drivers/acpi/processor_throttling.c |    2 -
 include/acpi/processor.h            |    1 -
 6 files changed, 0 insertions(+), 273 deletions(-)
drivers/acpi/Kconfig +0 -3
index d77d9c2..6f66a93 100644
@@ -54,9 +54,6 @@ config ACPI_PROCFS
 	  they have been replaced by functions in /sys.
 	  The deprecated files (and their replacements) include:
 
-	  /proc/acpi/processor/*/power (/sys/devices/system/cpu/*/cpuidle/*)
-	  /proc/acpi/processor/*/performance (/sys/devices/system/cpu/*/
-		cpufreq/*)
 	  /proc/acpi/processor/*/throttling (/sys/class/thermal/
 		cooling_device*/*)
 	  This option has no effect on /proc/acpi/ files
drivers/acpi/processor_driver.c +0 -85

154 lines not on this page · raw message

drivers/acpi/processor_idle.c +0 -99

134 lines not on this page · raw message

drivers/acpi/processor_thermal.c +0 -83

92 lines not on this page · raw message

drivers/acpi/processor_throttling.c +0 -2
index 9ade1a5..7308638 100644
@@ -1215,7 +1215,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
 }
 
 /* proc interface */
-#ifdef CONFIG_ACPI_PROCFS
 static int acpi_processor_throttling_seq_show(struct seq_file *seq,
 					      void *offset)
 {
@@ -1323,4 +1322,3 @@ const struct file_operations acpi_processor_throttling_fops = {
 	.llseek = seq_lseek,
 	.release = single_release,
 };
-#endif
include/acpi/processor.h +0 -1
index a68ca8a..1b62102 100644
@@ -338,7 +338,6 @@ extern struct cpuidle_driver acpi_idle_driver;
 
 /* in processor_thermal.c */
 int acpi_processor_get_limit_info(struct acpi_processor *pr);
-extern const struct file_operations acpi_processor_limit_fops;
 extern struct thermal_cooling_device_ops processor_cooling_ops;
 #ifdef CONFIG_CPU_FREQ
 void acpi_thermal_cpufreq_init(void);
Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#18 lore raw

PATCH 18/20 ACPI video: make procfs I/F depend on CONFIG_ACPI_PROCFS

In reply to Len Brown

From: Zhang Rui <[email protected]>

Mark ACPI video driver procfs I/F deprecated, including:
/proc/acpi/video/*/info
/proc/acpi/video/*/DOS
/proc/acpi/video/*/ROM
/proc/acpi/video/*/POST
/proc/acpi/video/*/POST_info
/proc/acpi/video/*/*/info
/proc/acpi/video/*/*/state
/proc/acpi/video/*/*/EDID
and
/proc/acpi/video/*/*/brightness, because
1. we already have the sysfs I/F /sysclass/backlight/ as the replacement of /proc/acpi/video/*/*/brightness.
2. the other procfs I/F is not useful for userspace.

---
 drivers/acpi/Kconfig |    1 +
 drivers/acpi/video.c |  131 +++++++++++++++++++++++++++++++-------------------
 2 files changed, 82 insertions(+), 50 deletions(-)
drivers/acpi/Kconfig +1 -0
index 6f66a93..354e613 100644
@@ -56,6 +56,7 @@ config ACPI_PROCFS
 
 	  /proc/acpi/processor/*/throttling (/sys/class/thermal/
 		cooling_device*/*)
+	  /proc/acpi/video/*/brightness (/sys/class/backlight/)
 	  This option has no effect on /proc/acpi/ files
 	  and functions which do not yet exist in /sys.
 
drivers/acpi/video.c +81 -50

214 lines not on this page · raw message

Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#19 lore raw

PATCH 19/20 ACPI thermal: make procfs I/F depend on CONFIG_ACPI_PROCFS

In reply to Len Brown

From: Zhang Rui <[email protected]>

Mark the ACPI thermal procfs I/F deprecated, because /sys/class/thermal/ is already available and has been working for years w/o any problem.

The ACPI thermal procfs I/F will be removed in 2.6.37.

---
 drivers/acpi/Kconfig   |    1 +
 drivers/acpi/thermal.c |   86 +++++++++++++++++++++++++++++------------------
 2 files changed, 54 insertions(+), 33 deletions(-)
drivers/acpi/Kconfig +1 -0
index 354e613..5ed51b3 100644
@@ -57,6 +57,7 @@ config ACPI_PROCFS
 	  /proc/acpi/processor/*/throttling (/sys/class/thermal/
 		cooling_device*/*)
 	  /proc/acpi/video/*/brightness (/sys/class/backlight/)
+	  /proc/acpi/thermal_zone/*/* (/sys/class/thermal/)
 	  This option has no effect on /proc/acpi/ files
 	  and functions which do not yet exist in /sys.
 
drivers/acpi/thermal.c +53 -33

157 lines not on this page · raw message

Signature · 1 line
1.7.2.1.95.g3d045
author reviewer
#20 lore raw

PATCH 20/20 gcc-4.6: ACPI: fix unused but set variables in ACPI

In reply to Len Brown

From: Andi Kleen <[email protected]>

Some minor improvements in error handling, but overall it was mostly dead code.

---
 drivers/acpi/acpica/utmutex.c |    5 +----
 drivers/acpi/numa.c           |    4 +---
 drivers/acpi/osl.c            |    7 +++----
 drivers/acpi/power.c          |    2 --
 drivers/acpi/processor_idle.c |    3 +--
 drivers/acpi/video.c          |   10 +++++-----
 drivers/ata/libata-acpi.c     |    6 ------
 7 files changed, 11 insertions(+), 26 deletions(-)
drivers/acpi/acpica/utmutex.c +1 -4
index 058b3df..f5cca3a 100644
@@ -279,13 +279,10 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
 
 acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
 {
-	acpi_thread_id this_thread_id;
-
 	ACPI_FUNCTION_NAME(ut_release_mutex);
 
-	this_thread_id = acpi_os_get_thread_id();
 	ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n",
-			  ACPI_CAST_PTR(void, this_thread_id),
+			  ACPI_CAST_PTR(void, acpi_os_get_thread_id()),
 			  acpi_ut_get_mutex_name(mutex_id)));
 
 	if (mutex_id > ACPI_MAX_MUTEX) {
drivers/acpi/numa.c +1 -3
index b0337d3..5718566 100644
@@ -255,12 +255,10 @@ acpi_parse_memory_affinity(struct acpi_subtable_header * header,
 
 static int __init acpi_parse_srat(struct acpi_table_header *table)
 {
-	struct acpi_table_srat *srat;
-
 	if (!table)
 		return -EINVAL;
 
-	srat = (struct acpi_table_srat *)table;
+	/* Real work done in acpi_table_parse_srat below. */
 
 	return 0;
 }
drivers/acpi/osl.c +3 -4
index 44bddc5..03017b1 100644
@@ -141,15 +141,14 @@ static struct osi_linux {
 static void __init acpi_request_region (struct acpi_generic_address *addr,
 	unsigned int length, char *desc)
 {
-	struct resource *res;
-
 	if (!addr->address || !length)
 		return;
 
+	/* Resources are never freed */
 	if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
-		res = request_region(addr->address, length, desc);
+		request_region(addr->address, length, desc);
 	else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
-		res = request_mem_region(addr->address, length, desc);
+		request_mem_region(addr->address, length, desc);
 }
 
 static int __init acpi_reserve_resources(void)
drivers/acpi/power.c +0 -2
index 4fe5018..cf073aa 100644
@@ -242,8 +242,6 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev)
 	acpi_status status = AE_OK;
 	struct acpi_power_resource *resource = NULL;
 	struct list_head *node, *next;
-	struct acpi_power_reference *ref;
-
 
 	result = acpi_power_get_context(handle, &resource);
 	if (result)
drivers/acpi/processor_idle.c +1 -2
index 5cbc0cb..07bc74d 100644
@@ -722,13 +722,12 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
 	} else if (cx->entry_method == ACPI_CSTATE_HALT) {
 		acpi_safe_halt();
 	} else {
-		int unused;
 		/* IO port based C-state */
 		inb(cx->address);
 		/* Dummy wait op - must do something useless after P_LVL2 read
 		   because chipsets cannot guarantee that STPCLK# signal
 		   gets asserted in time to freeze execution properly. */
-		unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
+		inl(acpi_gbl_FADT.xpm_timer_block.address);
 	}
 	start_critical_timings();
 }
drivers/acpi/video.c +5 -5
index 909ae7b..67dec0c 100644
@@ -2167,7 +2167,7 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
 		status = acpi_video_bus_get_one_device(dev, video);
 		if (ACPI_FAILURE(status)) {
 			printk(KERN_WARNING PREFIX
-					"Cant attach device");
+					"Cant attach device\n");
 			continue;
 		}
 	}
@@ -2177,19 +2177,19 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
 static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
 {
 	acpi_status status;
-	struct acpi_video_bus *video;
-
 
 	if (!device || !device->video)
 		return -ENOENT;
 
-	video = device->video;
-
 	acpi_video_device_remove_fs(device->dev);
 
 	status = acpi_remove_notify_handler(device->dev->handle,
 					    ACPI_DEVICE_NOTIFY,
 					    acpi_video_device_notify);
+	if (ACPI_FAILURE(status)) {
+		printk(KERN_WARNING PREFIX
+		       "Cant remove video notify handler\n");
+	}
 	if (device->backlight) {
 		sysfs_remove_link(&device->backlight->dev.kobj, "device");
 		backlight_device_unregister(device->backlight);
drivers/ata/libata-acpi.c +0 -6
index 7b5eea7..8b5ea39 100644
@@ -145,12 +145,6 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev,
 	struct ata_eh_info *ehi = &ap->link.eh_info;
 	int wait = 0;
 	unsigned long flags;
-	acpi_handle handle;
-
-	if (dev)
-		handle = dev->acpi_handle;
-	else
-		handle = ap->acpi_handle;
 
 	spin_lock_irqsave(ap->lock, flags);
 	/*
Signature · 1 line
1.7.2.1.95.g3d045