Skip to content

Commit

Permalink
Merge branch 'procfs-cleanup-v2' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Len Brown committed Oct 25, 2010
2 parents aca209e + 03e7c34 commit f3ab69a
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 1,415 deletions.
11 changes: 3 additions & 8 deletions drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ config ACPI_PROCFS
config ACPI_PROCFS_POWER
bool "Deprecated power /proc/acpi directories"
depends on PROC_FS
default y
help
For backwards compatibility, this option allows
deprecated power /proc/acpi/ directories to exist, even when
Expand All @@ -90,13 +89,6 @@ config ACPI_POWER_METER
To compile this driver as a module, choose M here:
the module will be called power-meter.

config ACPI_SYSFS_POWER
bool "Future power /sys interface"
select POWER_SUPPLY
default y
help
Say N to disable power /sys interface

config ACPI_EC_DEBUGFS
tristate "EC read/write access through /sys/kernel/debug/ec"
default n
Expand Down Expand Up @@ -136,6 +128,7 @@ config ACPI_PROC_EVENT
config ACPI_AC
tristate "AC Adapter"
depends on X86
select POWER_SUPPLY
default y
help
This driver supports the AC Adapter object, which indicates
Expand All @@ -148,6 +141,7 @@ config ACPI_AC
config ACPI_BATTERY
tristate "Battery"
depends on X86
select POWER_SUPPLY
default y
help
This driver adds support for battery information through
Expand Down Expand Up @@ -364,6 +358,7 @@ config ACPI_HOTPLUG_MEMORY
config ACPI_SBS
tristate "Smart Battery System"
depends on X86
select POWER_SUPPLY
help
This driver supports the Smart Battery System, another
type of access to battery information, found on some laptops.
Expand Down
14 changes: 0 additions & 14 deletions drivers/acpi/ac.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#endif
#ifdef CONFIG_ACPI_SYSFS_POWER
#include <linux/power_supply.h>
#endif
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>

Expand Down Expand Up @@ -86,9 +84,7 @@ static struct acpi_driver acpi_ac_driver = {
};

struct acpi_ac {
#ifdef CONFIG_ACPI_SYSFS_POWER
struct power_supply charger;
#endif
struct acpi_device * device;
unsigned long long state;
};
Expand All @@ -104,7 +100,6 @@ static const struct file_operations acpi_ac_fops = {
.release = single_release,
};
#endif
#ifdef CONFIG_ACPI_SYSFS_POWER
static int get_ac_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
Expand All @@ -123,7 +118,6 @@ static int get_ac_property(struct power_supply *psy,
static enum power_supply_property ac_props[] = {
POWER_SUPPLY_PROP_ONLINE,
};
#endif
/* --------------------------------------------------------------------------
AC Adapter Management
-------------------------------------------------------------------------- */
Expand Down Expand Up @@ -247,9 +241,7 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
dev_name(&device->dev), event,
(u32) ac->state);
acpi_notifier_call_chain(device, event, (u32) ac->state);
#ifdef CONFIG_ACPI_SYSFS_POWER
kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
#endif
}

return;
Expand Down Expand Up @@ -282,14 +274,12 @@ static int acpi_ac_add(struct acpi_device *device)
#endif
if (result)
goto end;
#ifdef CONFIG_ACPI_SYSFS_POWER
ac->charger.name = acpi_device_bid(device);
ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
ac->charger.properties = ac_props;
ac->charger.num_properties = ARRAY_SIZE(ac_props);
ac->charger.get_property = get_ac_property;
power_supply_register(&ac->device->dev, &ac->charger);
#endif

printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
acpi_device_name(device), acpi_device_bid(device),
Expand All @@ -316,10 +306,8 @@ static int acpi_ac_resume(struct acpi_device *device)
old_state = ac->state;
if (acpi_ac_get_state(ac))
return 0;
#ifdef CONFIG_ACPI_SYSFS_POWER
if (old_state != ac->state)
kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
#endif
return 0;
}

Expand All @@ -333,10 +321,8 @@ static int acpi_ac_remove(struct acpi_device *device, int type)

ac = acpi_driver_data(device);

#ifdef CONFIG_ACPI_SYSFS_POWER
if (ac->charger.dev)
power_supply_unregister(&ac->charger);
#endif
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_ac_remove_fs(device);
#endif
Expand Down
21 changes: 0 additions & 21 deletions drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@

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

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

#define PREFIX "ACPI: "

Expand Down Expand Up @@ -102,9 +99,7 @@ enum {

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

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

#ifdef CONFIG_ACPI_PROCFS_POWER
inline char *acpi_battery_units(struct acpi_battery *battery)
Expand Down Expand Up @@ -492,7 +485,6 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery)
return acpi_battery_set_alarm(battery);
}

#ifdef CONFIG_ACPI_SYSFS_POWER
static ssize_t acpi_battery_alarm_show(struct device *dev,
struct device_attribute *attr,
char *buf)
Expand Down Expand Up @@ -552,7 +544,6 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
power_supply_unregister(&battery->bat);
battery->bat.dev = NULL;
}
#endif

static void acpi_battery_quirks(struct acpi_battery *battery)
{
Expand All @@ -568,9 +559,7 @@ static int acpi_battery_update(struct acpi_battery *battery)
if (result)
return result;
if (!acpi_battery_present(battery)) {
#ifdef CONFIG_ACPI_SYSFS_POWER
sysfs_remove_battery(battery);
#endif
battery->update_time = 0;
return 0;
}
Expand All @@ -582,10 +571,8 @@ static int acpi_battery_update(struct acpi_battery *battery)
acpi_battery_quirks(battery);
acpi_battery_init_alarm(battery);
}
#ifdef CONFIG_ACPI_SYSFS_POWER
if (!battery->bat.dev)
sysfs_add_battery(battery);
#endif
return acpi_battery_get_state(battery);
}

Expand Down Expand Up @@ -867,26 +854,20 @@ static void acpi_battery_remove_fs(struct acpi_device *device)
static void acpi_battery_notify(struct acpi_device *device, u32 event)
{
struct acpi_battery *battery = acpi_driver_data(device);
#ifdef CONFIG_ACPI_SYSFS_POWER
struct device *old;
#endif

if (!battery)
return;
#ifdef CONFIG_ACPI_SYSFS_POWER
old = battery->bat.dev;
#endif
acpi_battery_update(battery);
acpi_bus_generate_proc_event(device, event,
acpi_battery_present(battery));
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event,
acpi_battery_present(battery));
#ifdef CONFIG_ACPI_SYSFS_POWER
/* acpi_battery_update could remove power_supply object */
if (old && battery->bat.dev)
power_supply_changed(&battery->bat);
#endif
}

static int acpi_battery_add(struct acpi_device *device)
Expand Down Expand Up @@ -934,9 +915,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_remove_fs(device);
#endif
#ifdef CONFIG_ACPI_SYSFS_POWER
sysfs_remove_battery(battery);
#endif
mutex_destroy(&battery->lock);
kfree(battery);
return 0;
Expand Down
Loading

0 comments on commit f3ab69a

Please sign in to comment.