ACPI: Split out control for /proc/acpi entries from battery, ac, and sbs.
Introduce new ACPI_PROCFS_POWER (default Yes) config option and move procfs code in battery, ac, and sbs drivers under it. This is done to allow ACPI_PROCFS to be default No. Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
committed by
Len Brown
parent
2ffbb8377c
commit
fdcedbba2f
@@ -27,7 +27,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/types.h>
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#endif
|
||||
@@ -51,7 +51,7 @@ MODULE_AUTHOR("Paul Diefenbaugh");
|
||||
MODULE_DESCRIPTION("ACPI AC Adapter Driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
extern struct proc_dir_entry *acpi_lock_ac_dir(void);
|
||||
extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
|
||||
static int acpi_ac_open_fs(struct inode *inode, struct file *file);
|
||||
@@ -86,7 +86,7 @@ struct acpi_ac {
|
||||
|
||||
#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger);
|
||||
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
static const struct file_operations acpi_ac_fops = {
|
||||
.open = acpi_ac_open_fs,
|
||||
.read = seq_read,
|
||||
@@ -136,7 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/proc)
|
||||
-------------------------------------------------------------------------- */
|
||||
@@ -275,7 +275,7 @@ static int acpi_ac_add(struct acpi_device *device)
|
||||
if (result)
|
||||
goto end;
|
||||
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
result = acpi_ac_add_fs(device);
|
||||
#endif
|
||||
if (result)
|
||||
@@ -300,7 +300,7 @@ static int acpi_ac_add(struct acpi_device *device)
|
||||
|
||||
end:
|
||||
if (result) {
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
acpi_ac_remove_fs(device);
|
||||
#endif
|
||||
kfree(ac);
|
||||
@@ -339,7 +339,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
|
||||
ACPI_ALL_NOTIFY, acpi_ac_notify);
|
||||
if (ac->charger.dev)
|
||||
power_supply_unregister(&ac->charger);
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
acpi_ac_remove_fs(device);
|
||||
#endif
|
||||
|
||||
@@ -355,7 +355,7 @@ static int __init acpi_ac_init(void)
|
||||
if (acpi_disabled)
|
||||
return -ENODEV;
|
||||
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
acpi_ac_dir = acpi_lock_ac_dir();
|
||||
if (!acpi_ac_dir)
|
||||
return -ENODEV;
|
||||
@@ -363,7 +363,7 @@ static int __init acpi_ac_init(void)
|
||||
|
||||
result = acpi_bus_register_driver(&acpi_ac_driver);
|
||||
if (result < 0) {
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
acpi_unlock_ac_dir(acpi_ac_dir);
|
||||
#endif
|
||||
return -ENODEV;
|
||||
@@ -377,7 +377,7 @@ static void __exit acpi_ac_exit(void)
|
||||
|
||||
acpi_bus_unregister_driver(&acpi_ac_driver);
|
||||
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||
acpi_unlock_ac_dir(acpi_ac_dir);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user