Skip to content

Commit

Permalink
Merge branch 'bjorn-initcall-cleanup' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Len Brown committed Apr 5, 2009
2 parents 67dc092 + 018f452 commit 9a38f4e
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 82 deletions.
8 changes: 2 additions & 6 deletions drivers/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ ifdef CONFIG_CPU_FREQ
processor-objs += processor_perflib.o
endif

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 glue.o scan.o ec.o \
power.o system.o event.o
obj-$(CONFIG_ACPI_AC) += ac.o
obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_BUTTON) += button.o
Expand All @@ -51,8 +49,6 @@ 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-y += system.o event.o
obj-$(CONFIG_ACPI_DEBUG) += debug.o
obj-$(CONFIG_ACPI_NUMA) += numa.o
obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
Expand Down
15 changes: 15 additions & 0 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>

#include "internal.h"

#define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME("bus");

Expand Down Expand Up @@ -846,6 +848,7 @@ static int __init acpi_init(void)
acpi_kobj = NULL;
}

init_acpi_device_notify();
result = acpi_bus_init();

if (!result) {
Expand All @@ -860,11 +863,23 @@ static int __init acpi_init(void)
}
} else
disable_acpi();

if (acpi_disabled)
return result;

/*
* 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);

acpi_scan_init();
acpi_ec_init();
acpi_power_init();
acpi_system_init();
acpi_debug_init();
acpi_sleep_proc_init();
acpi_wakeup_device_init();
return result;
}

Expand Down
14 changes: 6 additions & 8 deletions drivers/acpi/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,17 +297,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 =
Expand Down Expand Up @@ -338,7 +336,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
}
7 changes: 1 addition & 6 deletions drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,13 +1069,10 @@ static struct acpi_driver acpi_ec_driver = {
},
};

static int __init acpi_ec_init(void)
int __init acpi_ec_init(void)
{
int result = 0;

if (acpi_disabled)
return 0;

acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir);
if (!acpi_ec_dir)
return -ENODEV;
Expand All @@ -1090,8 +1087,6 @@ static int __init acpi_ec_init(void)
return result;
}

subsys_initcall(acpi_ec_init);

/* EC driver currently not unloadable */
#if 0
static void __exit acpi_ec_exit(void)
Expand Down
6 changes: 1 addition & 5 deletions drivers/acpi/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,8 @@ static int acpi_platform_notify_remove(struct device *dev)
return 0;
}

static int __init init_acpi_device_notify(void)
int __init 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;
Expand All @@ -298,5 +296,3 @@ static int __init init_acpi_device_notify(void)
platform_notify_remove = acpi_platform_notify_remove;
return 0;
}

arch_initcall(init_acpi_device_notify);
43 changes: 43 additions & 0 deletions drivers/acpi/internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* For use by Linux/ACPI infrastructure, not drivers */

int init_acpi_device_notify(void);
int acpi_scan_init(void);
int acpi_system_init(void);

#ifdef CONFIG_ACPI_DEBUG
int acpi_debug_init(void);
#else
static inline int acpi_debug_init(void) { return 0; }
#endif

/* --------------------------------------------------------------------------
Power Resource
-------------------------------------------------------------------------- */
int acpi_power_init(void);
int acpi_device_sleep_wake(struct acpi_device *dev,
int enable, int sleep_state, int dev_state);
int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state);
int acpi_disable_wakeup_device_power(struct acpi_device *dev);
int acpi_power_get_inferred_state(struct acpi_device *device);
int acpi_power_transition(struct acpi_device *device, int state);
extern int acpi_power_nocheck;

int acpi_wakeup_device_init(void);

/* --------------------------------------------------------------------------
Embedded Controller
-------------------------------------------------------------------------- */
int acpi_ec_init(void);
int acpi_ec_ecdt_probe(void);
int acpi_boot_ec_enable(void);

/*--------------------------------------------------------------------------
Suspend/Resume
-------------------------------------------------------------------------- */
extern int acpi_sleep_init(void);

#ifdef CONFIG_ACPI_SLEEP
int acpi_sleep_proc_init(void);
#else
static inline int acpi_sleep_proc_init(void) { return 0; }
#endif
8 changes: 1 addition & 7 deletions drivers/acpi/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,14 +773,10 @@ static int acpi_power_resume(struct acpi_device *device)
return 0;
}

static int __init acpi_power_init(void)
int __init acpi_power_init(void)
{
int result = 0;


if (acpi_disabled)
return 0;

INIT_LIST_HEAD(&acpi_power_resource_list);

acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir);
Expand All @@ -795,5 +791,3 @@ static int __init acpi_power_init(void)

return 0;
}

subsys_initcall(acpi_power_init);
7 changes: 1 addition & 6 deletions drivers/acpi/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,8 @@ static u32 rtc_handler(void *context)
}
#endif /* HAVE_ACPI_LEGACY_ALARM */

static int __init acpi_sleep_proc_init(void)
int __init acpi_sleep_proc_init(void)
{
if (acpi_disabled)
return 0;

#ifdef CONFIG_ACPI_PROCFS
/* 'sleep' [R/W] */
proc_create("sleep", S_IFREG | S_IRUGO | S_IWUSR,
Expand All @@ -527,5 +524,3 @@ static int __init acpi_sleep_proc_init(void)

return 0;
}

late_initcall(acpi_sleep_proc_init);
11 changes: 3 additions & 8 deletions drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include <acpi/acpi_drivers.h>

#include "internal.h"

#define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME("scan");
#define STRUCT_TO_INT(s) (*((int*)&s))
Expand Down Expand Up @@ -1524,16 +1526,11 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
return result;
}


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;
Expand Down Expand Up @@ -1566,5 +1563,3 @@ static int __init acpi_scan_init(void)
Done:
return result;
}

subsys_initcall(acpi_scan_init);
2 changes: 2 additions & 0 deletions drivers/acpi/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>

#include "internal.h"
#include "sleep.h"

u8 sleep_states[ACPI_S_STATE_COUNT];
Expand Down
9 changes: 2 additions & 7 deletions drivers/acpi/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,9 @@ 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)
Expand All @@ -586,5 +583,3 @@ static int __init acpi_system_init(void)

return result;
}

subsys_initcall(acpi_system_init);
9 changes: 3 additions & 6 deletions drivers/acpi/wakeup.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <acpi/acpi_drivers.h>
#include <linux/kernel.h>
#include <linux/types.h>

#include "internal.h"
#include "sleep.h"

#define _COMPONENT ACPI_SYSTEM_COMPONENT
Expand Down Expand Up @@ -136,13 +138,10 @@ void acpi_disable_wakeup_device(u8 sleep_state)
spin_unlock(&acpi_device_lock);
}

static int __init acpi_wakeup_device_init(void)
int __init acpi_wakeup_device_init(void)
{
struct list_head *node, *next;

if (acpi_disabled)
return 0;

spin_lock(&acpi_device_lock);
list_for_each_safe(node, next, &acpi_wakeup_device_list) {
struct acpi_device *dev = container_of(node,
Expand All @@ -163,5 +162,3 @@ static int __init acpi_wakeup_device_init(void)
spin_unlock(&acpi_device_lock);
return 0;
}

late_initcall(acpi_wakeup_device_init);
23 changes: 0 additions & 23 deletions include/acpi/acpi_drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,6 @@ int acpi_pci_bind_root(struct acpi_device *device, struct acpi_pci_id *id,
struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain,
int bus);

/* --------------------------------------------------------------------------
Power Resource
-------------------------------------------------------------------------- */

int acpi_device_sleep_wake(struct acpi_device *dev,
int enable, int sleep_state, int dev_state);
int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state);
int acpi_disable_wakeup_device_power(struct acpi_device *dev);
int acpi_power_get_inferred_state(struct acpi_device *device);
int acpi_power_transition(struct acpi_device *device, int state);
extern int acpi_power_nocheck;

/* --------------------------------------------------------------------------
Embedded Controller
-------------------------------------------------------------------------- */
int acpi_ec_ecdt_probe(void);
int acpi_boot_ec_enable(void);

/* --------------------------------------------------------------------------
Processor
-------------------------------------------------------------------------- */
Expand Down Expand Up @@ -165,9 +147,4 @@ static inline void unregister_hotplug_dock_device(acpi_handle handle)
}
#endif

/*--------------------------------------------------------------------------
Suspend/Resume
-------------------------------------------------------------------------- */
extern int acpi_sleep_init(void);

#endif /*__ACPI_DRIVERS_H__*/

0 comments on commit 9a38f4e

Please sign in to comment.