Commit 2168e7bc authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] fix video module unload oops

Signed-off-by: default avatarLuming Yu <luming.yu@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent a021cea7
...@@ -126,7 +126,7 @@ struct acpi_video_bus { ...@@ -126,7 +126,7 @@ struct acpi_video_bus {
struct acpi_video_bus_flags flags; struct acpi_video_bus_flags flags;
struct semaphore sem; struct semaphore sem;
struct list_head video_device_list; struct list_head video_device_list;
struct proc_dir_entry *dir; struct proc_dir_entry *dir;
}; };
struct acpi_video_device_flags { struct acpi_video_device_flags {
...@@ -932,6 +932,7 @@ acpi_video_device_add_fs ( ...@@ -932,6 +932,7 @@ acpi_video_device_add_fs (
vid_dev->video->dir); vid_dev->video->dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_device_dir(device)->owner = THIS_MODULE;
} }
/* 'info' [R] */ /* 'info' [R] */
...@@ -942,6 +943,7 @@ acpi_video_device_add_fs ( ...@@ -942,6 +943,7 @@ acpi_video_device_add_fs (
else { else {
entry->proc_fops = &acpi_video_device_info_fops; entry->proc_fops = &acpi_video_device_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'state' [R/W] */ /* 'state' [R/W] */
...@@ -953,6 +955,7 @@ acpi_video_device_add_fs ( ...@@ -953,6 +955,7 @@ acpi_video_device_add_fs (
entry->proc_fops = &acpi_video_device_state_fops; entry->proc_fops = &acpi_video_device_state_fops;
entry->proc_fops->write = acpi_video_device_write_state; entry->proc_fops->write = acpi_video_device_write_state;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'brightness' [R/W] */ /* 'brightness' [R/W] */
...@@ -964,6 +967,7 @@ acpi_video_device_add_fs ( ...@@ -964,6 +967,7 @@ acpi_video_device_add_fs (
entry->proc_fops = &acpi_video_device_brightness_fops; entry->proc_fops = &acpi_video_device_brightness_fops;
entry->proc_fops->write = acpi_video_device_write_brightness; entry->proc_fops->write = acpi_video_device_write_brightness;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'EDID' [R] */ /* 'EDID' [R] */
...@@ -974,6 +978,7 @@ acpi_video_device_add_fs ( ...@@ -974,6 +978,7 @@ acpi_video_device_add_fs (
else { else {
entry->proc_fops = &acpi_video_device_EDID_fops; entry->proc_fops = &acpi_video_device_EDID_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
return_VALUE(0); return_VALUE(0);
...@@ -991,7 +996,12 @@ acpi_video_device_remove_fs ( ...@@ -991,7 +996,12 @@ acpi_video_device_remove_fs (
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); remove_proc_entry("info", acpi_device_dir(device));
remove_proc_entry("state", acpi_device_dir(device));
remove_proc_entry("brightness", acpi_device_dir(device));
remove_proc_entry("EDID", acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device),
vid_dev->video->dir);
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
...@@ -1256,10 +1266,10 @@ acpi_video_bus_add_fs ( ...@@ -1256,10 +1266,10 @@ acpi_video_bus_add_fs (
acpi_video_dir); acpi_video_dir);
if (!acpi_device_dir(device)) if (!acpi_device_dir(device))
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
video->dir = acpi_device_dir(device);
acpi_device_dir(device)->owner = THIS_MODULE;
} }
video->dir = acpi_device_dir(device);
/* 'info' [R] */ /* 'info' [R] */
entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
if (!entry) if (!entry)
...@@ -1267,6 +1277,7 @@ acpi_video_bus_add_fs ( ...@@ -1267,6 +1277,7 @@ acpi_video_bus_add_fs (
else { else {
entry->proc_fops = &acpi_video_bus_info_fops; entry->proc_fops = &acpi_video_bus_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'ROM' [R] */ /* 'ROM' [R] */
...@@ -1276,6 +1287,7 @@ acpi_video_bus_add_fs ( ...@@ -1276,6 +1287,7 @@ acpi_video_bus_add_fs (
else { else {
entry->proc_fops = &acpi_video_bus_ROM_fops; entry->proc_fops = &acpi_video_bus_ROM_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'POST_info' [R] */ /* 'POST_info' [R] */
...@@ -1285,6 +1297,7 @@ acpi_video_bus_add_fs ( ...@@ -1285,6 +1297,7 @@ acpi_video_bus_add_fs (
else { else {
entry->proc_fops = &acpi_video_bus_POST_info_fops; entry->proc_fops = &acpi_video_bus_POST_info_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'POST' [R/W] */ /* 'POST' [R/W] */
...@@ -1295,6 +1308,7 @@ acpi_video_bus_add_fs ( ...@@ -1295,6 +1308,7 @@ acpi_video_bus_add_fs (
entry->proc_fops = &acpi_video_bus_POST_fops; entry->proc_fops = &acpi_video_bus_POST_fops;
entry->proc_fops->write = acpi_video_bus_write_POST; entry->proc_fops->write = acpi_video_bus_write_POST;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
/* 'DOS' [R/W] */ /* 'DOS' [R/W] */
...@@ -1305,6 +1319,7 @@ acpi_video_bus_add_fs ( ...@@ -1305,6 +1319,7 @@ acpi_video_bus_add_fs (
entry->proc_fops = &acpi_video_bus_DOS_fops; entry->proc_fops = &acpi_video_bus_DOS_fops;
entry->proc_fops->write = acpi_video_bus_write_DOS; entry->proc_fops->write = acpi_video_bus_write_DOS;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
} }
return_VALUE(0); return_VALUE(0);
...@@ -1314,10 +1329,20 @@ static int ...@@ -1314,10 +1329,20 @@ static int
acpi_video_bus_remove_fs ( acpi_video_bus_remove_fs (
struct acpi_device *device) struct acpi_device *device)
{ {
struct acpi_video_bus *video;
ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs"); ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs");
video = (struct acpi_video_bus *) acpi_driver_data(device);
if (acpi_device_dir(device)) { if (acpi_device_dir(device)) {
remove_proc_entry(acpi_device_bid(device), acpi_video_dir); remove_proc_entry("info", acpi_device_dir(device));
remove_proc_entry("ROM", acpi_device_dir(device));
remove_proc_entry("POST_info", acpi_device_dir(device));
remove_proc_entry("POST", acpi_device_dir(device));
remove_proc_entry("DOS", acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device),
acpi_video_dir);
acpi_device_dir(device) = NULL; acpi_device_dir(device) = NULL;
} }
...@@ -1936,6 +1961,7 @@ acpi_video_init (void) ...@@ -1936,6 +1961,7 @@ acpi_video_init (void)
acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
if (!acpi_video_dir) if (!acpi_video_dir)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
acpi_video_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_video_bus); result = acpi_bus_register_driver(&acpi_video_bus);
if (result < 0) { if (result < 0) {
......
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