From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: linux-acpi@vger.kernel.org
Cc: Zhao Yakui <yakui.zhao@intel.com>,
Alexey Starikovskiy <astarikovskiy@suse.de>
Subject: [PATCH 11/11] ACPI: call core init functions explicitly instead of using initcalls
Date: Wed, 05 Nov 2008 16:18:28 -0700 [thread overview]
Message-ID: <20081105231828.26131.90839.stgit@bob.kio> (raw)
In-Reply-To: <20081105231710.26131.3110.stgit@bob.kio>
These functions:
init_acpi_device_notify()
acpi_debug_init()
acpi_scan_init()
acpi_system_init()
are all parts of the ACPI core. None is separately loadable.
So we might as well call them directly from acpi_init() rather
than using initcalls, which depend on module link order to make
things happen in the correct order.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
drivers/acpi/Makefile | 15 ++++++---------
drivers/acpi/acpi.h | 15 +++++++++++++++
drivers/acpi/bus.c | 15 +++++++++++++++
drivers/acpi/debug.c | 16 ++++++++--------
drivers/acpi/glue.c | 8 +++-----
drivers/acpi/scan.c | 10 +++-------
drivers/acpi/system.c | 10 ++--------
7 files changed, 52 insertions(+), 37 deletions(-)
create mode 100644 drivers/acpi/acpi.h
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index d0ee4c5..ba5c1ea 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -19,7 +19,7 @@ obj-y += tables.o
obj-$(CONFIG_X86) += blacklist.o
#
-# ACPI Core Subsystem (Interpreter)
+# ACPI CA Core Subsystem (Interpreter)
#
obj-y += osl.o utils.o reboot.o\
dispatcher/ events/ executer/ hardware/ \
@@ -36,10 +36,10 @@ processor-objs += processor_perflib.o
endif
obj-y += sleep/
-obj-y += bus.o glue.o
-obj-y += scan.o
-# Keep EC driver first. Initialization of others depend on it.
-obj-y += ec.o
+obj-y += bus.o scan.o ec.o power.o
+obj-y += glue.o
+obj-$(CONFIG_ACPI_DEBUG) += debug.o
+
obj-$(CONFIG_ACPI_AC) += ac.o
obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_BUTTON) += button.o
@@ -51,14 +51,11 @@ obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o
obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
obj-$(CONFIG_ACPI_CONTAINER) += container.o
obj-$(CONFIG_ACPI_THERMAL) += thermal.o
-obj-y += power.o
obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o
-obj-$(CONFIG_ACPI_DEBUG) += debug.o
obj-$(CONFIG_ACPI_NUMA) += numa.o
obj-$(CONFIG_ACPI_WMI) += wmi.o
obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
-obj-$(CONFIG_ACPI_SBS) += sbshc.o
-obj-$(CONFIG_ACPI_SBS) += sbs.o
+obj-$(CONFIG_ACPI_SBS) += sbshc.o sbs.o
diff --git a/drivers/acpi/acpi.h b/drivers/acpi/acpi.h
new file mode 100644
index 0000000..8ef1ed5
--- /dev/null
+++ b/drivers/acpi/acpi.h
@@ -0,0 +1,15 @@
+/*
+ * (c) Copyright 2008 Hewlett-Packard Development Company, L.P.
+ * Bjorn Helgaas <bjorn.helgaas@hp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/* Functions internal to the ACPI core */
+
+int init_acpi_device_notify(void);
+int acpi_debug_init(void);
+int acpi_scan_init(void);
+int acpi_system_init(void);
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index b9cb6eb..edabe0d 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -39,6 +39,8 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
+#include "acpi.h"
+
#define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME("bus");
@@ -853,6 +855,7 @@ static int __init acpi_init(void)
acpi_kobj = NULL;
}
+ init_acpi_device_notify();
result = acpi_bus_init();
if (!result) {
@@ -869,11 +872,23 @@ static int __init acpi_init(void)
#endif
} else
disable_acpi();
+
/*
* If the laptop falls into the DMI check table, the power state check
* will be disabled in the course of device power transistion.
*/
dmi_check_system(power_nocheck_dmi_table);
+
+ if (acpi_disabled)
+ return result;
+
+#ifdef CONFIG_ACPI_DEBUG
+ acpi_debug_init();
+#endif
+ acpi_scan_init();
+#ifdef CONFIG_ACPI_SYSTEM
+ acpi_system_init();
+#endif
return result;
}
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c
index abf36b4..5f642fa 100644
--- a/drivers/acpi/debug.c
+++ b/drivers/acpi/debug.c
@@ -11,6 +11,8 @@
#include <acpi/acpi_drivers.h>
#include <acpi/acglobal.h>
+#include "acpi.h"
+
#define _COMPONENT ACPI_SYSTEM_COMPONENT
ACPI_MODULE_NAME("debug");
@@ -283,17 +285,15 @@ acpi_system_write_debug(struct file *file,
return count;
}
+#endif
-static int __init acpi_debug_init(void)
+int __init acpi_debug_init(void)
{
+#ifdef CONFIG_ACPI_PROCFS
struct proc_dir_entry *entry;
int error = 0;
char *name;
-
- if (acpi_disabled)
- return 0;
-
/* 'debug_layer' [R/W] */
name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
entry =
@@ -324,7 +324,7 @@ static int __init acpi_debug_init(void)
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir);
error = -ENODEV;
goto Done;
-}
-
-subsys_initcall(acpi_debug_init);
+#else
+ return 0;
#endif
+}
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 24649ad..6f2dcdf 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -12,6 +12,8 @@
#include <linux/rwsem.h>
#include <linux/acpi.h>
+#include "acpi.h"
+
#define ACPI_GLUE_DEBUG 0
#if ACPI_GLUE_DEBUG
#define DBG(x...) printk(PREFIX x)
@@ -246,10 +248,8 @@ static int acpi_platform_notify_remove(struct device *dev)
return 0;
}
-static int __init init_acpi_device_notify(void)
+int init_acpi_device_notify(void)
{
- if (acpi_disabled)
- return 0;
if (platform_notify || platform_notify_remove) {
printk(KERN_ERR PREFIX "Can't use platform_notify\n");
return 0;
@@ -258,5 +258,3 @@ static int __init init_acpi_device_notify(void)
platform_notify_remove = acpi_platform_notify_remove;
return 0;
}
-
-arch_initcall(init_acpi_device_notify);
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index a9dda8e..1f605dd 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -12,6 +12,8 @@
#include <acpi/acpi_drivers.h>
#include <acpi/acinterp.h> /* for acpi_ex_eisa_id_to_string() */
+#include "acpi.h"
+
#define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME("scan");
#define STRUCT_TO_INT(s) (*((int*)&s))
@@ -1566,15 +1568,11 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
}
-static int __init acpi_scan_init(void)
+int __init acpi_scan_init(void)
{
int result;
struct acpi_bus_ops ops;
-
- if (acpi_disabled)
- return 0;
-
memset(&ops, 0, sizeof(ops));
ops.acpi_op_add = 1;
ops.acpi_op_start = 1;
@@ -1607,5 +1605,3 @@ static int __init acpi_scan_init(void)
Done:
return result;
}
-
-subsys_initcall(acpi_scan_init);
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index 1d74171..8ade31c 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -626,20 +626,14 @@ static int acpi_system_procfs_init(void)
}
#endif
-static int __init acpi_system_init(void)
+int __init acpi_system_init(void)
{
- int result = 0;
-
- if (acpi_disabled)
- return 0;
+ int result;
result = acpi_system_procfs_init();
if (result)
return result;
result = acpi_system_sysfs_init();
-
return result;
}
-
-subsys_initcall(acpi_system_init);
next prev parent reply other threads:[~2008-11-05 23:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-05 23:17 [PATCH 00/11] RFC: various ACPI core cleanups Bjorn Helgaas
2008-11-05 23:17 ` [PATCH 01/11] ACPI: update debug parameter documentation Bjorn Helgaas
2008-11-06 20:29 ` Len Brown
2008-11-06 21:22 ` Bjorn Helgaas
2008-11-06 22:15 ` Len Brown
2008-11-06 22:24 ` Randy Dunlap
2008-11-05 23:17 ` [PATCH 02/11] ACPI: remove comments about debug layer/level to use Bjorn Helgaas
2008-11-06 20:30 ` Len Brown
2008-11-05 23:17 ` [PATCH 03/11] ACPI: SBS: remove useless acpi_cm_sbs_init() initcall Bjorn Helgaas
2008-11-06 20:31 ` Len Brown
2008-11-05 23:17 ` [PATCH 04/11] ACPI: pci_link: remove acpi_irq_balance_set() interface Bjorn Helgaas
2008-11-06 20:41 ` Len Brown
2008-11-05 23:17 ` [PATCH 05/11] ACPI: remove CONFIG_ACPI_POWER Bjorn Helgaas
2008-11-06 20:42 ` Len Brown
2008-11-05 23:18 ` [PATCH 06/11] ACPI: remove CONFIG_ACPI_EC Bjorn Helgaas
2008-11-06 20:57 ` Len Brown
2008-11-05 23:18 ` [PATCH 07/11] ACPI: add CONFIG_ACPI_PCI Bjorn Helgaas
2008-11-06 19:41 ` Bjorn Helgaas
2008-11-05 23:18 ` [PATCH 08/11] ACPI: remove ACPI dependency on PCI Bjorn Helgaas
2008-11-05 23:18 ` [PATCH 09/11] ACPI: remove ACPI dependency on PM Bjorn Helgaas
2008-11-05 23:18 ` [PATCH 10/11] ia64: remove automatic PM selection Bjorn Helgaas
2008-11-05 23:18 ` Bjorn Helgaas [this message]
2008-11-06 22:02 ` [PATCH 11/11] ACPI: call core init functions explicitly instead of using initcalls Len Brown
2008-11-06 23:40 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081105231828.26131.90839.stgit@bob.kio \
--to=bjorn.helgaas@hp.com \
--cc=astarikovskiy@suse.de \
--cc=linux-acpi@vger.kernel.org \
--cc=yakui.zhao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox