Commit f3ab69a3 authored by Len Brown's avatar Len Brown

Merge branch 'procfs-cleanup-v2' into release

parents aca209e5 03e7c343
...@@ -66,7 +66,6 @@ config ACPI_PROCFS ...@@ -66,7 +66,6 @@ config ACPI_PROCFS
config ACPI_PROCFS_POWER config ACPI_PROCFS_POWER
bool "Deprecated power /proc/acpi directories" bool "Deprecated power /proc/acpi directories"
depends on PROC_FS depends on PROC_FS
default y
help help
For backwards compatibility, this option allows For backwards compatibility, this option allows
deprecated power /proc/acpi/ directories to exist, even when deprecated power /proc/acpi/ directories to exist, even when
...@@ -90,13 +89,6 @@ config ACPI_POWER_METER ...@@ -90,13 +89,6 @@ config ACPI_POWER_METER
To compile this driver as a module, choose M here: To compile this driver as a module, choose M here:
the module will be called power-meter. 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 config ACPI_EC_DEBUGFS
tristate "EC read/write access through /sys/kernel/debug/ec" tristate "EC read/write access through /sys/kernel/debug/ec"
default n default n
...@@ -136,6 +128,7 @@ config ACPI_PROC_EVENT ...@@ -136,6 +128,7 @@ 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 supports the AC Adapter object, which indicates This driver supports the AC Adapter object, which indicates
...@@ -148,6 +141,7 @@ config ACPI_AC ...@@ -148,6 +141,7 @@ 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
...@@ -364,6 +358,7 @@ config ACPI_HOTPLUG_MEMORY ...@@ -364,6 +358,7 @@ 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 supports the Smart Battery System, another This driver supports 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.
......
...@@ -32,9 +32,7 @@ ...@@ -32,9 +32,7 @@
#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>
...@@ -86,9 +84,7 @@ static struct acpi_driver acpi_ac_driver = { ...@@ -86,9 +84,7 @@ 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 long state; unsigned long long state;
}; };
...@@ -104,7 +100,6 @@ static const struct file_operations acpi_ac_fops = { ...@@ -104,7 +100,6 @@ 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)
...@@ -123,7 +118,6 @@ static int get_ac_property(struct power_supply *psy, ...@@ -123,7 +118,6 @@ 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
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -247,9 +241,7 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) ...@@ -247,9 +241,7 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
dev_name(&device->dev), event, dev_name(&device->dev), event,
(u32) ac->state); (u32) ac->state);
acpi_notifier_call_chain(device, 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); kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
#endif
} }
return; return;
...@@ -282,14 +274,12 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -282,14 +274,12 @@ 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
printk(KERN_INFO PREFIX "%s [%s] (%s)\n", printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
acpi_device_name(device), acpi_device_bid(device), acpi_device_name(device), acpi_device_bid(device),
...@@ -316,10 +306,8 @@ static int acpi_ac_resume(struct acpi_device *device) ...@@ -316,10 +306,8 @@ 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;
} }
...@@ -333,10 +321,8 @@ static int acpi_ac_remove(struct acpi_device *device, int type) ...@@ -333,10 +321,8 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
ac = acpi_driver_data(device); ac = acpi_driver_data(device);
#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
......
...@@ -42,10 +42,7 @@ ...@@ -42,10 +42,7 @@
#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 PREFIX "ACPI: " #define PREFIX "ACPI: "
...@@ -102,9 +99,7 @@ enum { ...@@ -102,9 +99,7 @@ enum {
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 rate_now; int rate_now;
...@@ -141,7 +136,6 @@ inline int acpi_battery_present(struct acpi_battery *battery) ...@@ -141,7 +136,6 @@ 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))
...@@ -281,7 +275,6 @@ static enum power_supply_property energy_battery_props[] = { ...@@ -281,7 +275,6 @@ static enum power_supply_property energy_battery_props[] = {
POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_SERIAL_NUMBER, POWER_SUPPLY_PROP_SERIAL_NUMBER,
}; };
#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)
...@@ -492,7 +485,6 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery) ...@@ -492,7 +485,6 @@ 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)
...@@ -552,7 +544,6 @@ static void sysfs_remove_battery(struct acpi_battery *battery) ...@@ -552,7 +544,6 @@ 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 void acpi_battery_quirks(struct acpi_battery *battery) static void acpi_battery_quirks(struct acpi_battery *battery)
{ {
...@@ -568,9 +559,7 @@ static int acpi_battery_update(struct acpi_battery *battery) ...@@ -568,9 +559,7 @@ static int acpi_battery_update(struct acpi_battery *battery)
if (result) if (result)
return result; return result;
if (!acpi_battery_present(battery)) { if (!acpi_battery_present(battery)) {
#ifdef CONFIG_ACPI_SYSFS_POWER
sysfs_remove_battery(battery); sysfs_remove_battery(battery);
#endif
battery->update_time = 0; battery->update_time = 0;
return 0; return 0;
} }
...@@ -582,10 +571,8 @@ static int acpi_battery_update(struct acpi_battery *battery) ...@@ -582,10 +571,8 @@ static int acpi_battery_update(struct acpi_battery *battery)
acpi_battery_quirks(battery); acpi_battery_quirks(battery);
acpi_battery_init_alarm(battery); 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);
} }
...@@ -867,26 +854,20 @@ static void acpi_battery_remove_fs(struct acpi_device *device) ...@@ -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) static void acpi_battery_notify(struct acpi_device *device, u32 event)
{ {
struct acpi_battery *battery = acpi_driver_data(device); struct acpi_battery *battery = acpi_driver_data(device);
#ifdef CONFIG_ACPI_SYSFS_POWER
struct device *old; struct device *old;
#endif
if (!battery) if (!battery)
return; return;
#ifdef CONFIG_ACPI_SYSFS_POWER
old = battery->bat.dev; old = battery->bat.dev;
#endif
acpi_battery_update(battery); acpi_battery_update(battery);
acpi_bus_generate_proc_event(device, event, acpi_bus_generate_proc_event(device, event,
acpi_battery_present(battery)); acpi_battery_present(battery));
acpi_bus_generate_netlink_event(device->pnp.device_class, acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event, dev_name(&device->dev), event,
acpi_battery_present(battery)); acpi_battery_present(battery));
#ifdef CONFIG_ACPI_SYSFS_POWER
/* acpi_battery_update could remove power_supply object */ /* acpi_battery_update could remove power_supply object */
if (old && battery->bat.dev) if (old && battery->bat.dev)
power_supply_changed(&battery->bat); power_supply_changed(&battery->bat);
#endif
} }
static int acpi_battery_add(struct acpi_device *device) static int acpi_battery_add(struct acpi_device *device)
...@@ -934,9 +915,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) ...@@ -934,9 +915,7 @@ 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;
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/thermal.h> #include <linux/thermal.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
...@@ -118,122 +116,6 @@ static struct thermal_cooling_device_ops fan_cooling_ops = { ...@@ -118,122 +116,6 @@ static struct thermal_cooling_device_ops fan_cooling_ops = {
.set_cur_state = fan_set_cur_state, .set_cur_state = fan_set_cur_state,
}; };
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PROCFS
static struct proc_dir_entry *acpi_fan_dir;
static int acpi_fan_read_state(struct seq_file *seq, void *offset)
{
struct acpi_device *device = seq->private;
int state = 0;
if (device) {
if (acpi_bus_get_power(device->handle, &state))
seq_printf(seq, "status: ERROR\n");
else
seq_printf(seq, "status: %s\n",
!state ? "on" : "off");
}
return 0;
}
static int acpi_fan_state_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_fan_read_state, PDE(inode)->data);
}
static ssize_t
acpi_fan_write_state(struct file *file, const char __user * buffer,
size_t count, loff_t * ppos)
{
int result = 0;
struct seq_file *m = file->private_data;
struct acpi_device *device = m->private;
char state_string[3] = { '\0' };
if (count > sizeof(state_string) - 1)
return -EINVAL;
if (copy_from_user(state_string, buffer, count))
return -EFAULT;
state_string[count] = '\0';
if ((state_string[0] < '0') || (state_string[0] > '3'))
return -EINVAL;
if (state_string[1] == '\n')
state_string[1] = '\0';
if (state_string[1] != '\0')
return -EINVAL;
result = acpi_bus_set_power(device->handle,
simple_strtoul(state_string, NULL, 0));
if (result)
return result;
return count;
}
static const struct file_operations acpi_fan_state_ops = {
.open = acpi_fan_state_open_fs,
.read = seq_read,
.write = acpi_fan_write_state,
.llseek = seq_lseek,
.release = single_release,
.owner = THIS_MODULE,
};
static int acpi_fan_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
if (!device)
return -EINVAL;
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_fan_dir);
if (!acpi_device_dir(device))
return -ENODEV;
}
/* 'status' [R/W] */
entry = proc_create_data(ACPI_FAN_FILE_STATE,
S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device),
&acpi_fan_state_ops,
device);
if (!entry)
return -ENODEV;
return 0;
}
static int acpi_fan_remove_fs(struct acpi_device *device)
{
if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_fan_dir);
acpi_device_dir(device) = NULL;
}
return 0;
}
#else
static int acpi_fan_add_fs(struct acpi_device *device)
{
return 0;
}
static int acpi_fan_remove_fs(struct acpi_device *device)
{
return 0;
}
#endif
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Driver Interface Driver Interface
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -284,10 +166,6 @@ static int acpi_fan_add(struct acpi_device *device) ...@@ -284,10 +166,6 @@ static int acpi_fan_add(struct acpi_device *device)
dev_err(&device->dev, "Failed to create sysfs link " dev_err(&device->dev, "Failed to create sysfs link "
"'device'\n"); "'device'\n");
result = acpi_fan_add_fs(device);
if (result)
goto end;
printk(KERN_INFO PREFIX "%s [%s] (%s)\n", printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
acpi_device_name(device), acpi_device_bid(device), acpi_device_name(device), acpi_device_bid(device),
!device->power.state ? "on" : "off"); !device->power.state ? "on" : "off");
...@@ -303,7 +181,6 @@ static int acpi_fan_remove(struct acpi_device *device, int type) ...@@ -303,7 +181,6 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
if (!device || !cdev) if (!device || !cdev)
return -EINVAL; return -EINVAL;
acpi_fan_remove_fs(device);
sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
sysfs_remove_link(&cdev->device.kobj, "device"); sysfs_remove_link(&cdev->device.kobj, "device");
thermal_cooling_device_unregister(cdev); thermal_cooling_device_unregister(cdev);
...@@ -347,19 +224,9 @@ static int __init acpi_fan_init(void) ...@@ -347,19 +224,9 @@ static int __init acpi_fan_init(void)
{ {
int result = 0; int result = 0;
#ifdef CONFIG_ACPI_PROCFS
acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
if (!acpi_fan_dir)
return -ENODEV;
#endif
result = acpi_bus_register_driver(&acpi_fan_driver); result = acpi_bus_register_driver(&acpi_fan_driver);
if (result < 0) { if (result < 0)
#ifdef CONFIG_ACPI_PROCFS
remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
#endif
return -ENODEV; return -ENODEV;
}
return 0; return 0;
} }
...@@ -369,10 +236,6 @@ static void __exit acpi_fan_exit(void) ...@@ -369,10 +236,6 @@ static void __exit acpi_fan_exit(void)
acpi_bus_unregister_driver(&acpi_fan_driver); acpi_bus_unregister_driver(&acpi_fan_driver);
#ifdef CONFIG_ACPI_PROCFS
remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
#endif
return; return;
} }
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pci.h> #include <linux/pci.h>
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pci.h> #include <linux/pci.h>
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
......
...@@ -40,8 +40,10 @@ ...@@ -40,8 +40,10 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#ifdef CONFIG_ACPI_PROCFS
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#endif
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/cpuidle.h> #include <linux/cpuidle.h>
...@@ -244,6 +246,7 @@ static int acpi_processor_errata(struct acpi_processor *pr) ...@@ -244,6 +246,7 @@ static int acpi_processor_errata(struct acpi_processor *pr)
return result; return result;
} }
#ifdef CONFIG_ACPI_PROCFS
static struct proc_dir_entry *acpi_processor_dir = NULL; static struct proc_dir_entry *acpi_processor_dir = NULL;
static int __cpuinit acpi_processor_add_fs(struct acpi_device *device) static int __cpuinit acpi_processor_add_fs(struct acpi_device *device)
...@@ -280,7 +283,16 @@ static int acpi_processor_remove_fs(struct acpi_device *device) ...@@ -280,7 +283,16 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
return 0; return 0;
} }
#else
static inline int acpi_processor_add_fs(struct acpi_device *device)
{
return 0;
}
static inline int acpi_processor_remove_fs(struct acpi_device *device)
{
return 0;
}
#endif
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Driver Interface Driver Interface
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -842,9 +854,11 @@ static int __init acpi_processor_init(void) ...@@ -842,9 +854,11 @@ static int __init acpi_processor_init(void)
memset(&errata, 0, sizeof(errata)); memset(&errata, 0, sizeof(errata));
#ifdef CONFIG_ACPI_PROCFS
acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
if (!acpi_processor_dir) if (!acpi_processor_dir)
return -ENOMEM; return -ENOMEM;
#endif
if (!cpuidle_register_driver(&acpi_idle_driver)) { if (!cpuidle_register_driver(&acpi_idle_driver)) {
printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n",
...@@ -871,7 +885,9 @@ static int __init acpi_processor_init(void) ...@@ -871,7 +885,9 @@ static int __init acpi_processor_init(void)
out_cpuidle: out_cpuidle:
cpuidle_unregister_driver(&acpi_idle_driver); cpuidle_unregister_driver(&acpi_idle_driver);
#ifdef CONFIG_ACPI_PROCFS
remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
#endif
return result; return result;
} }
...@@ -891,7 +907,9 @@ static void __exit acpi_processor_exit(void) ...@@ -891,7 +907,9 @@ static void __exit acpi_processor_exit(void)
cpuidle_unregister_driver(&acpi_idle_driver); cpuidle_unregister_driver(&acpi_idle_driver);
#ifdef CONFIG_ACPI_PROCFS
remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
#endif
return; return;
} }
......
...@@ -32,8 +32,10 @@ ...@@ -32,8 +32,10 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#ifdef CONFIG_ACPI_PROCFS
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#endif
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -1214,6 +1216,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) ...@@ -1214,6 +1216,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
return result; return result;
} }
#ifdef CONFIG_ACPI_PROCFS
/* proc interface */ /* proc interface */
static int acpi_processor_throttling_seq_show(struct seq_file *seq, static int acpi_processor_throttling_seq_show(struct seq_file *seq,
void *offset) void *offset)
...@@ -1322,3 +1325,4 @@ const struct file_operations acpi_processor_throttling_fops = { ...@@ -1322,3 +1325,4 @@ const struct file_operations acpi_processor_throttling_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
#endif
...@@ -40,10 +40,7 @@ ...@@ -40,10 +40,7 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/delay.h> #include <linux/delay.h>
#ifdef CONFIG_ACPI_SYSFS_POWER
#include <linux/power_supply.h> #include <linux/power_supply.h>
#endif
#include "sbshc.h" #include "sbshc.h"
...@@ -85,9 +82,7 @@ static const struct acpi_device_id sbs_device_ids[] = { ...@@ -85,9 +82,7 @@ static const struct acpi_device_id sbs_device_ids[] = {
MODULE_DEVICE_TABLE(acpi, sbs_device_ids); MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
struct acpi_battery { struct acpi_battery {
#ifdef CONFIG_ACPI_SYSFS_POWER
struct power_supply bat; struct power_supply bat;
#endif
struct acpi_sbs *sbs; struct acpi_sbs *sbs;
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
struct proc_dir_entry *proc_entry; struct proc_dir_entry *proc_entry;
...@@ -120,9 +115,7 @@ struct acpi_battery { ...@@ -120,9 +115,7 @@ struct acpi_battery {
#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
struct acpi_sbs { struct acpi_sbs {
#ifdef CONFIG_ACPI_SYSFS_POWER
struct power_supply charger; struct power_supply charger;
#endif
struct acpi_device *device; struct acpi_device *device;
struct acpi_smb_hc *hc; struct acpi_smb_hc *hc;
struct mutex lock; struct mutex lock;
...@@ -166,7 +159,6 @@ static inline int acpi_battery_scale(struct acpi_battery *battery) ...@@ -166,7 +159,6 @@ static inline int acpi_battery_scale(struct acpi_battery *battery)
acpi_battery_ipscale(battery); acpi_battery_ipscale(battery);
} }
#ifdef CONFIG_ACPI_SYSFS_POWER
static int sbs_get_ac_property(struct power_supply *psy, static int sbs_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)
...@@ -313,7 +305,6 @@ static enum power_supply_property sbs_energy_battery_props[] = { ...@@ -313,7 +305,6 @@ static enum power_supply_property sbs_energy_battery_props[] = {
POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_MANUFACTURER,
}; };
#endif
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Smart Battery System Management Smart Battery System Management
...@@ -449,7 +440,6 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) ...@@ -449,7 +440,6 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs)
return result; return result;
} }
#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)
...@@ -479,7 +469,6 @@ static struct device_attribute alarm_attr = { ...@@ -479,7 +469,6 @@ static struct device_attribute alarm_attr = {
.show = acpi_battery_alarm_show, .show = acpi_battery_alarm_show,
.store = acpi_battery_alarm_store, .store = acpi_battery_alarm_store,
}; };
#endif
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
FS Interface (/proc/acpi) FS Interface (/proc/acpi)
...@@ -798,7 +787,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) ...@@ -798,7 +787,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
&acpi_battery_state_fops, &acpi_battery_alarm_fops, &acpi_battery_state_fops, &acpi_battery_alarm_fops,
battery); battery);
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
battery->bat.name = battery->name; battery->bat.name = battery->name;
battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
if (!acpi_battery_mode(battery)) { if (!acpi_battery_mode(battery)) {
...@@ -819,7 +807,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) ...@@ -819,7 +807,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
goto end; goto end;
battery->have_sysfs_alarm = 1; battery->have_sysfs_alarm = 1;
end: end:
#endif
printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
battery->name, battery->present ? "present" : "absent"); battery->name, battery->present ? "present" : "absent");
...@@ -828,17 +815,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) ...@@ -828,17 +815,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
static void acpi_battery_remove(struct acpi_sbs *sbs, int id) static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
{ {
#if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER)
struct acpi_battery *battery = &sbs->battery[id]; struct acpi_battery *battery = &sbs->battery[id];
#endif
#ifdef CONFIG_ACPI_SYSFS_POWER
if (battery->bat.dev) { if (battery->bat.dev) {
if (battery->have_sysfs_alarm) if (battery->have_sysfs_alarm)
device_remove_file(battery->bat.dev, &alarm_attr); device_remove_file(battery->bat.dev, &alarm_attr);
power_supply_unregister(&battery->bat); power_supply_unregister(&battery->bat);
} }
#endif
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
if (battery->proc_entry) if (battery->proc_entry)
acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
...@@ -859,14 +842,12 @@ static int acpi_charger_add(struct acpi_sbs *sbs) ...@@ -859,14 +842,12 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
if (result) if (result)
goto end; goto end;
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
sbs->charger.name = "sbs-charger"; sbs->charger.name = "sbs-charger";
sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; sbs->charger.type = POWER_SUPPLY_TYPE_MAINS;
sbs->charger.properties = sbs_ac_props; sbs->charger.properties = sbs_ac_props;
sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props);
sbs->charger.get_property = sbs_get_ac_property; sbs->charger.get_property = sbs_get_ac_property;
power_supply_register(&sbs->device->dev, &sbs->charger); power_supply_register(&sbs->device->dev, &sbs->charger);
#endif
printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n",
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line");
...@@ -876,10 +857,8 @@ static int acpi_charger_add(struct acpi_sbs *sbs) ...@@ -876,10 +857,8 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
static void acpi_charger_remove(struct acpi_sbs *sbs) static void acpi_charger_remove(struct acpi_sbs *sbs)
{ {
#ifdef CONFIG_ACPI_SYSFS_POWER
if (sbs->charger.dev) if (sbs->charger.dev)
power_supply_unregister(&sbs->charger); power_supply_unregister(&sbs->charger);
#endif
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
if (sbs->charger_entry) if (sbs->charger_entry)
acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
...@@ -900,9 +879,7 @@ static void acpi_sbs_callback(void *context) ...@@ -900,9 +879,7 @@ static void acpi_sbs_callback(void *context)
ACPI_SBS_NOTIFY_STATUS, ACPI_SBS_NOTIFY_STATUS,
sbs->charger_present); sbs->charger_present);
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE);
#endif
} }
if (sbs->manager_present) { if (sbs->manager_present) {
for (id = 0; id < MAX_SBS_BAT; ++id) { for (id = 0; id < MAX_SBS_BAT; ++id) {
...@@ -919,9 +896,7 @@ static void acpi_sbs_callback(void *context) ...@@ -919,9 +896,7 @@ static void acpi_sbs_callback(void *context)
ACPI_SBS_NOTIFY_STATUS, ACPI_SBS_NOTIFY_STATUS,
bat->present); bat->present);
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE);
#endif
} }
} }
} }
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment