Commit 9028100e authored by Len Brown's avatar Len Brown

[ACPI] remove /proc files before unloading modules

from Sau Dan Lee, Zhenyu Wang
http://bugzilla.kernel.org/show_bug.cgi?id=2705
parent d05aa0e7
......@@ -185,6 +185,9 @@ acpi_ac_remove_fs (
ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_AC_FILE_STATE,
acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
acpi_device_dir(device) = NULL;
}
......
......@@ -863,6 +863,29 @@ static int __init asus_hotk_add_fs(struct acpi_device *device)
return 0;
}
static int asus_hotk_remove_fs(struct acpi_device* device)
{
struct asus_hotk* hotk = acpi_driver_data(device);
if(acpi_device_dir(device)){
remove_proc_entry(PROC_INFO,acpi_device_dir(device));
if (hotk->methods->mt_wled)
remove_proc_entry(PROC_WLED,acpi_device_dir(device));
if (hotk->methods->mt_mled)
remove_proc_entry(PROC_MLED,acpi_device_dir(device));
if (hotk->methods->mt_tled)
remove_proc_entry(PROC_TLED,acpi_device_dir(device));
if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status)
remove_proc_entry(PROC_LCD, acpi_device_dir(device));
if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || (hotk->methods->brightness_get && hotk->methods->brightness_get))
remove_proc_entry(PROC_BRN, acpi_device_dir(device));
if (hotk->methods->display_set)
remove_proc_entry(PROC_DISP, acpi_device_dir(device));
}
return 0;
}
static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
{
......@@ -1111,7 +1134,6 @@ static int __init asus_hotk_add(struct acpi_device *device)
return(result);
}
static int asus_hotk_remove(struct acpi_device *device, int type)
{
acpi_status status = 0;
......@@ -1127,6 +1149,8 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
if (ACPI_FAILURE(status))
printk(KERN_ERR "Asus ACPI: Error removing notify handler\n");
asus_hotk_remove_fs(device);
kfree(hotk);
return(0);
......
......@@ -679,6 +679,13 @@ acpi_battery_remove_fs (
ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_BATTERY_FILE_ALARM,
acpi_device_dir(device));
remove_proc_entry(ACPI_BATTERY_FILE_STATUS,
acpi_device_dir(device));
remove_proc_entry(ACPI_BATTERY_FILE_INFO,
acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
acpi_device_dir(device) = NULL;
}
......
......@@ -238,6 +238,16 @@ acpi_button_remove_fs (
button = acpi_driver_data(device);
if (acpi_device_dir(device)) {
if (button->type == ACPI_BUTTON_TYPE_LID)
remove_proc_entry(ACPI_BUTTON_FILE_STATE,
acpi_device_dir(device));
remove_proc_entry(ACPI_BUTTON_FILE_INFO,
acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device),
acpi_device_dir(device)->parent);
switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
case ACPI_BUTTON_TYPE_POWERF:
......
......@@ -548,6 +548,12 @@ acpi_ec_remove_fs (
{
ACPI_FUNCTION_TRACE("acpi_ec_remove_fs");
if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_ec_dir);
acpi_device_dir(device) = NULL;
}
return_VALUE(0);
}
......
......@@ -185,6 +185,8 @@ acpi_fan_remove_fs (
ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
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;
}
......
......@@ -482,6 +482,8 @@ acpi_power_remove_fs (
ACPI_FUNCTION_TRACE("acpi_power_remove_fs");
if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_POWER_FILE_STATUS,
acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_power_dir);
acpi_device_dir(device) = NULL;
}
......
......@@ -1139,6 +1139,16 @@ acpi_thermal_remove_fs (
ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs");
if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ,
acpi_device_dir(device));
remove_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE,
acpi_device_dir(device));
remove_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS,
acpi_device_dir(device));
remove_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE,
acpi_device_dir(device));
remove_proc_entry(ACPI_THERMAL_FILE_STATE,
acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_thermal_dir);
acpi_device_dir(device) = NULL;
}
......
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