aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-04-29 04:02:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:22 -0400
commitcf7acfab032ff262f42954328cdfd20a5d9aaaac (patch)
tree231698d72d4508f3b26f606f18ef844387ec43e5
parent667471386d4068e75a6a55b615701ced61eb6333 (diff)
acpi: use non-racy method for proc entries creation
Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data be setup before gluing PDE to main tree. Add correct ->owner to proc_fops to fix reading/module unloading race. Signed-off-by: Denis V. Lunev <den@openvz.org> Cc: Len Brown <lenb@kernel.org> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/acpi/ac.c12
-rw-r--r--drivers/acpi/battery.c12
-rw-r--r--drivers/acpi/button.c24
-rw-r--r--drivers/acpi/ec.c11
-rw-r--r--drivers/acpi/event.c8
-rw-r--r--drivers/acpi/fan.c14
-rw-r--r--drivers/acpi/power.c11
-rw-r--r--drivers/acpi/processor_core.c39
-rw-r--r--drivers/acpi/processor_idle.c13
-rw-r--r--drivers/acpi/processor_perflib.c13
-rw-r--r--drivers/acpi/processor_thermal.c1
-rw-r--r--drivers/acpi/processor_throttling.c1
-rw-r--r--drivers/acpi/sbs.c35
-rw-r--r--drivers/acpi/sleep/proc.c26
-rw-r--r--drivers/acpi/system.c27
-rw-r--r--drivers/acpi/thermal.c67
-rw-r--r--drivers/acpi/video.c112
17 files changed, 162 insertions, 264 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 43a95e5640de..5b73f6a2cd86 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -92,6 +92,7 @@ struct acpi_ac {
92 92
93#ifdef CONFIG_ACPI_PROCFS_POWER 93#ifdef CONFIG_ACPI_PROCFS_POWER
94static const struct file_operations acpi_ac_fops = { 94static const struct file_operations acpi_ac_fops = {
95 .owner = THIS_MODULE,
95 .open = acpi_ac_open_fs, 96 .open = acpi_ac_open_fs,
96 .read = seq_read, 97 .read = seq_read,
97 .llseek = seq_lseek, 98 .llseek = seq_lseek,
@@ -195,16 +196,11 @@ static int acpi_ac_add_fs(struct acpi_device *device)
195 } 196 }
196 197
197 /* 'state' [R] */ 198 /* 'state' [R] */
198 entry = create_proc_entry(ACPI_AC_FILE_STATE, 199 entry = proc_create_data(ACPI_AC_FILE_STATE,
199 S_IRUGO, acpi_device_dir(device)); 200 S_IRUGO, acpi_device_dir(device),
201 &acpi_ac_fops, acpi_driver_data(device));
200 if (!entry) 202 if (!entry)
201 return -ENODEV; 203 return -ENODEV;
202 else {
203 entry->proc_fops = &acpi_ac_fops;
204 entry->data = acpi_driver_data(device);
205 entry->owner = THIS_MODULE;
206 }
207
208 return 0; 204 return 0;
209} 205}
210 206
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index d5729d5dc190..b1c723f9f58d 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -741,15 +741,13 @@ static int acpi_battery_add_fs(struct acpi_device *device)
741 } 741 }
742 742
743 for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { 743 for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) {
744 entry = create_proc_entry(acpi_battery_file[i].name, 744 entry = proc_create_data(acpi_battery_file[i].name,
745 acpi_battery_file[i].mode, acpi_device_dir(device)); 745 acpi_battery_file[i].mode,
746 acpi_device_dir(device),
747 &acpi_battery_file[i].ops,
748 acpi_driver_data(device));
746 if (!entry) 749 if (!entry)
747 return -ENODEV; 750 return -ENODEV;
748 else {
749 entry->proc_fops = &acpi_battery_file[i].ops;
750 entry->data = acpi_driver_data(device);
751 entry->owner = THIS_MODULE;
752 }
753 } 751 }
754 return 0; 752 return 0;
755} 753}
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 6c5da83cdb68..1dfec413588c 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -102,6 +102,7 @@ struct acpi_button {
102}; 102};
103 103
104static const struct file_operations acpi_button_info_fops = { 104static const struct file_operations acpi_button_info_fops = {
105 .owner = THIS_MODULE,
105 .open = acpi_button_info_open_fs, 106 .open = acpi_button_info_open_fs,
106 .read = seq_read, 107 .read = seq_read,
107 .llseek = seq_lseek, 108 .llseek = seq_lseek,
@@ -109,6 +110,7 @@ static const struct file_operations acpi_button_info_fops = {
109}; 110};
110 111
111static const struct file_operations acpi_button_state_fops = { 112static const struct file_operations acpi_button_state_fops = {
113 .owner = THIS_MODULE,
112 .open = acpi_button_state_open_fs, 114 .open = acpi_button_state_open_fs,
113 .read = seq_read, 115 .read = seq_read,
114 .llseek = seq_lseek, 116 .llseek = seq_lseek,
@@ -207,27 +209,21 @@ static int acpi_button_add_fs(struct acpi_device *device)
207 acpi_device_dir(device)->owner = THIS_MODULE; 209 acpi_device_dir(device)->owner = THIS_MODULE;
208 210
209 /* 'info' [R] */ 211 /* 'info' [R] */
210 entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, 212 entry = proc_create_data(ACPI_BUTTON_FILE_INFO,
211 S_IRUGO, acpi_device_dir(device)); 213 S_IRUGO, acpi_device_dir(device),
214 &acpi_button_info_fops,
215 acpi_driver_data(device));
212 if (!entry) 216 if (!entry)
213 return -ENODEV; 217 return -ENODEV;
214 else {
215 entry->proc_fops = &acpi_button_info_fops;
216 entry->data = acpi_driver_data(device);
217 entry->owner = THIS_MODULE;
218 }
219 218
220 /* show lid state [R] */ 219 /* show lid state [R] */
221 if (button->type == ACPI_BUTTON_TYPE_LID) { 220 if (button->type == ACPI_BUTTON_TYPE_LID) {
222 entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, 221 entry = proc_create_data(ACPI_BUTTON_FILE_STATE,
223 S_IRUGO, acpi_device_dir(device)); 222 S_IRUGO, acpi_device_dir(device),
223 &acpi_button_state_fops,
224 acpi_driver_data(device));
224 if (!entry) 225 if (!entry)
225 return -ENODEV; 226 return -ENODEV;
226 else {
227 entry->proc_fops = &acpi_button_state_fops;
228 entry->data = acpi_driver_data(device);
229 entry->owner = THIS_MODULE;
230 }
231 } 227 }
232 228
233 return 0; 229 return 0;
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 7222a18a0319..e3f04b272f3f 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -669,16 +669,11 @@ static int acpi_ec_add_fs(struct acpi_device *device)
669 return -ENODEV; 669 return -ENODEV;
670 } 670 }
671 671
672 entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, 672 entry = proc_create_data(ACPI_EC_FILE_INFO, S_IRUGO,
673 acpi_device_dir(device)); 673 acpi_device_dir(device),
674 &acpi_ec_info_ops, acpi_driver_data(device));
674 if (!entry) 675 if (!entry)
675 return -ENODEV; 676 return -ENODEV;
676 else {
677 entry->proc_fops = &acpi_ec_info_ops;
678 entry->data = acpi_driver_data(device);
679 entry->owner = THIS_MODULE;
680 }
681
682 return 0; 677 return 0;
683} 678}
684 679
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index abec1ca94cf4..0c24bd4d6562 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -102,6 +102,7 @@ static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait)
102} 102}
103 103
104static const struct file_operations acpi_system_event_ops = { 104static const struct file_operations acpi_system_event_ops = {
105 .owner = THIS_MODULE,
105 .open = acpi_system_open_event, 106 .open = acpi_system_open_event,
106 .read = acpi_system_read_event, 107 .read = acpi_system_read_event,
107 .release = acpi_system_close_event, 108 .release = acpi_system_close_event,
@@ -294,10 +295,9 @@ static int __init acpi_event_init(void)
294 295
295#ifdef CONFIG_ACPI_PROC_EVENT 296#ifdef CONFIG_ACPI_PROC_EVENT
296 /* 'event' [R] */ 297 /* 'event' [R] */
297 entry = create_proc_entry("event", S_IRUSR, acpi_root_dir); 298 entry = proc_create("event", S_IRUSR, acpi_root_dir,
298 if (entry) 299 &acpi_system_event_ops);
299 entry->proc_fops = &acpi_system_event_ops; 300 if (!entry)
300 else
301 return -ENODEV; 301 return -ENODEV;
302#endif 302#endif
303 303
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index c8e3cba423ef..194077ab9b85 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -192,17 +192,13 @@ static int acpi_fan_add_fs(struct acpi_device *device)
192 } 192 }
193 193
194 /* 'status' [R/W] */ 194 /* 'status' [R/W] */
195 entry = create_proc_entry(ACPI_FAN_FILE_STATE, 195 entry = proc_create_data(ACPI_FAN_FILE_STATE,
196 S_IFREG | S_IRUGO | S_IWUSR, 196 S_IFREG | S_IRUGO | S_IWUSR,
197 acpi_device_dir(device)); 197 acpi_device_dir(device),
198 &acpi_fan_state_ops,
199 device);
198 if (!entry) 200 if (!entry)
199 return -ENODEV; 201 return -ENODEV;
200 else {
201 entry->proc_fops = &acpi_fan_state_ops;
202 entry->data = device;
203 entry->owner = THIS_MODULE;
204 }
205
206 return 0; 202 return 0;
207} 203}
208 204
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 76bf6d90c700..21fc8bf0d31f 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -93,6 +93,7 @@ struct acpi_power_resource {
93static struct list_head acpi_power_resource_list; 93static struct list_head acpi_power_resource_list;
94 94
95static const struct file_operations acpi_power_fops = { 95static const struct file_operations acpi_power_fops = {
96 .owner = THIS_MODULE,
96 .open = acpi_power_open_fs, 97 .open = acpi_power_open_fs,
97 .read = seq_read, 98 .read = seq_read,
98 .llseek = seq_lseek, 99 .llseek = seq_lseek,
@@ -543,15 +544,11 @@ static int acpi_power_add_fs(struct acpi_device *device)
543 } 544 }
544 545
545 /* 'status' [R] */ 546 /* 'status' [R] */
546 entry = create_proc_entry(ACPI_POWER_FILE_STATUS, 547 entry = proc_create_data(ACPI_POWER_FILE_STATUS,
547 S_IRUGO, acpi_device_dir(device)); 548 S_IRUGO, acpi_device_dir(device),
549 &acpi_power_fops, acpi_driver_data(device));
548 if (!entry) 550 if (!entry)
549 return -EIO; 551 return -EIO;
550 else {
551 entry->proc_fops = &acpi_power_fops;
552 entry->data = acpi_driver_data(device);
553 }
554
555 return 0; 552 return 0;
556} 553}
557 554
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index a825b431b64f..dd28c912e84f 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -112,6 +112,7 @@ static struct acpi_driver acpi_processor_driver = {
112#define UNINSTALL_NOTIFY_HANDLER 2 112#define UNINSTALL_NOTIFY_HANDLER 2
113 113
114static const struct file_operations acpi_processor_info_fops = { 114static const struct file_operations acpi_processor_info_fops = {
115 .owner = THIS_MODULE,
115 .open = acpi_processor_info_open_fs, 116 .open = acpi_processor_info_open_fs,
116 .read = seq_read, 117 .read = seq_read,
117 .llseek = seq_lseek, 118 .llseek = seq_lseek,
@@ -326,40 +327,30 @@ static int acpi_processor_add_fs(struct acpi_device *device)
326 acpi_device_dir(device)->owner = THIS_MODULE; 327 acpi_device_dir(device)->owner = THIS_MODULE;
327 328
328 /* 'info' [R] */ 329 /* 'info' [R] */
329 entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, 330 entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO,
330 S_IRUGO, acpi_device_dir(device)); 331 S_IRUGO, acpi_device_dir(device),
332 &acpi_processor_info_fops,
333 acpi_driver_data(device));
331 if (!entry) 334 if (!entry)
332 return -EIO; 335 return -EIO;
333 else {
334 entry->proc_fops = &acpi_processor_info_fops;
335 entry->data = acpi_driver_data(device);
336 entry->owner = THIS_MODULE;
337 }
338 336
339 /* 'throttling' [R/W] */ 337 /* 'throttling' [R/W] */
340 entry = create_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, 338 entry = proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING,
341 S_IFREG | S_IRUGO | S_IWUSR, 339 S_IFREG | S_IRUGO | S_IWUSR,
342 acpi_device_dir(device)); 340 acpi_device_dir(device),
341 &acpi_processor_throttling_fops,
342 acpi_driver_data(device));
343 if (!entry) 343 if (!entry)
344 return -EIO; 344 return -EIO;
345 else {
346 entry->proc_fops = &acpi_processor_throttling_fops;
347 entry->data = acpi_driver_data(device);
348 entry->owner = THIS_MODULE;
349 }
350 345
351 /* 'limit' [R/W] */ 346 /* 'limit' [R/W] */
352 entry = create_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, 347 entry = proc_create_data(ACPI_PROCESSOR_FILE_LIMIT,
353 S_IFREG | S_IRUGO | S_IWUSR, 348 S_IFREG | S_IRUGO | S_IWUSR,
354 acpi_device_dir(device)); 349 acpi_device_dir(device),
350 &acpi_processor_limit_fops,
351 acpi_driver_data(device));
355 if (!entry) 352 if (!entry)
356 return -EIO; 353 return -EIO;
357 else {
358 entry->proc_fops = &acpi_processor_limit_fops;
359 entry->data = acpi_driver_data(device);
360 entry->owner = THIS_MODULE;
361 }
362
363 return 0; 354 return 0;
364} 355}
365 356
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 0d90ff5fd117..789d4947ed31 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1282,6 +1282,7 @@ static int acpi_processor_power_open_fs(struct inode *inode, struct file *file)
1282} 1282}
1283 1283
1284static const struct file_operations acpi_processor_power_fops = { 1284static const struct file_operations acpi_processor_power_fops = {
1285 .owner = THIS_MODULE,
1285 .open = acpi_processor_power_open_fs, 1286 .open = acpi_processor_power_open_fs,
1286 .read = seq_read, 1287 .read = seq_read,
1287 .llseek = seq_lseek, 1288 .llseek = seq_lseek,
@@ -1822,16 +1823,12 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1822 } 1823 }
1823 1824
1824 /* 'power' [R] */ 1825 /* 'power' [R] */
1825 entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER, 1826 entry = proc_create_data(ACPI_PROCESSOR_FILE_POWER,
1826 S_IRUGO, acpi_device_dir(device)); 1827 S_IRUGO, acpi_device_dir(device),
1828 &acpi_processor_power_fops,
1829 acpi_driver_data(device));
1827 if (!entry) 1830 if (!entry)
1828 return -EIO; 1831 return -EIO;
1829 else {
1830 entry->proc_fops = &acpi_processor_power_fops;
1831 entry->data = acpi_driver_data(device);
1832 entry->owner = THIS_MODULE;
1833 }
1834
1835 return 0; 1832 return 0;
1836} 1833}
1837 1834
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index b477a4be8a69..d80b2d1441af 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -411,6 +411,7 @@ EXPORT_SYMBOL(acpi_processor_notify_smm);
411 411
412static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file); 412static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file);
413static struct file_operations acpi_processor_perf_fops = { 413static struct file_operations acpi_processor_perf_fops = {
414 .owner = THIS_MODULE,
414 .open = acpi_processor_perf_open_fs, 415 .open = acpi_processor_perf_open_fs,
415 .read = seq_read, 416 .read = seq_read,
416 .llseek = seq_lseek, 417 .llseek = seq_lseek,
@@ -456,7 +457,6 @@ static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
456 457
457static void acpi_cpufreq_add_file(struct acpi_processor *pr) 458static void acpi_cpufreq_add_file(struct acpi_processor *pr)
458{ 459{
459 struct proc_dir_entry *entry = NULL;
460 struct acpi_device *device = NULL; 460 struct acpi_device *device = NULL;
461 461
462 462
@@ -464,14 +464,9 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr)
464 return; 464 return;
465 465
466 /* add file 'performance' [R/W] */ 466 /* add file 'performance' [R/W] */
467 entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, 467 proc_create_data(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO,
468 S_IFREG | S_IRUGO, 468 acpi_device_dir(device),
469 acpi_device_dir(device)); 469 &acpi_processor_perf_fops, acpi_driver_data(device));
470 if (entry){
471 entry->proc_fops = &acpi_processor_perf_fops;
472 entry->data = acpi_driver_data(device);
473 entry->owner = THIS_MODULE;
474 }
475 return; 470 return;
476} 471}
477 472
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
index 649ae99b9216..ef34b18f95ca 100644
--- a/drivers/acpi/processor_thermal.c
+++ b/drivers/acpi/processor_thermal.c
@@ -509,6 +509,7 @@ static ssize_t acpi_processor_write_limit(struct file * file,
509} 509}
510 510
511struct file_operations acpi_processor_limit_fops = { 511struct file_operations acpi_processor_limit_fops = {
512 .owner = THIS_MODULE,
512 .open = acpi_processor_limit_open_fs, 513 .open = acpi_processor_limit_open_fs,
513 .read = seq_read, 514 .read = seq_read,
514 .write = acpi_processor_write_limit, 515 .write = acpi_processor_write_limit,
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index 0bba3a914e86..bb06738860c4 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -1252,6 +1252,7 @@ static ssize_t acpi_processor_write_throttling(struct file *file,
1252} 1252}
1253 1253
1254struct file_operations acpi_processor_throttling_fops = { 1254struct file_operations acpi_processor_throttling_fops = {
1255 .owner = THIS_MODULE,
1255 .open = acpi_processor_throttling_open_fs, 1256 .open = acpi_processor_throttling_open_fs,
1256 .read = seq_read, 1257 .read = seq_read,
1257 .write = acpi_processor_write_throttling, 1258 .write = acpi_processor_write_throttling,
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 585ae3c9c8ea..10a36512647c 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -483,8 +483,6 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
483 struct file_operations *state_fops, 483 struct file_operations *state_fops,
484 struct file_operations *alarm_fops, void *data) 484 struct file_operations *alarm_fops, void *data)
485{ 485{
486 struct proc_dir_entry *entry = NULL;
487
488 if (!*dir) { 486 if (!*dir) {
489 *dir = proc_mkdir(dir_name, parent_dir); 487 *dir = proc_mkdir(dir_name, parent_dir);
490 if (!*dir) { 488 if (!*dir) {
@@ -494,34 +492,19 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
494 } 492 }
495 493
496 /* 'info' [R] */ 494 /* 'info' [R] */
497 if (info_fops) { 495 if (info_fops)
498 entry = create_proc_entry(ACPI_SBS_FILE_INFO, S_IRUGO, *dir); 496 proc_create_data(ACPI_SBS_FILE_INFO, S_IRUGO, *dir,
499 if (entry) { 497 info_fops, data);
500 entry->proc_fops = info_fops;
501 entry->data = data;
502 entry->owner = THIS_MODULE;
503 }
504 }
505 498
506 /* 'state' [R] */ 499 /* 'state' [R] */
507 if (state_fops) { 500 if (state_fops)
508 entry = create_proc_entry(ACPI_SBS_FILE_STATE, S_IRUGO, *dir); 501 proc_create_data(ACPI_SBS_FILE_STATE, S_IRUGO, *dir,
509 if (entry) { 502 state_fops, data);
510 entry->proc_fops = state_fops;
511 entry->data = data;
512 entry->owner = THIS_MODULE;
513 }
514 }
515 503
516 /* 'alarm' [R/W] */ 504 /* 'alarm' [R/W] */
517 if (alarm_fops) { 505 if (alarm_fops)
518 entry = create_proc_entry(ACPI_SBS_FILE_ALARM, S_IRUGO, *dir); 506 proc_create_data(ACPI_SBS_FILE_ALARM, S_IRUGO, *dir,
519 if (entry) { 507 alarm_fops, data);
520 entry->proc_fops = alarm_fops;
521 entry->data = data;
522 entry->owner = THIS_MODULE;
523 }
524 }
525 return 0; 508 return 0;
526} 509}
527 510
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index f8df5217d477..8a5fe8710513 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -440,6 +440,7 @@ acpi_system_wakeup_device_open_fs(struct inode *inode, struct file *file)
440} 440}
441 441
442static const struct file_operations acpi_system_wakeup_device_fops = { 442static const struct file_operations acpi_system_wakeup_device_fops = {
443 .owner = THIS_MODULE,
443 .open = acpi_system_wakeup_device_open_fs, 444 .open = acpi_system_wakeup_device_open_fs,
444 .read = seq_read, 445 .read = seq_read,
445 .write = acpi_system_write_wakeup_device, 446 .write = acpi_system_write_wakeup_device,
@@ -449,6 +450,7 @@ static const struct file_operations acpi_system_wakeup_device_fops = {
449 450
450#ifdef CONFIG_ACPI_PROCFS 451#ifdef CONFIG_ACPI_PROCFS
451static const struct file_operations acpi_system_sleep_fops = { 452static const struct file_operations acpi_system_sleep_fops = {
453 .owner = THIS_MODULE,
452 .open = acpi_system_sleep_open_fs, 454 .open = acpi_system_sleep_open_fs,
453 .read = seq_read, 455 .read = seq_read,
454 .write = acpi_system_write_sleep, 456 .write = acpi_system_write_sleep,
@@ -459,6 +461,7 @@ static const struct file_operations acpi_system_sleep_fops = {
459 461
460#ifdef HAVE_ACPI_LEGACY_ALARM 462#ifdef HAVE_ACPI_LEGACY_ALARM
461static const struct file_operations acpi_system_alarm_fops = { 463static const struct file_operations acpi_system_alarm_fops = {
464 .owner = THIS_MODULE,
462 .open = acpi_system_alarm_open_fs, 465 .open = acpi_system_alarm_open_fs,
463 .read = seq_read, 466 .read = seq_read,
464 .write = acpi_system_write_alarm, 467 .write = acpi_system_write_alarm,
@@ -477,37 +480,26 @@ static u32 rtc_handler(void *context)
477 480
478static int __init acpi_sleep_proc_init(void) 481static int __init acpi_sleep_proc_init(void)
479{ 482{
480 struct proc_dir_entry *entry = NULL;
481
482 if (acpi_disabled) 483 if (acpi_disabled)
483 return 0; 484 return 0;
484 485
485#ifdef CONFIG_ACPI_PROCFS 486#ifdef CONFIG_ACPI_PROCFS
486 /* 'sleep' [R/W] */ 487 /* 'sleep' [R/W] */
487 entry = 488 proc_create("sleep", S_IFREG | S_IRUGO | S_IWUSR,
488 create_proc_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR, 489 acpi_root_dir, &acpi_system_sleep_fops);
489 acpi_root_dir);
490 if (entry)
491 entry->proc_fops = &acpi_system_sleep_fops;
492#endif /* CONFIG_ACPI_PROCFS */ 490#endif /* CONFIG_ACPI_PROCFS */
493 491
494#ifdef HAVE_ACPI_LEGACY_ALARM 492#ifdef HAVE_ACPI_LEGACY_ALARM
495 /* 'alarm' [R/W] */ 493 /* 'alarm' [R/W] */
496 entry = 494 proc_create("alarm", S_IFREG | S_IRUGO | S_IWUSR,
497 create_proc_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR, 495 acpi_root_dir, &acpi_system_alarm_fops);
498 acpi_root_dir);
499 if (entry)
500 entry->proc_fops = &acpi_system_alarm_fops;
501 496
502 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); 497 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
503#endif /* HAVE_ACPI_LEGACY_ALARM */ 498#endif /* HAVE_ACPI_LEGACY_ALARM */
504 499
505 /* 'wakeup device' [R/W] */ 500 /* 'wakeup device' [R/W] */
506 entry = 501 proc_create("wakeup", S_IFREG | S_IRUGO | S_IWUSR,
507 create_proc_entry("wakeup", S_IFREG | S_IRUGO | S_IWUSR, 502 acpi_root_dir, &acpi_system_wakeup_device_fops);
508 acpi_root_dir);
509 if (entry)
510 entry->proc_fops = &acpi_system_wakeup_device_fops;
511 503
512 return 0; 504 return 0;
513} 505}
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index 4749f379a915..769f24855eb6 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -396,6 +396,7 @@ static int acpi_system_info_open_fs(struct inode *inode, struct file *file)
396} 396}
397 397
398static const struct file_operations acpi_system_info_ops = { 398static const struct file_operations acpi_system_info_ops = {
399 .owner = THIS_MODULE,
399 .open = acpi_system_info_open_fs, 400 .open = acpi_system_info_open_fs,
400 .read = seq_read, 401 .read = seq_read,
401 .llseek = seq_lseek, 402 .llseek = seq_lseek,
@@ -406,6 +407,7 @@ static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t,
406 loff_t *); 407 loff_t *);
407 408
408static const struct file_operations acpi_system_dsdt_ops = { 409static const struct file_operations acpi_system_dsdt_ops = {
410 .owner = THIS_MODULE,
409 .read = acpi_system_read_dsdt, 411 .read = acpi_system_read_dsdt,
410}; 412};
411 413
@@ -430,6 +432,7 @@ static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t,
430 loff_t *); 432 loff_t *);
431 433
432static const struct file_operations acpi_system_fadt_ops = { 434static const struct file_operations acpi_system_fadt_ops = {
435 .owner = THIS_MODULE,
433 .read = acpi_system_read_fadt, 436 .read = acpi_system_read_fadt,
434}; 437};
435 438
@@ -454,31 +457,23 @@ static int acpi_system_procfs_init(void)
454{ 457{
455 struct proc_dir_entry *entry; 458 struct proc_dir_entry *entry;
456 int error = 0; 459 int error = 0;
457 char *name;
458 460
459 /* 'info' [R] */ 461 /* 'info' [R] */
460 name = ACPI_SYSTEM_FILE_INFO; 462 entry = proc_create(ACPI_SYSTEM_FILE_INFO, S_IRUGO, acpi_root_dir,
461 entry = create_proc_entry(name, S_IRUGO, acpi_root_dir); 463 &acpi_system_info_ops);
462 if (!entry) 464 if (!entry)
463 goto Error; 465 goto Error;
464 else {
465 entry->proc_fops = &acpi_system_info_ops;
466 }
467 466
468 /* 'dsdt' [R] */ 467 /* 'dsdt' [R] */
469 name = ACPI_SYSTEM_FILE_DSDT; 468 entry = proc_create(ACPI_SYSTEM_FILE_DSDT, S_IRUSR, acpi_root_dir,
470 entry = create_proc_entry(name, S_IRUSR, acpi_root_dir); 469 &acpi_system_dsdt_ops);
471 if (entry) 470 if (!entry)
472 entry->proc_fops = &acpi_system_dsdt_ops;
473 else
474 goto Error; 471 goto Error;
475 472
476 /* 'fadt' [R] */ 473 /* 'fadt' [R] */
477 name = ACPI_SYSTEM_FILE_FADT; 474 entry = proc_create(ACPI_SYSTEM_FILE_FADT, S_IRUSR, acpi_root_dir,
478 entry = create_proc_entry(name, S_IRUSR, acpi_root_dir); 475 &acpi_system_fadt_ops);
479 if (entry) 476 if (!entry)
480 entry->proc_fops = &acpi_system_fadt_ops;
481 else
482 goto Error; 477 goto Error;
483 478
484 Done: 479 Done:
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 766bd25d3376..0815ac3ae3d6 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -198,6 +198,7 @@ struct acpi_thermal {
198}; 198};
199 199
200static const struct file_operations acpi_thermal_state_fops = { 200static const struct file_operations acpi_thermal_state_fops = {
201 .owner = THIS_MODULE,
201 .open = acpi_thermal_state_open_fs, 202 .open = acpi_thermal_state_open_fs,
202 .read = seq_read, 203 .read = seq_read,
203 .llseek = seq_lseek, 204 .llseek = seq_lseek,
@@ -205,6 +206,7 @@ static const struct file_operations acpi_thermal_state_fops = {
205}; 206};
206 207
207static const struct file_operations acpi_thermal_temp_fops = { 208static const struct file_operations acpi_thermal_temp_fops = {
209 .owner = THIS_MODULE,
208 .open = acpi_thermal_temp_open_fs, 210 .open = acpi_thermal_temp_open_fs,
209 .read = seq_read, 211 .read = seq_read,
210 .llseek = seq_lseek, 212 .llseek = seq_lseek,
@@ -212,6 +214,7 @@ static const struct file_operations acpi_thermal_temp_fops = {
212}; 214};
213 215
214static const struct file_operations acpi_thermal_trip_fops = { 216static const struct file_operations acpi_thermal_trip_fops = {
217 .owner = THIS_MODULE,
215 .open = acpi_thermal_trip_open_fs, 218 .open = acpi_thermal_trip_open_fs,
216 .read = seq_read, 219 .read = seq_read,
217 .llseek = seq_lseek, 220 .llseek = seq_lseek,
@@ -219,6 +222,7 @@ static const struct file_operations acpi_thermal_trip_fops = {
219}; 222};
220 223
221static const struct file_operations acpi_thermal_cooling_fops = { 224static const struct file_operations acpi_thermal_cooling_fops = {
225 .owner = THIS_MODULE,
222 .open = acpi_thermal_cooling_open_fs, 226 .open = acpi_thermal_cooling_open_fs,
223 .read = seq_read, 227 .read = seq_read,
224 .write = acpi_thermal_write_cooling_mode, 228 .write = acpi_thermal_write_cooling_mode,
@@ -227,6 +231,7 @@ static const struct file_operations acpi_thermal_cooling_fops = {
227}; 231};
228 232
229static const struct file_operations acpi_thermal_polling_fops = { 233static const struct file_operations acpi_thermal_polling_fops = {
234 .owner = THIS_MODULE,
230 .open = acpi_thermal_polling_open_fs, 235 .open = acpi_thermal_polling_open_fs,
231 .read = seq_read, 236 .read = seq_read,
232 .write = acpi_thermal_write_polling, 237 .write = acpi_thermal_write_polling,
@@ -1419,63 +1424,47 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1419 } 1424 }
1420 1425
1421 /* 'state' [R] */ 1426 /* 'state' [R] */
1422 entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, 1427 entry = proc_create_data(ACPI_THERMAL_FILE_STATE,
1423 S_IRUGO, acpi_device_dir(device)); 1428 S_IRUGO, acpi_device_dir(device),
1429 &acpi_thermal_state_fops,
1430 acpi_driver_data(device));
1424 if (!entry) 1431 if (!entry)
1425 return -ENODEV; 1432 return -ENODEV;
1426 else {
1427 entry->proc_fops = &acpi_thermal_state_fops;
1428 entry->data = acpi_driver_data(device);
1429 entry->owner = THIS_MODULE;
1430 }
1431 1433
1432 /* 'temperature' [R] */ 1434 /* 'temperature' [R] */
1433 entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, 1435 entry = proc_create_data(ACPI_THERMAL_FILE_TEMPERATURE,
1434 S_IRUGO, acpi_device_dir(device)); 1436 S_IRUGO, acpi_device_dir(device),
1437 &acpi_thermal_temp_fops,
1438 acpi_driver_data(device));
1435 if (!entry) 1439 if (!entry)
1436 return -ENODEV; 1440 return -ENODEV;
1437 else {
1438 entry->proc_fops = &acpi_thermal_temp_fops;
1439 entry->data = acpi_driver_data(device);
1440 entry->owner = THIS_MODULE;
1441 }
1442 1441
1443 /* 'trip_points' [R] */ 1442 /* 'trip_points' [R] */
1444 entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, 1443 entry = proc_create_data(ACPI_THERMAL_FILE_TRIP_POINTS,
1445 S_IRUGO, 1444 S_IRUGO,
1446 acpi_device_dir(device)); 1445 acpi_device_dir(device),
1446 &acpi_thermal_trip_fops,
1447 acpi_driver_data(device));
1447 if (!entry) 1448 if (!entry)
1448 return -ENODEV; 1449 return -ENODEV;
1449 else {
1450 entry->proc_fops = &acpi_thermal_trip_fops;
1451 entry->data = acpi_driver_data(device);
1452 entry->owner = THIS_MODULE;
1453 }
1454 1450
1455 /* 'cooling_mode' [R/W] */ 1451 /* 'cooling_mode' [R/W] */
1456 entry = create_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE, 1452 entry = proc_create_data(ACPI_THERMAL_FILE_COOLING_MODE,
1457 S_IFREG | S_IRUGO | S_IWUSR, 1453 S_IFREG | S_IRUGO | S_IWUSR,
1458 acpi_device_dir(device)); 1454 acpi_device_dir(device),
1455 &acpi_thermal_cooling_fops,
1456 acpi_driver_data(device));
1459 if (!entry) 1457 if (!entry)
1460 return -ENODEV; 1458 return -ENODEV;
1461 else {
1462 entry->proc_fops = &acpi_thermal_cooling_fops;
1463 entry->data = acpi_driver_data(device);
1464 entry->owner = THIS_MODULE;
1465 }
1466 1459
1467 /* 'polling_frequency' [R/W] */ 1460 /* 'polling_frequency' [R/W] */
1468 entry = create_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, 1461 entry = proc_create_data(ACPI_THERMAL_FILE_POLLING_FREQ,
1469 S_IFREG | S_IRUGO | S_IWUSR, 1462 S_IFREG | S_IRUGO | S_IWUSR,
1470 acpi_device_dir(device)); 1463 acpi_device_dir(device),
1464 &acpi_thermal_polling_fops,
1465 acpi_driver_data(device));
1471 if (!entry) 1466 if (!entry)
1472 return -ENODEV; 1467 return -ENODEV;
1473 else {
1474 entry->proc_fops = &acpi_thermal_polling_fops;
1475 entry->data = acpi_driver_data(device);
1476 entry->owner = THIS_MODULE;
1477 }
1478
1479 return 0; 1468 return 0;
1480} 1469}
1481 1470
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 980a74188781..43b228314a86 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -192,6 +192,7 @@ struct acpi_video_device {
192/* bus */ 192/* bus */
193static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); 193static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file);
194static struct file_operations acpi_video_bus_info_fops = { 194static struct file_operations acpi_video_bus_info_fops = {
195 .owner = THIS_MODULE,
195 .open = acpi_video_bus_info_open_fs, 196 .open = acpi_video_bus_info_open_fs,
196 .read = seq_read, 197 .read = seq_read,
197 .llseek = seq_lseek, 198 .llseek = seq_lseek,
@@ -200,6 +201,7 @@ static struct file_operations acpi_video_bus_info_fops = {
200 201
201static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file); 202static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file);
202static struct file_operations acpi_video_bus_ROM_fops = { 203static struct file_operations acpi_video_bus_ROM_fops = {
204 .owner = THIS_MODULE,
203 .open = acpi_video_bus_ROM_open_fs, 205 .open = acpi_video_bus_ROM_open_fs,
204 .read = seq_read, 206 .read = seq_read,
205 .llseek = seq_lseek, 207 .llseek = seq_lseek,
@@ -209,6 +211,7 @@ static struct file_operations acpi_video_bus_ROM_fops = {
209static int acpi_video_bus_POST_info_open_fs(struct inode *inode, 211static int acpi_video_bus_POST_info_open_fs(struct inode *inode,
210 struct file *file); 212 struct file *file);
211static struct file_operations acpi_video_bus_POST_info_fops = { 213static struct file_operations acpi_video_bus_POST_info_fops = {
214 .owner = THIS_MODULE,
212 .open = acpi_video_bus_POST_info_open_fs, 215 .open = acpi_video_bus_POST_info_open_fs,
213 .read = seq_read, 216 .read = seq_read,
214 .llseek = seq_lseek, 217 .llseek = seq_lseek,
@@ -217,6 +220,7 @@ static struct file_operations acpi_video_bus_POST_info_fops = {
217 220
218static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file); 221static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file);
219static struct file_operations acpi_video_bus_POST_fops = { 222static struct file_operations acpi_video_bus_POST_fops = {
223 .owner = THIS_MODULE,
220 .open = acpi_video_bus_POST_open_fs, 224 .open = acpi_video_bus_POST_open_fs,
221 .read = seq_read, 225 .read = seq_read,
222 .llseek = seq_lseek, 226 .llseek = seq_lseek,
@@ -225,6 +229,7 @@ static struct file_operations acpi_video_bus_POST_fops = {
225 229
226static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file); 230static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file);
227static struct file_operations acpi_video_bus_DOS_fops = { 231static struct file_operations acpi_video_bus_DOS_fops = {
232 .owner = THIS_MODULE,
228 .open = acpi_video_bus_DOS_open_fs, 233 .open = acpi_video_bus_DOS_open_fs,
229 .read = seq_read, 234 .read = seq_read,
230 .llseek = seq_lseek, 235 .llseek = seq_lseek,
@@ -235,6 +240,7 @@ static struct file_operations acpi_video_bus_DOS_fops = {
235static int acpi_video_device_info_open_fs(struct inode *inode, 240static int acpi_video_device_info_open_fs(struct inode *inode,
236 struct file *file); 241 struct file *file);
237static struct file_operations acpi_video_device_info_fops = { 242static struct file_operations acpi_video_device_info_fops = {
243 .owner = THIS_MODULE,
238 .open = acpi_video_device_info_open_fs, 244 .open = acpi_video_device_info_open_fs,
239 .read = seq_read, 245 .read = seq_read,
240 .llseek = seq_lseek, 246 .llseek = seq_lseek,
@@ -244,6 +250,7 @@ static struct file_operations acpi_video_device_info_fops = {
244static int acpi_video_device_state_open_fs(struct inode *inode, 250static int acpi_video_device_state_open_fs(struct inode *inode,
245 struct file *file); 251 struct file *file);
246static struct file_operations acpi_video_device_state_fops = { 252static struct file_operations acpi_video_device_state_fops = {
253 .owner = THIS_MODULE,
247 .open = acpi_video_device_state_open_fs, 254 .open = acpi_video_device_state_open_fs,
248 .read = seq_read, 255 .read = seq_read,
249 .llseek = seq_lseek, 256 .llseek = seq_lseek,
@@ -253,6 +260,7 @@ static struct file_operations acpi_video_device_state_fops = {
253static int acpi_video_device_brightness_open_fs(struct inode *inode, 260static int acpi_video_device_brightness_open_fs(struct inode *inode,
254 struct file *file); 261 struct file *file);
255static struct file_operations acpi_video_device_brightness_fops = { 262static struct file_operations acpi_video_device_brightness_fops = {
263 .owner = THIS_MODULE,
256 .open = acpi_video_device_brightness_open_fs, 264 .open = acpi_video_device_brightness_open_fs,
257 .read = seq_read, 265 .read = seq_read,
258 .llseek = seq_lseek, 266 .llseek = seq_lseek,
@@ -262,6 +270,7 @@ static struct file_operations acpi_video_device_brightness_fops = {
262static int acpi_video_device_EDID_open_fs(struct inode *inode, 270static int acpi_video_device_EDID_open_fs(struct inode *inode,
263 struct file *file); 271 struct file *file);
264static struct file_operations acpi_video_device_EDID_fops = { 272static struct file_operations acpi_video_device_EDID_fops = {
273 .owner = THIS_MODULE,
265 .open = acpi_video_device_EDID_open_fs, 274 .open = acpi_video_device_EDID_open_fs,
266 .read = seq_read, 275 .read = seq_read,
267 .llseek = seq_lseek, 276 .llseek = seq_lseek,
@@ -1070,51 +1079,36 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
1070 } 1079 }
1071 1080
1072 /* 'info' [R] */ 1081 /* 'info' [R] */
1073 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); 1082 entry = proc_create_data("info", S_IRUGO, acpi_device_dir(device),
1083 &acpi_video_device_info_fops, acpi_driver_data(device));
1074 if (!entry) 1084 if (!entry)
1075 return -ENODEV; 1085 return -ENODEV;
1076 else {
1077 entry->proc_fops = &acpi_video_device_info_fops;
1078 entry->data = acpi_driver_data(device);
1079 entry->owner = THIS_MODULE;
1080 }
1081 1086
1082 /* 'state' [R/W] */ 1087 /* 'state' [R/W] */
1083 entry = 1088 acpi_video_device_state_fops.write = acpi_video_device_write_state;
1084 create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, 1089 entry = proc_create_data("state", S_IFREG | S_IRUGO | S_IWUSR,
1085 acpi_device_dir(device)); 1090 acpi_device_dir(device),
1091 &acpi_video_device_state_fops,
1092 acpi_driver_data(device));
1086 if (!entry) 1093 if (!entry)
1087 return -ENODEV; 1094 return -ENODEV;
1088 else {
1089 acpi_video_device_state_fops.write = acpi_video_device_write_state;
1090 entry->proc_fops = &acpi_video_device_state_fops;
1091 entry->data = acpi_driver_data(device);
1092 entry->owner = THIS_MODULE;
1093 }
1094 1095
1095 /* 'brightness' [R/W] */ 1096 /* 'brightness' [R/W] */
1096 entry = 1097 acpi_video_device_brightness_fops.write =
1097 create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, 1098 acpi_video_device_write_brightness;
1098 acpi_device_dir(device)); 1099 entry = proc_create_data("brightness", S_IFREG | S_IRUGO | S_IWUSR,
1100 acpi_device_dir(device),
1101 &acpi_video_device_brightness_fops,
1102 acpi_driver_data(device));
1099 if (!entry) 1103 if (!entry)
1100 return -ENODEV; 1104 return -ENODEV;
1101 else {
1102 acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness;
1103 entry->proc_fops = &acpi_video_device_brightness_fops;
1104 entry->data = acpi_driver_data(device);
1105 entry->owner = THIS_MODULE;
1106 }
1107 1105
1108 /* 'EDID' [R] */ 1106 /* 'EDID' [R] */
1109 entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); 1107 entry = proc_create_data("EDID", S_IRUGO, acpi_device_dir(device),
1108 &acpi_video_device_EDID_fops,
1109 acpi_driver_data(device));
1110 if (!entry) 1110 if (!entry)
1111 return -ENODEV; 1111 return -ENODEV;
1112 else {
1113 entry->proc_fops = &acpi_video_device_EDID_fops;
1114 entry->data = acpi_driver_data(device);
1115 entry->owner = THIS_MODULE;
1116 }
1117
1118 return 0; 1112 return 0;
1119} 1113}
1120 1114
@@ -1353,61 +1347,43 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
1353 } 1347 }
1354 1348
1355 /* 'info' [R] */ 1349 /* 'info' [R] */
1356 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); 1350 entry = proc_create_data("info", S_IRUGO, acpi_device_dir(device),
1351 &acpi_video_bus_info_fops,
1352 acpi_driver_data(device));
1357 if (!entry) 1353 if (!entry)
1358 return -ENODEV; 1354 return -ENODEV;
1359 else {
1360 entry->proc_fops = &acpi_video_bus_info_fops;
1361 entry->data = acpi_driver_data(device);
1362 entry->owner = THIS_MODULE;
1363 }
1364 1355
1365 /* 'ROM' [R] */ 1356 /* 'ROM' [R] */
1366 entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); 1357 entry = proc_create_data("ROM", S_IRUGO, acpi_device_dir(device),
1358 &acpi_video_bus_ROM_fops,
1359 acpi_driver_data(device));
1367 if (!entry) 1360 if (!entry)
1368 return -ENODEV; 1361 return -ENODEV;
1369 else {
1370 entry->proc_fops = &acpi_video_bus_ROM_fops;
1371 entry->data = acpi_driver_data(device);
1372 entry->owner = THIS_MODULE;
1373 }
1374 1362
1375 /* 'POST_info' [R] */ 1363 /* 'POST_info' [R] */
1376 entry = 1364 entry = proc_create_data("POST_info", S_IRUGO, acpi_device_dir(device),
1377 create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); 1365 &acpi_video_bus_POST_info_fops,
1366 acpi_driver_data(device));
1378 if (!entry) 1367 if (!entry)
1379 return -ENODEV; 1368 return -ENODEV;
1380 else {
1381 entry->proc_fops = &acpi_video_bus_POST_info_fops;
1382 entry->data = acpi_driver_data(device);
1383 entry->owner = THIS_MODULE;
1384 }
1385 1369
1386 /* 'POST' [R/W] */ 1370 /* 'POST' [R/W] */
1387 entry = 1371 acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST;
1388 create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, 1372 entry = proc_create_data("POST", S_IFREG | S_IRUGO | S_IRUSR,
1389 acpi_device_dir(device)); 1373 acpi_device_dir(device),
1374 &acpi_video_bus_POST_fops,
1375 acpi_driver_data(device));
1390 if (!entry) 1376 if (!entry)
1391 return -ENODEV; 1377 return -ENODEV;
1392 else {
1393 acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST;
1394 entry->proc_fops = &acpi_video_bus_POST_fops;
1395 entry->data = acpi_driver_data(device);
1396 entry->owner = THIS_MODULE;
1397 }
1398 1378
1399 /* 'DOS' [R/W] */ 1379 /* 'DOS' [R/W] */
1400 entry = 1380 acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS;
1401 create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, 1381 entry = proc_create_data("DOS", S_IFREG | S_IRUGO | S_IRUSR,
1402 acpi_device_dir(device)); 1382 acpi_device_dir(device),
1383 &acpi_video_bus_DOS_fops,
1384 acpi_driver_data(device));
1403 if (!entry) 1385 if (!entry)
1404 return -ENODEV; 1386 return -ENODEV;
1405 else {
1406 acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS;
1407 entry->proc_fops = &acpi_video_bus_DOS_fops;
1408 entry->data = acpi_driver_data(device);
1409 entry->owner = THIS_MODULE;
1410 }
1411 1387
1412 return 0; 1388 return 0;
1413} 1389}