Skip to content

Commit

Permalink
Pull sysfs into test branch
Browse files Browse the repository at this point in the history
Conflicts:

	Documentation/feature-removal-schedule.txt
	include/acpi/acpi_drivers.h

Signed-off-by: Len Brown <[email protected]>
  • Loading branch information
lenb committed Feb 3, 2007
2 parents 1fcb71b + bfd8022 commit 975a8e3
Show file tree
Hide file tree
Showing 18 changed files with 759 additions and 763 deletions.
10 changes: 9 additions & 1 deletion Documentation/feature-removal-schedule.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ Who: Venkatesh Pallipadi <[email protected]>

---------------------------

<<<<<<< test:Documentation/feature-removal-schedule.txt
What: ACPI hotkey driver (CONFIG_ACPI_HOTKEY)
When: 2.6.21
Why: hotkey.c was an attempt to consolidate multiple drivers that use
Expand Down Expand Up @@ -306,11 +307,18 @@ Why: The ACPI namespace is effectively the symbol list for
the BIOS can be extracted and disassembled with acpidump
and iasl as documented in the pmtools package here:
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/utils

Who: Len Brown <[email protected]>

---------------------------

What: ACPI procfs interface
When: July 2007
Why: After ACPI sysfs conversion, ACPI attributes will be duplicated
in sysfs and the ACPI procfs interface should be removed.
Who: Zhang Rui <[email protected]>

---------------------------

What: /proc/acpi/button
When: August 2007
Why: /proc/acpi/button has been replaced by events to the input layer
Expand Down
14 changes: 14 additions & 0 deletions drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ config ACPI_SLEEP_PROC_SLEEP
Create /proc/acpi/sleep
Deprecated by /sys/power/state

config ACPI_PROCFS
bool "Procfs interface (deprecated)"
depends on ACPI
default y
---help---
Procfs interface for ACPI is made optional for back-compatible.
As the same functions are duplicated in sysfs interface
and this proc interface will be removed some time later,
it's marked as deprecated.
( /proc/acpi/debug_layer && debug_level are deprecated by
/sys/module/acpi/parameters/debug_layer && debug_level.
/proc/acpi/info is deprecated by
/sys/module/acpi/parameters/acpica_version )

config ACPI_AC
tristate "AC Adapter"
depends on X86
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ endif

obj-y += sleep/
obj-y += bus.o glue.o
obj-y += scan.o motherboard.o
obj-$(CONFIG_ACPI_AC) += ac.o
obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_BUTTON) += button.o
Expand All @@ -57,7 +58,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o
obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o
obj-$(CONFIG_ACPI_IBM) += ibm_acpi.o
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
obj-y += scan.o motherboard.o
obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
obj-y += cm_sbs.o
obj-$(CONFIG_ACPI_SBS) += i2c_ec.o sbs.o
4 changes: 2 additions & 2 deletions drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);

static int acpi_battery_add(struct acpi_device *device);
static int acpi_battery_remove(struct acpi_device *device, int type);
static int acpi_battery_resume(struct acpi_device *device, int status);
static int acpi_battery_resume(struct acpi_device *device);

static struct acpi_driver acpi_battery_driver = {
.name = ACPI_BATTERY_DRIVER_NAME,
Expand Down Expand Up @@ -753,7 +753,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
}

/* this is needed to learn about changes made in suspended state */
static int acpi_battery_resume(struct acpi_device *device, int state)
static int acpi_battery_resume(struct acpi_device *device)
{
struct acpi_battery *battery;

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)

if (!device->flags.power_manageable) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device `[%s]' is not power manageable\n",
device->kobj.name));
device->dev.kobj.name));
return -ENODEV;
}
/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_button_driver = {
.name = ACPI_BUTTON_DRIVER_NAME,
.class = ACPI_BUTTON_CLASS,
.ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
.ids = "button_power,button_sleep,PNP0C0D,PNP0C0C,PNP0C0E",
.ops = {
.add = acpi_button_add,
.remove = acpi_button_remove,
Expand Down
6 changes: 3 additions & 3 deletions drivers/acpi/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,21 +167,21 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
if (ACPI_FAILURE(status) || !device) {
result = container_device_add(&device, handle);
if (!result)
kobject_uevent(&device->kobj,
kobject_uevent(&device->dev.kobj,
KOBJ_ONLINE);
else
printk("Failed to add container\n");
}
} else {
if (ACPI_SUCCESS(status)) {
/* device exist and this is a remove request */
kobject_uevent(&device->kobj, KOBJ_OFFLINE);
kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
}
}
break;
case ACPI_NOTIFY_EJECT_REQUEST:
if (!acpi_bus_get_device(handle, &device) && device) {
kobject_uevent(&device->kobj, KOBJ_OFFLINE);
kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
}
break;
default:
Expand Down
62 changes: 57 additions & 5 deletions drivers/acpi/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@

#define _COMPONENT ACPI_SYSTEM_COMPONENT
ACPI_MODULE_NAME("debug")
#define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
#define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"

#ifdef MODULE_PARAM_PREFIX
#undef MODULE_PARAM_PREFIX
#endif
#define MODULE_PARAM_PREFIX
module_param(acpi_dbg_layer, uint, 0400);
module_param(acpi_dbg_level, uint, 0400);
#define MODULE_PARAM_PREFIX "acpi."

struct acpi_dlayer {
const char *name;
Expand Down Expand Up @@ -86,6 +83,60 @@ static const struct acpi_dlevel acpi_debug_levels[] = {
ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
};

/* --------------------------------------------------------------------------
FS Interface (/sys)
-------------------------------------------------------------------------- */
static int param_get_debug_layer(char *buffer, struct kernel_param *kp) {
int result = 0;
int i;

result = sprintf(buffer, "%-25s\tHex SET\n", "Description");

for(i = 0; i <ARRAY_SIZE(acpi_debug_layers); i++) {
result += sprintf(buffer+result, "%-25s\t0x%08lX [%c]\n",
acpi_debug_layers[i].name,
acpi_debug_layers[i].value,
(acpi_dbg_layer & acpi_debug_layers[i].value) ? '*' : ' ');
}
result += sprintf(buffer+result, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
ACPI_ALL_DRIVERS,
(acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
ACPI_ALL_DRIVERS) == 0 ? ' ' : '-');
result += sprintf(buffer+result, "--\ndebug_layer = 0x%08X ( * = enabled)\n", acpi_dbg_layer);

return result;
}

static int param_get_debug_level(char *buffer, struct kernel_param *kp) {
int result = 0;
int i;

result = sprintf(buffer, "%-25s\tHex SET\n", "Description");

for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
result += sprintf(buffer+result, "%-25s\t0x%08lX [%c]\n",
acpi_debug_levels[i].name,
acpi_debug_levels[i].value,
(acpi_dbg_level & acpi_debug_levels[i].
value) ? '*' : ' ');
}
result += sprintf(buffer+result, "--\ndebug_level = 0x%08X (* = enabled)\n",
acpi_dbg_level);

return result;
}

module_param_call(debug_layer, param_set_uint, param_get_debug_layer, &acpi_dbg_layer, 0644);
module_param_call(debug_level, param_set_uint, param_get_debug_level, &acpi_dbg_level, 0644);

/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PROCFS
#define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
#define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"

static int
acpi_system_read_debug(char *page,
char **start, off_t off, int count, int *eof, void *data)
Expand Down Expand Up @@ -221,3 +272,4 @@ static int __init acpi_debug_init(void)
}

subsys_initcall(acpi_debug_init);
#endif
8 changes: 4 additions & 4 deletions drivers/acpi/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ MODULE_LICENSE("GPL");

static int acpi_fan_add(struct acpi_device *device);
static int acpi_fan_remove(struct acpi_device *device, int type);
static int acpi_fan_suspend(struct acpi_device *device, int state);
static int acpi_fan_resume(struct acpi_device *device, int state);
static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state);
static int acpi_fan_resume(struct acpi_device *device);

static struct acpi_driver acpi_fan_driver = {
.name = ACPI_FAN_DRIVER_NAME,
Expand Down Expand Up @@ -237,7 +237,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
return 0;
}

static int acpi_fan_suspend(struct acpi_device *device, int state)
static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state)
{
if (!device)
return -EINVAL;
Expand All @@ -247,7 +247,7 @@ static int acpi_fan_suspend(struct acpi_device *device, int state)
return AE_OK;
}

static int acpi_fan_resume(struct acpi_device *device, int state)
static int acpi_fan_resume(struct acpi_device *device)
{
int result = 0;
int power_state = 0;
Expand Down
19 changes: 4 additions & 15 deletions drivers/acpi/motherboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
ACPI_MODULE_NAME("acpi_motherboard")

/* Dell use PNP0C01 instead of PNP0C02 */
#define ACPI_MB_HID1 "PNP0C01"
#define ACPI_MB_HID2 "PNP0C02"
#define ACPI_MB_HID "PNP0C01,PNP0C02"
/**
* Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
* Doesn't care about the failure of 'request_region', since other may reserve
Expand Down Expand Up @@ -110,19 +109,10 @@ static int acpi_motherboard_add(struct acpi_device *device)
return 0;
}

static struct acpi_driver acpi_motherboard_driver1 = {
static struct acpi_driver acpi_motherboard_driver = {
.name = "motherboard",
.class = "",
.ids = ACPI_MB_HID1,
.ops = {
.add = acpi_motherboard_add,
},
};

static struct acpi_driver acpi_motherboard_driver2 = {
.name = "motherboard",
.class = "",
.ids = ACPI_MB_HID2,
.ids = ACPI_MB_HID,
.ops = {
.add = acpi_motherboard_add,
},
Expand Down Expand Up @@ -173,8 +163,7 @@ static void __init acpi_reserve_resources(void)

static int __init acpi_motherboard_init(void)
{
acpi_bus_register_driver(&acpi_motherboard_driver1);
acpi_bus_register_driver(&acpi_motherboard_driver2);
acpi_bus_register_driver(&acpi_motherboard_driver);
/*
* Guarantee motherboard IO reservation first
* This module must run after scan.c
Expand Down
25 changes: 22 additions & 3 deletions drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,21 @@ static acpi_status try_get_root_bridge_busnr(acpi_handle handle, int *busnum)
return AE_OK;
}

static void acpi_pci_bridge_scan(struct acpi_device *device)
{
int status;
struct acpi_device *child = NULL;

if (device->flags.bus_address)
if (device->parent && device->parent->ops.bind) {
status = device->parent->ops.bind(device);
if (!status) {
list_for_each_entry(child, &device->children, node)
acpi_pci_bridge_scan(child);
}
}
}

static int acpi_pci_root_add(struct acpi_device *device)
{
int result = 0;
Expand All @@ -173,6 +188,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
acpi_status status = AE_OK;
unsigned long value = 0;
acpi_handle handle = NULL;
struct acpi_device *child;


if (!device)
Expand All @@ -188,9 +204,6 @@ static int acpi_pci_root_add(struct acpi_device *device)
strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
acpi_driver_data(device) = root;

/*
* TBD: Doesn't the bus driver automatically set this?
*/
device->ops.bind = acpi_pci_bind;

/*
Expand Down Expand Up @@ -312,6 +325,12 @@ static int acpi_pci_root_add(struct acpi_device *device)
result = acpi_pci_irq_add_prt(device->handle, root->id.segment,
root->id.bus);

/*
* Scan and bind all _ADR-Based Devices
*/
list_for_each_entry(child, &device->children, node)
acpi_pci_bridge_scan(child);

end:
if (result) {
if (!list_empty(&root->node))
Expand Down
8 changes: 4 additions & 4 deletions drivers/acpi/processor_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
return -ENODEV;

if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
kobject_uevent(&(*device)->kobj, KOBJ_ONLINE);
kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE);
}
return 0;
}
Expand Down Expand Up @@ -852,13 +852,13 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
}

if (pr->id >= 0 && (pr->id < NR_CPUS)) {
kobject_uevent(&device->kobj, KOBJ_OFFLINE);
kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
break;
}

result = acpi_processor_start(device);
if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) {
kobject_uevent(&device->kobj, KOBJ_ONLINE);
kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
} else {
printk(KERN_ERR PREFIX "Device [%s] failed to start\n",
acpi_device_bid(device));
Expand All @@ -881,7 +881,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
}

if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
kobject_uevent(&device->kobj, KOBJ_OFFLINE);
kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
Expand Down
Loading

0 comments on commit 975a8e3

Please sign in to comment.