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>
Этот коммит содержится в:

коммит произвёл
Len Brown

родитель
cd07202cc8
Коммит
1b3d4c3b9a
@@ -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: "
|
||||
|
||||
@@ -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;
|
||||
@@ -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))
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
{
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -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;
|
||||
|
Ссылка в новой задаче
Block a user