Skip to contentSkip to conversation

ACPI: First step to decouple ACPICA debug functionality from ACPI driver

PATCH Superseded Hanjun Guo 2 participants 30 messages Sep 17, 2020 – Sep 19, 2020

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Hanjun Guo

author
#0 lore raw

cover ACPI: First step to decouple ACPICA debug functionality from ACPI driver

For now, ACPI driver debug functionality is mixed of pr_* functions and ACPI_DEBUG_PRINT() which is provided ACPICA core directly, ACPICA debug functions are not friendly for users and also make ACPICA core deeply coupled with ACPI drivers.

With the evolution of the ACPI driver code, lots of the ACPICA debug functions used in ACPI drivers were removed away, this makes the ACPICA debug in ACPI driver to be fragile, for example, some of the COMPONENT such as ACPI_CONTAINER_COMPONENT and ACPI_MEMORY_DEVICE_COMPONENT are not used anymore, they leaved as dead code.

From another aspert, removing the ACPICA debug functions didn't raise concerns in the past, so I believe the ACPICA debug in ACPI driver can be removed and replace with equivalent pr_* debug functions, then decouple ACPICA debug functionality from ACPI driver.

In order to decouple ACPICA debug functionality from ACPI driver, I do it in two steps:
- Remove the dead ACPICA functionality code, and remove the not used COMPONENT;
- Remove all the ACPICA debug code from ACPI drivers.

This patch set is the first step to decouple ACPICA debug functionality from ACPI driver, just remove the dead ACPICA functionality code and some cleanups for ACPI drivers, should no functional change if you don't apply the last two patches.

Patch 1/25 ~ patch 23/25 are removing the dead code and cleanups; Patch 24/25 ~ patch 25/25 are the actual ABI change.

If the ABI change is making sense, I will go further to remove the ACPICA debug functionality from ACPI driver, just keep it inside the ACPICA core.

Hanjun Guo (25):
ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()
ACPI: configfs: Decouple with ACPICA
ACPI: configfs: Add the missing config_item_put()
ACPI: debug: Remove the not used function
ACPI: LPSS: Remove the ACPI_MODULE_NAME()
ACPI: memhotplug: Remove the leftover ACPICA debug functionality
ACPI: memhotplug: Remove the state for memory device
ACPI: platform: Remove the leftover ACPICA debug functinality
ACPI: container: Remove the leftover ACPICA debug functionality
ACPI: custom_method: Remove the ACPICA debug code
ACPI: debugfs: Remove the ACPICA debug code
ACPI: dock: Remove the ACPICA debug code
ACPI: event: Remove the ACPICA debug code
ACPI: PCI: Remove the unused ACPICA debug code
ACPI: proc: Remove the unused ACPICA debug code
ACPI: processor: Remove the dead ACPICA debug code
ACPI: processor: Remove the duplicated ACPI_PROCESSOR_CLASS macro
ACPI: SBS: Simplify the driver init code
ACPI: SBS: Simplify the code using module_acpi_driver()
ACPI: tiny-power-button: Remove the dead ACPICA debug code
ACPI: tiny-power-button: Simplify the code using module_acpi_driver()
ACPI: video: Remove the dead ACPICA debug code
ACPI: wakeup: Remove the dead ACPICA debug code
ACPI: sysfs: Remove the dead debug interfaces
ACPI: debug: Update the ACPI debug document

 Documentation/firmware-guide/acpi/debug.rst |  4 ----
 drivers/acpi/acpi_cmos_rtc.c                |  2 --
 drivers/acpi/acpi_configfs.c                |  6 ++----
 drivers/acpi/acpi_dbg.c                     |  7 -------
 drivers/acpi/acpi_lpss.c                    |  2 --
 drivers/acpi/acpi_memhotplug.c              | 17 -----------------
 drivers/acpi/acpi_platform.c                |  2 --
 drivers/acpi/container.c                    |  3 ---
 drivers/acpi/custom_method.c                |  2 --
 drivers/acpi/debugfs.c                      |  3 ---
 drivers/acpi/dock.c                         |  2 --
 drivers/acpi/event.c                        |  3 ---
 drivers/acpi/pci_root.c                     |  2 --
 drivers/acpi/pci_slot.c                     |  3 ---
 drivers/acpi/proc.c                         |  4 ----
 drivers/acpi/processor_core.c               |  3 ---
 drivers/acpi/processor_idle.c               |  1 -
 drivers/acpi/processor_perflib.c            |  1 -
 drivers/acpi/processor_thermal.c            |  4 ----
 drivers/acpi/processor_throttling.c         |  1 -
 drivers/acpi/sbs.c                          | 24 +-----------------------
 drivers/acpi/sysfs.c                        | 18 +++++++-----------
 drivers/acpi/tiny-power-button.c            |  5 +----
 drivers/acpi/video_detect.c                 |  3 ---
 drivers/acpi/wakeup.c                       |  2 --
 include/acpi/acpi_drivers.h                 |  8 ++------
 26 files changed, 13 insertions(+), 119 deletions(-)
Signature · 1 line
1.7.12.4
author
#1 lore raw

PATCH 1/25 ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()

ACPI_MODULE_NAME() is only needed for ACPICA debug functionality such as ACPI_DEBUG_PRINT() which is not used in acpi_cmos_rtc.c, remove it.

---
 drivers/acpi/acpi_cmos_rtc.c | 2 --
 1 file changed, 2 deletions(-)
drivers/acpi/acpi_cmos_rtc.c +0 -2
index 33ac6cb..67f1d33 100644
@@ -15,8 +15,6 @@
 
 #include "internal.h"
 
-ACPI_MODULE_NAME("cmos rtc");
-
 static const struct acpi_device_id acpi_cmos_rtc_ids[] = {
 	{ "PNP0B00" },
 	{ "PNP0B01" },
Signature · 1 line
1.7.12.4
author
#2 lore raw

PATCH 2/25 ACPI: configfs: Decouple with ACPICA

In reply to Hanjun Guo

Remove the not needed acpica head file inclusions and change ACPI_INFO() to pr_info() to decouple with ACPICA.

---
 drivers/acpi/acpi_configfs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/acpi/acpi_configfs.c +1 -4
index 88c8af4..21160a3 100644
@@ -13,9 +13,6 @@
 #include <linux/acpi.h>
 #include <linux/security.h>
 
-#include "acpica/accommon.h"
-#include "acpica/actables.h"
-
 static struct config_group *acpi_table_group;
 
 struct acpi_table {
@@ -226,7 +223,7 @@ static void acpi_table_drop_item(struct config_group *group,
 {
 	struct acpi_table *table = container_of(cfg, struct acpi_table, cfg);
 
-	ACPI_INFO(("Host-directed Dynamic ACPI Table Unload"));
+	pr_info("Host-directed Dynamic ACPI Table Unload\n");
 	acpi_unload_table(table->index);
 }
 
Signature · 1 line
1.7.12.4
author
#3 lore raw

PATCH 3/25 ACPI: configfs: Add the missing config_item_put()

In reply to Hanjun Guo

config_item_put() should be called to decrement refcount for item in the drop_item callback.

---
 drivers/acpi/acpi_configfs.c | 1 +
 1 file changed, 1 insertion(+)
drivers/acpi/acpi_configfs.c +1 -0
index 21160a3..4473611 100644
@@ -225,6 +225,7 @@ static void acpi_table_drop_item(struct config_group *group,
 
 	pr_info("Host-directed Dynamic ACPI Table Unload\n");
 	acpi_unload_table(table->index);
+	config_item_put(cfg);
 }
 
 static struct configfs_group_operations acpi_table_group_ops = {
Signature · 1 line
1.7.12.4
author
#4 lore raw

PATCH 4/25 ACPI: debug: Remove the not used function

In reply to Hanjun Guo

The inline function __acpi_aml_opened() is not used anywhere, remove it.

---
 drivers/acpi/acpi_dbg.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/acpi/acpi_dbg.c +0 -7
index 6041974..02f7e42 100644
@@ -117,13 +117,6 @@ static inline bool __acpi_aml_busy(void)
 	return false;
 }
 
-static inline bool __acpi_aml_opened(void)
-{
-	if (acpi_aml_io.flags & ACPI_AML_OPEN)
-		return true;
-	return false;
-}
-
 static inline bool __acpi_aml_used(void)
 {
 	return acpi_aml_io.usages ? true : false;
Signature · 1 line
1.7.12.4
author
#5 lore raw

PATCH 5/25 ACPI: LPSS: Remove the ACPI_MODULE_NAME()

In reply to Hanjun Guo

ACPI_MODULE_NAME() is only needed for ACPICA debug functionality such as ACPI_DEBUG_PRINT() which is not used in acpi_lpss.c, remove it.

---
 drivers/acpi/acpi_lpss.c | 2 --
 1 file changed, 2 deletions(-)
drivers/acpi/acpi_lpss.c +0 -2
index 5e2bfbc..46e307e 100644
@@ -26,8 +26,6 @@
 
 #include "internal.h"
 
-ACPI_MODULE_NAME("acpi_lpss");
-
 #ifdef CONFIG_X86_INTEL_LPSS
 
 #include <asm/cpu_device_id.h>
Signature · 1 line
1.7.12.4
author
#6 lore raw

PATCH 6/25 ACPI: memhotplug: Remove the leftover ACPICA debug functionality

In reply to Hanjun Guo

After commit ("0a34764411aa ACPI / scan: Make memory hotplug driver use struct acpi_scan_handler"), all the ACPICA debug functionality was removed, remove the leftover ACPICA debug code.

---
 drivers/acpi/acpi_memhotplug.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/acpi/acpi_memhotplug.c +0 -7
index e294f44..9cd987d 100644
@@ -22,13 +22,6 @@
 #define ACPI_MEMORY_DEVICE_HID			"PNP0C80"
 #define ACPI_MEMORY_DEVICE_NAME			"Hotplug Mem Device"
 
-#define _COMPONENT		ACPI_MEMORY_DEVICE_COMPONENT
-
-#undef PREFIX
-#define 	PREFIX		"ACPI:memory_hp:"
-
-ACPI_MODULE_NAME("acpi_memhotplug");
-
 static const struct acpi_device_id memory_device_ids[] = {
 	{ACPI_MEMORY_DEVICE_HID, 0},
 	{"", 0},
Signature · 1 line
1.7.12.4
author
#7 lore raw

PATCH 7/25 ACPI: memhotplug: Remove the state for memory device

In reply to Hanjun Guo

After commit ("315bbae9c5cb ACPI / memhotplug: deal with eject request in hotplug queue"), the state for struct acpi_memory_device is not actually useful, it can be removed.

---
 drivers/acpi/acpi_memhotplug.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/acpi/acpi_memhotplug.c +0 -10
index 9cd987d..c8344b9 100644
@@ -29,11 +29,6 @@
 
 #ifdef CONFIG_ACPI_HOTPLUG_MEMORY
 
-/* Memory Device States */
-#define MEMORY_INVALID_STATE	0
-#define MEMORY_POWER_ON_STATE	1
-#define MEMORY_POWER_OFF_STATE	2
-
 static int acpi_memory_device_add(struct acpi_device *device,
 				  const struct acpi_device_id *not_used);
 static void acpi_memory_device_remove(struct acpi_device *device);
@@ -58,7 +53,6 @@ struct acpi_memory_info {
 
 struct acpi_memory_device {
 	struct acpi_device * device;
-	unsigned int state;	/* State of the memory device */
 	struct list_head res_list;
 };
 
@@ -226,7 +220,6 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 	}
 	if (!num_enabled) {
 		dev_err(&mem_device->device->dev, "add_memory failed\n");
-		mem_device->state = MEMORY_INVALID_STATE;
 		return -EINVAL;
 	}
 	/*
@@ -297,9 +290,6 @@ static int acpi_memory_device_add(struct acpi_device *device,
 		return result;
 	}
 
-	/* Set the device state */
-	mem_device->state = MEMORY_POWER_ON_STATE;
-
 	result = acpi_memory_check_device(mem_device);
 	if (result) {
 		acpi_memory_device_free(mem_device);
Signature · 1 line
1.7.12.4
author
#8 lore raw

PATCH 8/25 ACPI: platform: Remove the leftover ACPICA debug functinality

In reply to Hanjun Guo

ACPI_MODULE_NAME() is not used the acpi_platform.c, remove it.

---
 drivers/acpi/acpi_platform.c | 2 --
 1 file changed, 2 deletions(-)
drivers/acpi/acpi_platform.c +0 -2
index c05050f..78d6212 100644
@@ -19,8 +19,6 @@
 
 #include "internal.h"
 
-ACPI_MODULE_NAME("platform");
-
 static const struct acpi_device_id forbidden_id_list[] = {
 	{"PNP0000",  0},	/* PIC */
 	{"PNP0100",  0},	/* Timer */
Signature · 1 line
1.7.12.4
author
#9 lore raw

PATCH 9/25 ACPI: container: Remove the leftover ACPICA debug functionality

In reply to Hanjun Guo

After commit ("737f1a9f8082 ACPI / scan: Make container driver use struct acpi_scan_handler"), ACPICA debug print function calls were removed, so the leftover ACPICA debug functionality is useless, remove it.

---
 drivers/acpi/container.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/acpi/container.c +0 -3
index 9ea5f55..ccaa647 100644
@@ -14,9 +14,6 @@
 
 #include "internal.h"
 
-#define _COMPONENT			ACPI_CONTAINER_COMPONENT
-ACPI_MODULE_NAME("container");
-
 static const struct acpi_device_id container_device_ids[] = {
 	{"ACPI0004", 0},
 	{"PNP0A05", 0},
Signature · 1 line
1.7.12.4
author
#10 lore raw

PATCH 10/25 ACPI: custom_method: Remove the ACPICA debug code

In reply to Hanjun Guo

ACPICA debug code is not used in custom_method.c, remove it.

---
 drivers/acpi/custom_method.c | 2 --
 1 file changed, 2 deletions(-)
drivers/acpi/custom_method.c +0 -2
index b097ef2..7b54dc9 100644
@@ -13,8 +13,6 @@
 
 #include "internal.h"
 
-#define _COMPONENT		ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME("custom_method");
 MODULE_LICENSE("GPL");
 
 static struct dentry *cm_dentry;
Signature · 1 line
1.7.12.4
author
#11 lore raw

PATCH 11/25 ACPI: debugfs: Remove the ACPICA debug code

In reply to Hanjun Guo

The ACPICA code is not used, remove it.

---
 drivers/acpi/debugfs.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/acpi/debugfs.c +0 -3
index d5ecea3..074eb98d 100644
@@ -10,9 +10,6 @@
 
 #include "internal.h"
 
-#define _COMPONENT		ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME("debugfs");
-
 struct dentry *acpi_debugfs_dir;
 EXPORT_SYMBOL_GPL(acpi_debugfs_dir);
 
Signature · 1 line
1.7.12.4
author
#12 lore raw

PATCH 12/25 ACPI: dock: Remove the ACPICA debug code

In reply to Hanjun Guo

The ACPICA debug code is not used, remove it.

---
 drivers/acpi/dock.c | 2 --
 1 file changed, 2 deletions(-)
drivers/acpi/dock.c +0 -2
index 9bd72c2..45d4b7b6 100644
@@ -20,8 +20,6 @@
 
 #include "internal.h"
 
-ACPI_MODULE_NAME("dock");
-
 static bool immediate_undock = 1;
 module_param(immediate_undock, bool, 0644);
 MODULE_PARM_DESC(immediate_undock, "1 (default) will cause the driver to "
Signature · 1 line
1.7.12.4
author
#13 lore raw

PATCH 13/25 ACPI: event: Remove the ACPICA debug code

In reply to Hanjun Guo

The ACPICA debug code is not used, remove it.

---
 drivers/acpi/event.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/acpi/event.c +0 -3
index 47f2159..1706439 100644
@@ -19,9 +19,6 @@
 
 #include "internal.h"
 
-#define _COMPONENT		ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME("event");
-
 /* ACPI notifier chain */
 static BLOCKING_NOTIFIER_HEAD(acpi_chain_head);
 
Signature · 1 line
1.7.12.4
author
#14 lore raw

PATCH 14/25 ACPI: PCI: Remove the unused ACPICA debug code

In reply to Hanjun Guo

The ACPICA debug code is not used, so can be removed.

---
 drivers/acpi/pci_root.c | 2 --
 drivers/acpi/pci_slot.c | 3 ---
 2 files changed, 5 deletions(-)
drivers/acpi/pci_root.c +0 -2
index f90e841..7a6abd3 100644
@@ -24,8 +24,6 @@
 
 #include "internal.h"
 
-#define _COMPONENT		ACPI_PCI_COMPONENT
-ACPI_MODULE_NAME("pci_root");
 #define ACPI_PCI_ROOT_CLASS		"pci_bridge"
 #define ACPI_PCI_ROOT_DEVICE_NAME	"PCI Root Bridge"
 static int acpi_pci_root_add(struct acpi_device *device,
drivers/acpi/pci_slot.c +0 -3
index ca2461d..d6cb2c2 100644
@@ -28,9 +28,6 @@
 
 static int check_sta_before_sun;
 
-#define _COMPONENT		ACPI_PCI_COMPONENT
-ACPI_MODULE_NAME("pci_slot");
-
 #define SLOT_NAME_SIZE 21		/* Inspired by #define in acpiphp.h */
 
 struct acpi_pci_slot {
Signature · 1 line
1.7.12.4
author
#15 lore raw

PATCH 15/25 ACPI: proc: Remove the unused ACPICA debug code

In reply to Hanjun Guo

Remove the not used ACPICA debug code which is used nowhere in proc.c.

---
 drivers/acpi/proc.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/acpi/proc.c +0 -4
index 7892980..0cca799 100644
@@ -10,15 +10,11 @@
 #include "sleep.h"
 #include "internal.h"
 
-#define _COMPONENT		ACPI_SYSTEM_COMPONENT
-
 /*
  * this file provides support for:
  * /proc/acpi/wakeup
  */
 
-ACPI_MODULE_NAME("sleep")
-
 static int
 acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
 {
Signature · 1 line
1.7.12.4
author
#16 lore raw

PATCH 16/25 ACPI: processor: Remove the dead ACPICA debug code

In reply to Hanjun Guo

The ACPICA debug code is not used anywhere in processor_core.c and processor_thermal.c, remove it.

---
 drivers/acpi/processor_core.c    | 3 ---
 drivers/acpi/processor_thermal.c | 2 --
 2 files changed, 5 deletions(-)
drivers/acpi/processor_core.c +0 -3
index f32beb7d..2ac48cd 100644
@@ -14,9 +14,6 @@
 #include <linux/acpi.h>
 #include <acpi/processor.h>
 
-#define _COMPONENT		ACPI_PROCESSOR_COMPONENT
-ACPI_MODULE_NAME("processor_core");
-
 static struct acpi_table_madt *get_madt_table(void)
 {
 	static struct acpi_table_madt *madt;
drivers/acpi/processor_thermal.c +0 -2
index 41feb88..6c7d05b 100644
@@ -20,8 +20,6 @@
 #define PREFIX "ACPI: "
 
 #define ACPI_PROCESSOR_CLASS            "processor"
-#define _COMPONENT              ACPI_PROCESSOR_COMPONENT
-ACPI_MODULE_NAME("processor_thermal");
 
 #ifdef CONFIG_CPU_FREQ
 
Signature · 1 line
1.7.12.4
author
#17 lore raw

PATCH 17/25 ACPI: processor: Remove the duplicated ACPI_PROCESSOR_CLASS macro

In reply to Hanjun Guo

The ACPI_PROCESSOR_CLASS macro is defined in <acpi/processor.h>, and ACPI processor drivers include <acpi/processor.h>, so we can remove the duplicated ACPI_PROCESSOR_CLASS macro.

---
 drivers/acpi/processor_idle.c       | 1 -
 drivers/acpi/processor_perflib.c    | 1 -
 drivers/acpi/processor_thermal.c    | 2 --
 drivers/acpi/processor_throttling.c | 1 -
 4 files changed, 5 deletions(-)
drivers/acpi/processor_idle.c +0 -1
index 71a30b0d..ce24ba0 100644
@@ -31,7 +31,6 @@
 #include <asm/apic.h>
 #endif
 
-#define ACPI_PROCESSOR_CLASS            "processor"
 #define _COMPONENT              ACPI_PROCESSOR_COMPONENT
 ACPI_MODULE_NAME("processor_idle");
 
drivers/acpi/processor_perflib.c +0 -1
index 5909e8f..06ca924 100644
@@ -22,7 +22,6 @@
 
 #define PREFIX "ACPI: "
 
-#define ACPI_PROCESSOR_CLASS		"processor"
 #define ACPI_PROCESSOR_FILE_PERFORMANCE	"performance"
 #define _COMPONENT		ACPI_PROCESSOR_COMPONENT
 ACPI_MODULE_NAME("processor_perflib");
drivers/acpi/processor_thermal.c +0 -2
index 6c7d05b..677a132 100644
@@ -19,8 +19,6 @@
 
 #define PREFIX "ACPI: "
 
-#define ACPI_PROCESSOR_CLASS            "processor"
-
 #ifdef CONFIG_CPU_FREQ
 
 /* If a passive cooling situation is detected, primarily CPUfreq is used, as it
drivers/acpi/processor_throttling.c +0 -1
index a0bd56e..b187653 100644
@@ -22,7 +22,6 @@
 
 #define PREFIX "ACPI: "
 
-#define ACPI_PROCESSOR_CLASS            "processor"
 #define _COMPONENT              ACPI_PROCESSOR_COMPONENT
 ACPI_MODULE_NAME("processor_throttling");
 
Signature · 1 line
1.7.12.4
author
#18 lore raw

PATCH 18/25 ACPI: SBS: Simplify the driver init code

In reply to Hanjun Guo

acpi_bus_register_driver() will check acpi_disable and return -ENODEV, so the acpi_disable check outside the acpi_bus_register_driver() is duplicated, can be removed.

Also we can just return from acpi_bus_register_driver() then we can simplify the code further.

---
 drivers/acpi/sbs.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/acpi/sbs.c +1 -10
index f158b8c..ee13960 100644
@@ -714,16 +714,7 @@ static int acpi_sbs_resume(struct device *dev)
 
 static int __init acpi_sbs_init(void)
 {
-	int result = 0;
-
-	if (acpi_disabled)
-		return -ENODEV;
-
-	result = acpi_bus_register_driver(&acpi_sbs_driver);
-	if (result < 0)
-		return -ENODEV;
-
-	return 0;
+	return acpi_bus_register_driver(&acpi_sbs_driver);
 }
 
 static void __exit acpi_sbs_exit(void)
Signature · 1 line
1.7.12.4
author
#19 lore raw

PATCH 19/25 ACPI: SBS: Simplify the code using module_acpi_driver()

In reply to Hanjun Guo

Using the module_acpi_driver() to simplify the code.

---
 drivers/acpi/sbs.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/acpi/sbs.c +1 -14
index ee13960..6e55e70 100644
@@ -711,17 +711,4 @@ static int acpi_sbs_resume(struct device *dev)
 		},
 	.drv.pm = &acpi_sbs_pm,
 };
-
-static int __init acpi_sbs_init(void)
-{
-	return acpi_bus_register_driver(&acpi_sbs_driver);
-}
-
-static void __exit acpi_sbs_exit(void)
-{
-	acpi_bus_unregister_driver(&acpi_sbs_driver);
-	return;
-}
-
-module_init(acpi_sbs_init);
-module_exit(acpi_sbs_exit);
+module_acpi_driver(acpi_sbs_driver);
Signature · 1 line
1.7.12.4
author
#20 lore raw

PATCH 20/25 ACPI: tiny-power-button: Remove the dead ACPICA debug code

In reply to Hanjun Guo

The ACPICA debug code is not used, can be removed.

---
 drivers/acpi/tiny-power-button.c | 1 -
 1 file changed, 1 deletion(-)
drivers/acpi/tiny-power-button.c +0 -1
index 6273d73..420e61b 100644
@@ -4,7 +4,6 @@
 #include <linux/acpi.h>
 #include <acpi/button.h>
 
-ACPI_MODULE_NAME("tiny-power-button");
 MODULE_AUTHOR("Josh Triplett");
 MODULE_DESCRIPTION("ACPI Tiny Power Button Driver");
 MODULE_LICENSE("GPL");
Signature · 1 line
1.7.12.4
author
#21 lore raw

PATCH 21/25 ACPI: tiny-power-button: Simplify the code using module_acpi_driver()

In reply to Hanjun Guo

Using module_acpi_driver() to simplify the code.

---
 drivers/acpi/tiny-power-button.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/acpi/tiny-power-button.c +1 -3
index 420e61b..a19f0e4 100644
@@ -40,6 +40,4 @@ static void acpi_tiny_power_button_notify(struct acpi_device *device, u32 event)
 	},
 };
 
-module_driver(acpi_tiny_power_button_driver,
-		acpi_bus_register_driver,
-		acpi_bus_unregister_driver);
+module_acpi_driver(acpi_tiny_power_button_driver);
Signature · 1 line
1.7.12.4
author
#22 lore raw

PATCH 22/25 ACPI: video: Remove the dead ACPICA debug code

In reply to Hanjun Guo

Remove the not used ACPICA debug code.

---
 drivers/acpi/video_detect.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/acpi/video_detect.c +0 -3
index 2499d7e..d2981f7 100644
@@ -35,9 +35,6 @@
 #include <linux/workqueue.h>
 #include <acpi/video.h>
 
-ACPI_MODULE_NAME("video");
-#define _COMPONENT		ACPI_VIDEO_COMPONENT
-
 void acpi_video_unregister_backlight(void);
 
 static bool backlight_notifier_registered;
Signature · 1 line
1.7.12.4
author
#23 lore raw

PATCH 23/25 ACPI: wakeup: Remove the dead ACPICA debug code

In reply to Hanjun Guo

The ACPICA debug code of ACPI_SYSTEM_COMPONENT and ACPI_MODULE_NAME() are not used in wakeup.c, remove it.

---
 drivers/acpi/wakeup.c | 2 --
 1 file changed, 2 deletions(-)
drivers/acpi/wakeup.c +0 -2
index 0b2e425..f89dd9a 100644
@@ -26,8 +26,6 @@ struct acpi_wakeup_handler {
  * suspend/resume and isn't really required as this is called in S-state. At
  * that time, there is no device hotplug
  **/
-#define _COMPONENT		ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME("wakeup_devices")
 
 /**
  * acpi_enable_wakeup_devices - Enable wake-up device GPEs.
Signature · 1 line
1.7.12.4
author
#24 lore raw

RFC PATCH 24/25 ACPI: sysfs: Remove the dead debug interfaces

In reply to Hanjun Guo

After the cleanup of the ACPICA debug functionality, some of the ACPICA debug interfaces for ACPI drivers are not unsed anymore, remove those interfaces.

While we are at it, update the wrong kernel doc as well.

---
 drivers/acpi/sysfs.c        | 18 +++++++-----------
 include/acpi/acpi_drivers.h |  8 ++------
 2 files changed, 9 insertions(+), 17 deletions(-)
drivers/acpi/sysfs.c +7 -11
index a5cc4f3..4237256 100644
@@ -18,12 +18,12 @@
 #ifdef CONFIG_ACPI_DEBUG
 /*
  * ACPI debug sysfs I/F, including:
- * /sys/modules/acpi/parameters/debug_layer
- * /sys/modules/acpi/parameters/debug_level
- * /sys/modules/acpi/parameters/trace_method_name
- * /sys/modules/acpi/parameters/trace_state
- * /sys/modules/acpi/parameters/trace_debug_layer
- * /sys/modules/acpi/parameters/trace_debug_level
+ * /sys/module/acpi/parameters/debug_layer
+ * /sys/module/acpi/parameters/debug_level
+ * /sys/module/acpi/parameters/trace_method_name
+ * /sys/module/acpi/parameters/trace_state
+ * /sys/module/acpi/parameters/trace_debug_layer
+ * /sys/module/acpi/parameters/trace_debug_level
  */
 
 struct acpi_dlayer {
@@ -56,14 +56,10 @@ struct acpi_dlevel {
 	ACPI_DEBUG_INIT(ACPI_AC_COMPONENT),
 	ACPI_DEBUG_INIT(ACPI_BATTERY_COMPONENT),
 	ACPI_DEBUG_INIT(ACPI_BUTTON_COMPONENT),
-	ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT),
-	ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT),
 	ACPI_DEBUG_INIT(ACPI_PCI_COMPONENT),
 	ACPI_DEBUG_INIT(ACPI_POWER_COMPONENT),
-	ACPI_DEBUG_INIT(ACPI_CONTAINER_COMPONENT),
 	ACPI_DEBUG_INIT(ACPI_SYSTEM_COMPONENT),
 	ACPI_DEBUG_INIT(ACPI_THERMAL_COMPONENT),
-	ACPI_DEBUG_INIT(ACPI_MEMORY_DEVICE_COMPONENT),
 	ACPI_DEBUG_INIT(ACPI_VIDEO_COMPONENT),
 	ACPI_DEBUG_INIT(ACPI_PROCESSOR_COMPONENT),
 };
@@ -289,7 +285,7 @@ static int param_get_trace_state(char *buffer, const struct kernel_param *kp)
 #endif /* CONFIG_ACPI_DEBUG */
 
 
-/* /sys/modules/acpi/parameters/aml_debug_output */
+/* /sys/module/acpi/parameters/aml_debug_output */
 
 module_param_named(aml_debug_output, acpi_gbl_enable_aml_debug_object,
 		   byte, 0644);
include/acpi/acpi_drivers.h +2 -6
index 5eb1759..614d0a9 100644
@@ -12,21 +12,17 @@
 #define ACPI_MAX_STRING			80
 
 /*
- * Please update drivers/acpi/debug.c and Documentation/firmware-guide/acpi/debug.rst
- * if you add to this list.
+ * Please update drivers/acpi/sysfs.c and Documentation/firmware-guide/acpi/debug.rst
+ * if you add to or remove from this list.
  */
 #define ACPI_BUS_COMPONENT		0x00010000
 #define ACPI_AC_COMPONENT		0x00020000
 #define ACPI_BATTERY_COMPONENT		0x00040000
 #define ACPI_BUTTON_COMPONENT		0x00080000
-#define ACPI_SBS_COMPONENT		0x00100000
-#define ACPI_FAN_COMPONENT		0x00200000
 #define ACPI_PCI_COMPONENT		0x00400000
 #define ACPI_POWER_COMPONENT		0x00800000
-#define ACPI_CONTAINER_COMPONENT	0x01000000
 #define ACPI_SYSTEM_COMPONENT		0x02000000
 #define ACPI_THERMAL_COMPONENT		0x04000000
-#define ACPI_MEMORY_DEVICE_COMPONENT	0x08000000
 #define ACPI_VIDEO_COMPONENT		0x10000000
 #define ACPI_PROCESSOR_COMPONENT	0x20000000
 
Signature · 1 line
1.7.12.4
author
#25 lore raw

RFC PATCH 25/25 ACPI: debug: Update the ACPI debug document

In reply to Hanjun Guo

Update the document as some of the COMPONENT bit define are removed.

---
 Documentation/firmware-guide/acpi/debug.rst | 4 ----
 1 file changed, 4 deletions(-)
Documentation/firmware-guide/acpi/debug.rst +0 -4
index 1a152dd..508cf46 100644
@@ -56,14 +56,10 @@ shows the supported mask values, currently these::
     ACPI_AC_COMPONENT               0x00020000
     ACPI_BATTERY_COMPONENT          0x00040000
     ACPI_BUTTON_COMPONENT           0x00080000
-    ACPI_SBS_COMPONENT              0x00100000
-    ACPI_FAN_COMPONENT              0x00200000
     ACPI_PCI_COMPONENT              0x00400000
     ACPI_POWER_COMPONENT            0x00800000
-    ACPI_CONTAINER_COMPONENT        0x01000000
     ACPI_SYSTEM_COMPONENT           0x02000000
     ACPI_THERMAL_COMPONENT          0x04000000
-    ACPI_MEMORY_DEVICE_COMPONENT    0x08000000
     ACPI_VIDEO_COMPONENT            0x10000000
     ACPI_PROCESSOR_COMPONENT        0x20000000
 
Signature · 1 line
1.7.12.4
#26 lore raw
In reply to Hanjun Guo

Hi Hanjun,

Quoted 12 lines · Hanjun Guo

For now, ACPI driver debug functionality is mixed of pr_* functions and ACPI_DEBUG_PRINT() which is provided ACPICA core directly, ACPICA debug functions are not friendly for users and also make ACPICA core deeply coupled with ACPI drivers.

With the evolution of the ACPI driver code, lots of the ACPICA debug functions used in ACPI drivers were removed away, this makes the ACPICA debug in ACPI driver to be fragile, for example, some of the COMPONENT such as ACPI_CONTAINER_COMPONENT and ACPI_MEMORY_DEVICE_COMPONENT are not used anymore, they leaved as dead code.

Quoted 4 lines

From another aspert, removing the ACPICA debug functions didn't raise concerns in the past, so I believe the ACPICA debug in ACPI driver can be removed and replace with equivalent pr_* debug functions, then decouple ACPICA debug functionality from ACPI driver.

This is a worthy goal, but the patch series appears to be a mixed bag of changes some of which are not directly related to this goal.

Quoted 14 lines

In order to decouple ACPICA debug functionality from ACPI driver, I do it in two steps:
- Remove the dead ACPICA functionality code, and remove the not used COMPONENT;
- Remove all the ACPICA debug code from ACPI drivers.

This patch set is the first step to decouple ACPICA debug functionality from ACPI driver, just remove the dead ACPICA functionality code and some cleanups for ACPI drivers, should no functional change if you don't apply the last two patches.

Patch 1/25 ~ patch 23/25 are removing the dead code and cleanups; Patch 24/25 ~ patch 25/25 are the actual ABI change.

Quoted 6 lines

If the ABI change is making sense, I will go further to remove the ACPICA debug functionality from ACPI driver, just keep it inside the ACPICA core.

Hanjun Guo (25):
ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()

This, for example, should be a separate cleanup patch.

Quoted 2 lines

ACPI: configfs: Decouple with ACPICA
ACPI: configfs: Add the missing config_item_put()

This appears to be a fix that should go in separate from the rest of the series.

Quoted 1 line

ACPI: debug: Remove the not used function

Another separate cleanup.

Quoted 1 line

ACPI: LPSS: Remove the ACPI_MODULE_NAME()

Yet another one.

So can you please split up the patch set into several smaller and more manageable ones?

Thanks!

author
#27 lore raw

Hi Rafael,

Quoted 15 lines · Rafael J. Wysocki

Hi Hanjun,

Quoted 12 lines · Hanjun Guo

For now, ACPI driver debug functionality is mixed of pr_* functions and ACPI_DEBUG_PRINT() which is provided ACPICA core directly, ACPICA debug functions are not friendly for users and also make ACPICA core deeply coupled with ACPI drivers.

With the evolution of the ACPI driver code, lots of the ACPICA debug functions used in ACPI drivers were removed away, this makes the ACPICA debug in ACPI driver to be fragile, for example, some of the COMPONENT such as ACPI_CONTAINER_COMPONENT and ACPI_MEMORY_DEVICE_COMPONENT are not used anymore, they leaved as dead code.

Quoted 7 lines
Quoted 4 lines

From another aspert, removing the ACPICA debug functions didn't raise
concerns in the past, so I believe the ACPICA debug in ACPI driver can be removed and replace with equivalent pr_* debug functions, then decouple ACPICA debug functionality from ACPI driver.

This is a worthy goal, but the patch series appears to be a mixed bag of changes some of which are not directly related to this goal.

Sorry for that, I sent this patch set in a hurry, I will update as you suggested.

Quoted 15 lines
Quoted 15 lines

In order to decouple ACPICA debug functionality from ACPI driver, I do it in two steps:
- Remove the dead ACPICA functionality code, and remove the not used

    COMPONENT;

- Remove all the ACPICA debug code from ACPI drivers.

This patch set is the first step to decouple ACPICA debug functionality from ACPI driver, just remove the dead ACPICA functionality code and some cleanups for ACPI drivers, should no functional change if you don't apply the last two patches.

Patch 1/25 ~ patch 23/25 are removing the dead code and cleanups; Patch 24/25 ~ patch 25/25 are the actual ABI change.

Quoted 8 lines
Quoted 6 lines

If the ABI change is making sense, I will go further to remove the ACPICA debug functionality from ACPI driver, just keep it inside the ACPICA core.

Hanjun Guo (25):
ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()

This, for example, should be a separate cleanup patch.

ACPI_MODULE_NAME() and _COMPONENT are both used for ACPICA debug functionality, so I will put them in the decouple patch set.

Quoted 5 lines
Quoted 3 lines

ACPI: configfs: Decouple with ACPICA
ACPI: configfs: Add the missing config_item_put()

This appears to be a fix that should go in separate from the rest of the series.

Will send a fix first!

Quoted 11 lines
Quoted 2 lines

ACPI: debug: Remove the not used function

Another separate cleanup.

Quoted 1 line

ACPI: LPSS: Remove the ACPI_MODULE_NAME()

Yet another one.

So can you please split up the patch set into several smaller and more manageable ones?

Will do, thanks for your comments!

Thanks
Hanjun

#28 lore raw
Quoted 49 lines · Hanjun Guo

Hi Rafael,

Quoted 15 lines · Rafael J. Wysocki

Hi Hanjun,

Quoted 12 lines · Hanjun Guo

For now, ACPI driver debug functionality is mixed of pr_* functions and ACPI_DEBUG_PRINT() which is provided ACPICA core directly, ACPICA debug functions are not friendly for users and also make ACPICA core deeply coupled with ACPI drivers.

With the evolution of the ACPI driver code, lots of the ACPICA debug functions used in ACPI drivers were removed away, this makes the ACPICA debug in ACPI driver to be fragile, for example, some of the COMPONENT such as ACPI_CONTAINER_COMPONENT and ACPI_MEMORY_DEVICE_COMPONENT are not used anymore, they leaved as dead code.

Quoted 7 lines
Quoted 4 lines

From another aspert, removing the ACPICA debug functions didn't raise
concerns in the past, so I believe the ACPICA debug in ACPI driver can be removed and replace with equivalent pr_* debug functions, then decouple ACPICA debug functionality from ACPI driver.

This is a worthy goal, but the patch series appears to be a mixed bag of changes some of which are not directly related to this goal.

Sorry for that, I sent this patch set in a hurry, I will update as you suggested.

Quoted 19 lines
Quoted 19 lines

In order to decouple ACPICA debug functionality from ACPI driver, I do it in two steps:
- Remove the dead ACPICA functionality code, and remove the not used

    COMPONENT;

- Remove all the ACPICA debug code from ACPI drivers.

This patch set is the first step to decouple ACPICA debug functionality from ACPI driver, just remove the dead ACPICA functionality code and some cleanups for ACPI drivers, should no functional change if you don't apply the last two patches.

Patch 1/25 ~ patch 23/25 are removing the dead code and cleanups; Patch 24/25 ~ patch 25/25 are the actual ABI change.

If the ABI change is making sense, I will go further to remove the ACPICA debug functionality from ACPI driver, just keep it inside the ACPICA core.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Hanjun Guo (25):
ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()

This, for example, should be a separate cleanup patch.

ACPI_MODULE_NAME() and _COMPONENT are both used for ACPICA debug functionality, so I will put them in the decouple patch set.

So if the ACPICA debug functionality is not used in the given C file, you can drop these macros from there right away without any side effects.

Why don't you do that in a separate series of patches then?

Thanks!

author
#29 lore raw

Hi Rafael,

Quoted 40 lines · Rafael J. Wysocki
Quoted 30 lines · Hanjun Guo

Hi Rafael,

Quoted 15 lines · Rafael J. Wysocki

Hi Hanjun,

Quoted 12 lines · Hanjun Guo

For now, ACPI driver debug functionality is mixed of pr_* functions and ACPI_DEBUG_PRINT() which is provided ACPICA core directly, ACPICA debug functions are not friendly for users and also make ACPICA core deeply coupled with ACPI drivers.

With the evolution of the ACPI driver code, lots of the ACPICA debug functions used in ACPI drivers were removed away, this makes the ACPICA debug in ACPI driver to be fragile, for example, some of the COMPONENT such as ACPI_CONTAINER_COMPONENT and ACPI_MEMORY_DEVICE_COMPONENT are not used anymore, they leaved as dead code.

Quoted 7 lines
Quoted 4 lines

From another aspert, removing the ACPICA debug functions didn't raise
concerns in the past, so I believe the ACPICA debug in ACPI driver can be removed and replace with equivalent pr_* debug functions, then decouple ACPICA debug functionality from ACPI driver.

This is a worthy goal, but the patch series appears to be a mixed bag of changes some of which are not directly related to this goal.

Sorry for that, I sent this patch set in a hurry, I will update as you suggested.

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Hanjun Guo (25):
ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()

This, for example, should be a separate cleanup patch.

ACPI_MODULE_NAME() and _COMPONENT are both used for ACPICA debug functionality, so I will put them in the decouple patch set.

Quoted 5 lines

So if the ACPICA debug functionality is not used in the given C file, you can drop these macros from there right away without any side effects.

Why don't you do that in a separate series of patches then?

Good point, so I will split this patch set into four parts:

- The bugfix patch goes in separate from the rest of the series, already sent out.

- Cleanup patches which is not related to ACPICA debug,
- ACPI: debug: Remove the not used function
- ACPI: memhotplug: Remove the state for memory device
- ACPI: processor: Remove the duplicated ACPI_PROCESSOR_CLASS macro

- ACPI: SBS: Simplify the driver init code
- ACPI: SBS: Simplify the code using module_acpi_driver()
- ACPI: tiny-power-button: Simplify the code using module_acpi_driver()

- A patch set removing all the leftover ACPICA debug functionality which is not used in the C file, no functional change.

- A patch set for actual ABI change (RFC).

Do it make sense to you?

Thanks
Hanjun