ACPI ac/battery/sbs: sysfs I/F always built in, procfs I/F disabled by default
ACPI AC/Battery/SBS driver has different kernel option for procfs and sysfs I/F. This patch, 1. Change CONFIG_ACPI_PROCFS_POWER to 'n' by default so that we can remove it in the next release or two. 2. Remove CONFIG_ACPI_SYSFS_POWER and always build in the sysfs I/F of these drivers. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
@@ -40,10 +40,7 @@
|
||||
#include <linux/timer.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
#include <linux/power_supply.h>
|
||||
#endif
|
||||
|
||||
#include "sbshc.h"
|
||||
|
||||
@@ -85,9 +82,7 @@ static const struct acpi_device_id sbs_device_ids[] = {
|
||||
MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
|
||||
|
||||
struct acpi_battery {
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
struct power_supply bat;
|
||||
#endif
|
||||
struct acpi_sbs *sbs;
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
struct proc_dir_entry *proc_entry;
|
||||
@@ -120,9 +115,7 @@ struct acpi_battery {
|
||||
#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
|
||||
|
||||
struct acpi_sbs {
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
struct power_supply charger;
|
||||
#endif
|
||||
struct acpi_device *device;
|
||||
struct acpi_smb_hc *hc;
|
||||
struct mutex lock;
|
||||
@@ -166,7 +159,6 @@ static inline int acpi_battery_scale(struct acpi_battery *battery)
|
||||
acpi_battery_ipscale(battery);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
static int sbs_get_ac_property(struct power_supply *psy,
|
||||
enum power_supply_property psp,
|
||||
union power_supply_propval *val)
|
||||
@@ -313,7 +305,6 @@ static enum power_supply_property sbs_energy_battery_props[] = {
|
||||
POWER_SUPPLY_PROP_MANUFACTURER,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Smart Battery System Management
|
||||
@@ -449,7 +440,6 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
static ssize_t acpi_battery_alarm_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
@@ -479,7 +469,6 @@ static struct device_attribute alarm_attr = {
|
||||
.show = acpi_battery_alarm_show,
|
||||
.store = acpi_battery_alarm_store,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/proc/acpi)
|
||||
@@ -798,7 +787,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
|
||||
&acpi_battery_state_fops, &acpi_battery_alarm_fops,
|
||||
battery);
|
||||
#endif
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
battery->bat.name = battery->name;
|
||||
battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
|
||||
if (!acpi_battery_mode(battery)) {
|
||||
@@ -819,7 +807,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
|
||||
goto end;
|
||||
battery->have_sysfs_alarm = 1;
|
||||
end:
|
||||
#endif
|
||||
printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
|
||||
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
|
||||
battery->name, battery->present ? "present" : "absent");
|
||||
@@ -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)
|
||||
{
|
||||
#if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER)
|
||||
struct acpi_battery *battery = &sbs->battery[id];
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
if (battery->bat.dev) {
|
||||
if (battery->have_sysfs_alarm)
|
||||
device_remove_file(battery->bat.dev, &alarm_attr);
|
||||
power_supply_unregister(&battery->bat);
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
if (battery->proc_entry)
|
||||
acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
|
||||
@@ -859,14 +842,12 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
|
||||
if (result)
|
||||
goto end;
|
||||
#endif
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
sbs->charger.name = "sbs-charger";
|
||||
sbs->charger.type = POWER_SUPPLY_TYPE_MAINS;
|
||||
sbs->charger.properties = sbs_ac_props;
|
||||
sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props);
|
||||
sbs->charger.get_property = sbs_get_ac_property;
|
||||
power_supply_register(&sbs->device->dev, &sbs->charger);
|
||||
#endif
|
||||
printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n",
|
||||
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
|
||||
ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line");
|
||||
@@ -876,10 +857,8 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
|
||||
|
||||
static void acpi_charger_remove(struct acpi_sbs *sbs)
|
||||
{
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
if (sbs->charger.dev)
|
||||
power_supply_unregister(&sbs->charger);
|
||||
#endif
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
if (sbs->charger_entry)
|
||||
acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
|
||||
@@ -900,9 +879,7 @@ static void acpi_sbs_callback(void *context)
|
||||
ACPI_SBS_NOTIFY_STATUS,
|
||||
sbs->charger_present);
|
||||
#endif
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE);
|
||||
#endif
|
||||
}
|
||||
if (sbs->manager_present) {
|
||||
for (id = 0; id < MAX_SBS_BAT; ++id) {
|
||||
@@ -919,9 +896,7 @@ static void acpi_sbs_callback(void *context)
|
||||
ACPI_SBS_NOTIFY_STATUS,
|
||||
bat->present);
|
||||
#endif
|
||||
#ifdef CONFIG_ACPI_SYSFS_POWER
|
||||
kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user