Skip to content

Commit

Permalink
Merge branch 'procfs-cleanup' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Len Brown committed Jan 12, 2011
2 parents 6d1f23f + 6d855fc commit c1b2dab
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 193 deletions.
11 changes: 11 additions & 0 deletions Documentation/feature-removal-schedule.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,17 @@ Who: Zhang Rui <rui.zhang@intel.com>

---------------------------

What: CONFIG_ACPI_PROCFS_POWER
When: 2.6.39
Why: sysfs I/F for ACPI power devices, including AC and Battery,
has been working in upstream kenrel since 2.6.24, Sep 2007.
In 2.6.37, we make the sysfs I/F always built in and this option
disabled by default.
Remove this option and the ACPI power procfs interface in 2.6.39.
Who: Zhang Rui <rui.zhang@intel.com>

---------------------------

What: /proc/acpi/button
When: August 2007
Why: /proc/acpi/button has been replaced by events to the input layer
Expand Down
6 changes: 2 additions & 4 deletions drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ config ACPI_PROCFS
they have been replaced by functions in /sys.
The deprecated files (and their replacements) include:

/proc/acpi/processor/*/throttling (/sys/class/thermal/
cooling_device*/*)
/proc/acpi/video/*/brightness (/sys/class/backlight/)
/proc/acpi/thermal_zone/*/* (/sys/class/thermal/)
This option has no effect on /proc/acpi/ files
and functions which do not yet exist in /sys.

Expand All @@ -74,6 +70,8 @@ config ACPI_PROCFS_POWER
/proc/acpi/ac_adapter/* (sys/class/power_supply/*)
This option has no effect on /proc/acpi/ directories
and functions, which do not yet exist in /sys
This option, together with the proc directories, will be
deleted in 2.6.39.

Say N to delete power /proc/acpi/ directories that have moved to /sys/

Expand Down
3 changes: 2 additions & 1 deletion drivers/acpi/ac.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ static int acpi_ac_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;


printk(KERN_WARNING PREFIX "Deprecated procfs I/F for AC is loaded,"
" please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_ac_dir);
Expand Down
2 changes: 2 additions & 0 deletions drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,8 @@ static int acpi_battery_add_fs(struct acpi_device *device)
struct proc_dir_entry *entry = NULL;
int i;

printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded,"
" please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_battery_dir);
Expand Down
75 changes: 1 addition & 74 deletions drivers/acpi/processor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
#include <linux/pm.h>
#include <linux/cpufreq.h>
#include <linux/cpu.h>
#ifdef CONFIG_ACPI_PROCFS
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#endif
#include <linux/dmi.h>
#include <linux/moduleparam.h>
#include <linux/cpuidle.h>
Expand Down Expand Up @@ -246,53 +242,6 @@ static int acpi_processor_errata(struct acpi_processor *pr)
return result;
}

#ifdef CONFIG_ACPI_PROCFS
static struct proc_dir_entry *acpi_processor_dir = NULL;

static int __cpuinit acpi_processor_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;


if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_processor_dir);
if (!acpi_device_dir(device))
return -ENODEV;
}

/* 'throttling' [R/W] */
entry = proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING,
S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device),
&acpi_processor_throttling_fops,
acpi_driver_data(device));
if (!entry)
return -EIO;
return 0;
}
static int acpi_processor_remove_fs(struct acpi_device *device)
{

if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING,
acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_processor_dir);
acpi_device_dir(device) = NULL;
}

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
-------------------------------------------------------------------------- */
Expand Down Expand Up @@ -537,14 +486,10 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)

per_cpu(processors, pr->id) = pr;

result = acpi_processor_add_fs(device);
if (result)
goto err_free_cpumask;

sysdev = get_cpu_sysdev(pr->id);
if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) {
result = -EFAULT;
goto err_remove_fs;
goto err_free_cpumask;
}

#ifdef CONFIG_CPU_FREQ
Expand Down Expand Up @@ -590,8 +535,6 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
thermal_cooling_device_unregister(pr->cdev);
err_power_exit:
acpi_processor_power_exit(pr, device);
err_remove_fs:
acpi_processor_remove_fs(device);
err_free_cpumask:
free_cpumask_var(pr->throttling.shared_cpu_map);

Expand Down Expand Up @@ -620,8 +563,6 @@ static int acpi_processor_remove(struct acpi_device *device, int type)

sysfs_remove_link(&device->dev.kobj, "sysdev");

acpi_processor_remove_fs(device);

if (pr->cdev) {
sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
sysfs_remove_link(&pr->cdev->device.kobj, "device");
Expand Down Expand Up @@ -854,12 +795,6 @@ static int __init acpi_processor_init(void)

memset(&errata, 0, sizeof(errata));

#ifdef CONFIG_ACPI_PROCFS
acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
if (!acpi_processor_dir)
return -ENOMEM;
#endif

if (!cpuidle_register_driver(&acpi_idle_driver)) {
printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n",
acpi_idle_driver.name);
Expand All @@ -885,10 +820,6 @@ static int __init acpi_processor_init(void)
out_cpuidle:
cpuidle_unregister_driver(&acpi_idle_driver);

#ifdef CONFIG_ACPI_PROCFS
remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
#endif

return result;
}

Expand All @@ -907,10 +838,6 @@ static void __exit acpi_processor_exit(void)

cpuidle_unregister_driver(&acpi_idle_driver);

#ifdef CONFIG_ACPI_PROCFS
remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
#endif

return;
}

Expand Down
114 changes: 0 additions & 114 deletions drivers/acpi/processor_throttling.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/cpufreq.h>
#ifdef CONFIG_ACPI_PROCFS
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#endif

#include <asm/io.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -1216,113 +1212,3 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
return result;
}

#ifdef CONFIG_ACPI_PROCFS
/* proc interface */
static int acpi_processor_throttling_seq_show(struct seq_file *seq,
void *offset)
{
struct acpi_processor *pr = seq->private;
int i = 0;
int result = 0;

if (!pr)
goto end;

if (!(pr->throttling.state_count > 0)) {
seq_puts(seq, "<not supported>\n");
goto end;
}

result = acpi_processor_get_throttling(pr);

if (result) {
seq_puts(seq,
"Could not determine current throttling state.\n");
goto end;
}

seq_printf(seq, "state count: %d\n"
"active state: T%d\n"
"state available: T%d to T%d\n",
pr->throttling.state_count, pr->throttling.state,
pr->throttling_platform_limit,
pr->throttling.state_count - 1);

seq_puts(seq, "states:\n");
if (pr->throttling.acpi_processor_get_throttling ==
acpi_processor_get_throttling_fadt) {
for (i = 0; i < pr->throttling.state_count; i++)
seq_printf(seq, " %cT%d: %02d%%\n",
(i == pr->throttling.state ? '*' : ' '), i,
(pr->throttling.states[i].performance ? pr->
throttling.states[i].performance / 10 : 0));
} else {
for (i = 0; i < pr->throttling.state_count; i++)
seq_printf(seq, " %cT%d: %02d%%\n",
(i == pr->throttling.state ? '*' : ' '), i,
(int)pr->throttling.states_tss[i].
freqpercentage);
}

end:
return 0;
}

static int acpi_processor_throttling_open_fs(struct inode *inode,
struct file *file)
{
return single_open(file, acpi_processor_throttling_seq_show,
PDE(inode)->data);
}

static ssize_t acpi_processor_write_throttling(struct file *file,
const char __user * buffer,
size_t count, loff_t * data)
{
int result = 0;
struct seq_file *m = file->private_data;
struct acpi_processor *pr = m->private;
char state_string[5] = "";
char *charp = NULL;
size_t state_val = 0;
char tmpbuf[5] = "";

if (!pr || (count > sizeof(state_string) - 1))
return -EINVAL;

if (copy_from_user(state_string, buffer, count))
return -EFAULT;

state_string[count] = '\0';
if ((count > 0) && (state_string[count-1] == '\n'))
state_string[count-1] = '\0';

charp = state_string;
if ((state_string[0] == 't') || (state_string[0] == 'T'))
charp++;

state_val = simple_strtoul(charp, NULL, 0);
if (state_val >= pr->throttling.state_count)
return -EINVAL;

snprintf(tmpbuf, 5, "%zu", state_val);

if (strcmp(tmpbuf, charp) != 0)
return -EINVAL;

result = acpi_processor_set_throttling(pr, state_val, false);
if (result)
return result;

return count;
}

const struct file_operations acpi_processor_throttling_fops = {
.owner = THIS_MODULE,
.open = acpi_processor_throttling_open_fs,
.read = seq_read,
.write = acpi_processor_write_throttling,
.llseek = seq_lseek,
.release = single_release,
};
#endif
2 changes: 2 additions & 0 deletions drivers/acpi/sbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
const struct file_operations *state_fops,
const struct file_operations *alarm_fops, void *data)
{
printk(KERN_WARNING PREFIX "Deprecated procfs I/F for SBS is loaded,"
" please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
if (!*dir) {
*dir = proc_mkdir(dir_name, parent_dir);
if (!*dir) {
Expand Down

0 comments on commit c1b2dab

Please sign in to comment.