Commit 417009f6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
  pnpacpi: print resource shortage message only once
  PM: ACPI and APM must not be enabled at the same time
  ACPI: apply quirk_ich6_lpc_acpi to more ICH8 and ICH9
  ACPICA: fix acpi_serialize hang regression
  ACPI : Not register gsi for PCI IDE controller in legacy mode
  ACPI: Reintroduce run time configurable max_cstate for !CPU_IDLE case
  ACPI: Make sysfs interface in ACPI power optional.
  ACPI: EC: Enable boot EC before bus_scan
  increase PNP_MAX_PORT to 40 from 24
parents ba67a39e 55d1bb9a
Loading
Loading
Loading
Loading
+3 −7
Original line number Original line Diff line number Diff line
@@ -2256,14 +2256,12 @@ static int __init apm_init(void)
		apm_info.disabled = 1;
		apm_info.disabled = 1;
		return -ENODEV;
		return -ENODEV;
	}
	}
	if (PM_IS_ACTIVE()) {
	if (pm_flags & PM_ACPI) {
		printk(KERN_NOTICE "apm: overridden by ACPI.\n");
		printk(KERN_NOTICE "apm: overridden by ACPI.\n");
		apm_info.disabled = 1;
		apm_info.disabled = 1;
		return -ENODEV;
		return -ENODEV;
	}
	}
#ifdef CONFIG_PM_LEGACY
	pm_flags |= PM_APM;
	pm_active = 1;
#endif


	/*
	/*
	 * Set up a segment that references the real mode segment 0x40
	 * Set up a segment that references the real mode segment 0x40
@@ -2366,9 +2364,7 @@ static void __exit apm_exit(void)
		kthread_stop(kapmd_task);
		kthread_stop(kapmd_task);
		kapmd_task = NULL;
		kapmd_task = NULL;
	}
	}
#ifdef CONFIG_PM_LEGACY
	pm_flags &= ~PM_APM;
	pm_active = 0;
#endif
}
}


module_init(apm_init);
module_init(apm_init);
+6 −3
Original line number Original line Diff line number Diff line
@@ -82,6 +82,12 @@ config ACPI_PROCFS_POWER
	  and functions, which do not yet exist in /sys
	  and functions, which do not yet exist in /sys


	  Say N to delete power /proc/acpi/ folders that have moved to /sys/
	  Say N to delete power /proc/acpi/ folders that have moved to /sys/
config ACPI_SYSFS_POWER
	bool "Future power /sys interface"
	select POWER_SUPPLY
	default y
	---help---
	  Say N to disable power /sys interface
config ACPI_PROC_EVENT
config ACPI_PROC_EVENT
	bool "Deprecated /proc/acpi/event support"
	bool "Deprecated /proc/acpi/event support"
	depends on PROC_FS
	depends on PROC_FS
@@ -103,7 +109,6 @@ config ACPI_PROC_EVENT
config ACPI_AC
config ACPI_AC
	tristate "AC Adapter"
	tristate "AC Adapter"
	depends on X86
	depends on X86
	select POWER_SUPPLY
	default y
	default y
	help
	help
	  This driver adds support for the AC Adapter object, which indicates
	  This driver adds support for the AC Adapter object, which indicates
@@ -113,7 +118,6 @@ config ACPI_AC
config ACPI_BATTERY
config ACPI_BATTERY
	tristate "Battery"
	tristate "Battery"
	depends on X86
	depends on X86
	select POWER_SUPPLY
	default y
	default y
	help
	help
	  This driver adds support for battery information through
	  This driver adds support for battery information through
@@ -368,7 +372,6 @@ config ACPI_HOTPLUG_MEMORY
config ACPI_SBS
config ACPI_SBS
	tristate "Smart Battery System"
	tristate "Smart Battery System"
	depends on X86
	depends on X86
	select POWER_SUPPLY
	help
	help
	  This driver adds support for the Smart Battery System, another
	  This driver adds support for the Smart Battery System, another
	  type of access to battery information, found on some laptops.
	  type of access to battery information, found on some laptops.
+14 −2
Original line number Original line Diff line number Diff line
@@ -31,7 +31,9 @@
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/seq_file.h>
#endif
#endif
#ifdef CONFIG_ACPI_SYSFS_POWER
#include <linux/power_supply.h>
#include <linux/power_supply.h>
#endif
#include <acpi/acpi_bus.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#include <acpi/acpi_drivers.h>


@@ -79,7 +81,9 @@ static struct acpi_driver acpi_ac_driver = {
};
};


struct acpi_ac {
struct acpi_ac {
#ifdef CONFIG_ACPI_SYSFS_POWER
	struct power_supply charger;
	struct power_supply charger;
#endif
	struct acpi_device * device;
	struct acpi_device * device;
	unsigned long state;
	unsigned long state;
};
};
@@ -94,7 +98,7 @@ static const struct file_operations acpi_ac_fops = {
	.release = single_release,
	.release = single_release,
};
};
#endif
#endif

#ifdef CONFIG_ACPI_SYSFS_POWER
static int get_ac_property(struct power_supply *psy,
static int get_ac_property(struct power_supply *psy,
			   enum power_supply_property psp,
			   enum power_supply_property psp,
			   union power_supply_propval *val)
			   union power_supply_propval *val)
@@ -113,7 +117,7 @@ static int get_ac_property(struct power_supply *psy,
static enum power_supply_property ac_props[] = {
static enum power_supply_property ac_props[] = {
	POWER_SUPPLY_PROP_ONLINE,
	POWER_SUPPLY_PROP_ONLINE,
};
};

#endif
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
                               AC Adapter Management
                               AC Adapter Management
   -------------------------------------------------------------------------- */
   -------------------------------------------------------------------------- */
@@ -241,7 +245,9 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
		acpi_bus_generate_netlink_event(device->pnp.device_class,
		acpi_bus_generate_netlink_event(device->pnp.device_class,
						  device->dev.bus_id, event,
						  device->dev.bus_id, event,
						  (u32) ac->state);
						  (u32) ac->state);
#ifdef CONFIG_ACPI_SYSFS_POWER
		kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
		kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
#endif
		break;
		break;
	default:
	default:
		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -280,12 +286,14 @@ static int acpi_ac_add(struct acpi_device *device)
#endif
#endif
	if (result)
	if (result)
		goto end;
		goto end;
#ifdef CONFIG_ACPI_SYSFS_POWER
	ac->charger.name = acpi_device_bid(device);
	ac->charger.name = acpi_device_bid(device);
	ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
	ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
	ac->charger.properties = ac_props;
	ac->charger.properties = ac_props;
	ac->charger.num_properties = ARRAY_SIZE(ac_props);
	ac->charger.num_properties = ARRAY_SIZE(ac_props);
	ac->charger.get_property = get_ac_property;
	ac->charger.get_property = get_ac_property;
	power_supply_register(&ac->device->dev, &ac->charger);
	power_supply_register(&ac->device->dev, &ac->charger);
#endif
	status = acpi_install_notify_handler(device->handle,
	status = acpi_install_notify_handler(device->handle,
					     ACPI_ALL_NOTIFY, acpi_ac_notify,
					     ACPI_ALL_NOTIFY, acpi_ac_notify,
					     ac);
					     ac);
@@ -319,8 +327,10 @@ static int acpi_ac_resume(struct acpi_device *device)
	old_state = ac->state;
	old_state = ac->state;
	if (acpi_ac_get_state(ac))
	if (acpi_ac_get_state(ac))
		return 0;
		return 0;
#ifdef CONFIG_ACPI_SYSFS_POWER
	if (old_state != ac->state)
	if (old_state != ac->state)
		kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
		kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
#endif
	return 0;
	return 0;
}
}


@@ -337,8 +347,10 @@ static int acpi_ac_remove(struct acpi_device *device, int type)


	status = acpi_remove_notify_handler(device->handle,
	status = acpi_remove_notify_handler(device->handle,
					    ACPI_ALL_NOTIFY, acpi_ac_notify);
					    ACPI_ALL_NOTIFY, acpi_ac_notify);
#ifdef CONFIG_ACPI_SYSFS_POWER
	if (ac->charger.dev)
	if (ac->charger.dev)
		power_supply_unregister(&ac->charger);
		power_supply_unregister(&ac->charger);
#endif
#ifdef CONFIG_ACPI_PROCFS_POWER
#ifdef CONFIG_ACPI_PROCFS_POWER
	acpi_ac_remove_fs(device);
	acpi_ac_remove_fs(device);
#endif
#endif
+25 −6
Original line number Original line Diff line number Diff line
@@ -40,7 +40,9 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#include <acpi/acpi_drivers.h>


#ifdef CONFIG_ACPI_SYSFS_POWER
#include <linux/power_supply.h>
#include <linux/power_supply.h>
#endif


#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF


@@ -86,7 +88,9 @@ MODULE_DEVICE_TABLE(acpi, battery_device_ids);


struct acpi_battery {
struct acpi_battery {
	struct mutex lock;
	struct mutex lock;
#ifdef CONFIG_ACPI_SYSFS_POWER
	struct power_supply bat;
	struct power_supply bat;
#endif
	struct acpi_device *device;
	struct acpi_device *device;
	unsigned long update_time;
	unsigned long update_time;
	int current_now;
	int current_now;
@@ -117,6 +121,7 @@ inline int acpi_battery_present(struct acpi_battery *battery)
	return battery->device->status.battery_present;
	return battery->device->status.battery_present;
}
}


#ifdef CONFIG_ACPI_SYSFS_POWER
static int acpi_battery_technology(struct acpi_battery *battery)
static int acpi_battery_technology(struct acpi_battery *battery)
{
{
	if (!strcasecmp("NiCd", battery->type))
	if (!strcasecmp("NiCd", battery->type))
@@ -222,6 +227,7 @@ static enum power_supply_property energy_battery_props[] = {
	POWER_SUPPLY_PROP_MODEL_NAME,
	POWER_SUPPLY_PROP_MODEL_NAME,
	POWER_SUPPLY_PROP_MANUFACTURER,
	POWER_SUPPLY_PROP_MANUFACTURER,
};
};
#endif


#ifdef CONFIG_ACPI_PROCFS_POWER
#ifdef CONFIG_ACPI_PROCFS_POWER
inline char *acpi_battery_units(struct acpi_battery *battery)
inline char *acpi_battery_units(struct acpi_battery *battery)
@@ -398,6 +404,7 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery)
	return acpi_battery_set_alarm(battery);
	return acpi_battery_set_alarm(battery);
}
}


#ifdef CONFIG_ACPI_SYSFS_POWER
static ssize_t acpi_battery_alarm_show(struct device *dev,
static ssize_t acpi_battery_alarm_show(struct device *dev,
					struct device_attribute *attr,
					struct device_attribute *attr,
					char *buf)
					char *buf)
@@ -429,11 +436,6 @@ static int sysfs_add_battery(struct acpi_battery *battery)
{
{
	int result;
	int result;


	battery->update_time = 0;
	result = acpi_battery_get_info(battery);
	acpi_battery_init_alarm(battery);
	if (result)
		return result;
	if (battery->power_unit) {
	if (battery->power_unit) {
		battery->bat.properties = charge_battery_props;
		battery->bat.properties = charge_battery_props;
		battery->bat.num_properties =
		battery->bat.num_properties =
@@ -462,18 +464,31 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
	power_supply_unregister(&battery->bat);
	power_supply_unregister(&battery->bat);
	battery->bat.dev = NULL;
	battery->bat.dev = NULL;
}
}
#endif


static int acpi_battery_update(struct acpi_battery *battery)
static int acpi_battery_update(struct acpi_battery *battery)
{
{
	int result = acpi_battery_get_status(battery);
	int result;
	result = acpi_battery_get_status(battery);
	if (result)
	if (result)
		return result;
		return result;
#ifdef CONFIG_ACPI_SYSFS_POWER
	if (!acpi_battery_present(battery)) {
	if (!acpi_battery_present(battery)) {
		sysfs_remove_battery(battery);
		sysfs_remove_battery(battery);
		battery->update_time = 0;
		return 0;
		return 0;
	}
	}
#endif
	if (!battery->update_time) {
		result = acpi_battery_get_info(battery);
		if (result)
			return result;
		acpi_battery_init_alarm(battery);
	}
#ifdef CONFIG_ACPI_SYSFS_POWER
	if (!battery->bat.dev)
	if (!battery->bat.dev)
		sysfs_add_battery(battery);
		sysfs_add_battery(battery);
#endif
	return acpi_battery_get_state(battery);
	return acpi_battery_get_state(battery);
}
}


@@ -767,9 +782,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
	acpi_bus_generate_netlink_event(device->pnp.device_class,
	acpi_bus_generate_netlink_event(device->pnp.device_class,
					device->dev.bus_id, event,
					device->dev.bus_id, event,
					acpi_battery_present(battery));
					acpi_battery_present(battery));
#ifdef CONFIG_ACPI_SYSFS_POWER
	/* acpi_batter_update could remove power_supply object */
	/* acpi_batter_update could remove power_supply object */
	if (battery->bat.dev)
	if (battery->bat.dev)
		kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
		kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
#endif
}
}


static int acpi_battery_add(struct acpi_device *device)
static int acpi_battery_add(struct acpi_device *device)
@@ -828,7 +845,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
#ifdef CONFIG_ACPI_PROCFS_POWER
#ifdef CONFIG_ACPI_PROCFS_POWER
	acpi_battery_remove_fs(device);
	acpi_battery_remove_fs(device);
#endif
#endif
#ifdef CONFIG_ACPI_SYSFS_POWER
	sysfs_remove_battery(battery);
	sysfs_remove_battery(battery);
#endif
	mutex_destroy(&battery->lock);
	mutex_destroy(&battery->lock);
	kfree(battery);
	kfree(battery);
	return 0;
	return 0;
+2 −5
Original line number Original line Diff line number Diff line
@@ -29,7 +29,6 @@
#include <linux/list.h>
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/pm.h>
#include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/device.h>
#include <linux/device.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#ifdef CONFIG_X86
#ifdef CONFIG_X86
@@ -764,16 +763,14 @@ static int __init acpi_init(void)
	result = acpi_bus_init();
	result = acpi_bus_init();


	if (!result) {
	if (!result) {
#ifdef CONFIG_PM_LEGACY
		if (!(pm_flags & PM_APM))
		if (!PM_IS_ACTIVE())
			pm_flags |= PM_ACPI;
			pm_active = 1;
		else {
		else {
			printk(KERN_INFO PREFIX
			printk(KERN_INFO PREFIX
			       "APM is already active, exiting\n");
			       "APM is already active, exiting\n");
			disable_acpi();
			disable_acpi();
			result = -ENODEV;
			result = -ENODEV;
		}
		}
#endif
	} else
	} else
		disable_acpi();
		disable_acpi();


Loading