diff options
Diffstat (limited to 'drivers/acpi/power.c')
-rw-r--r-- | drivers/acpi/power.c | 129 |
1 files changed, 1 insertions, 128 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index f74d3b31e5c9..844c155aeb0f 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -40,8 +40,6 @@ | |||
40 | #include <linux/init.h> | 40 | #include <linux/init.h> |
41 | #include <linux/types.h> | 41 | #include <linux/types.h> |
42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
43 | #include <linux/proc_fs.h> | ||
44 | #include <linux/seq_file.h> | ||
45 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
46 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
47 | #include "sleep.h" | 45 | #include "sleep.h" |
@@ -64,7 +62,6 @@ module_param_named(power_nocheck, acpi_power_nocheck, bool, 000); | |||
64 | static int acpi_power_add(struct acpi_device *device); | 62 | static int acpi_power_add(struct acpi_device *device); |
65 | static int acpi_power_remove(struct acpi_device *device, int type); | 63 | static int acpi_power_remove(struct acpi_device *device, int type); |
66 | static int acpi_power_resume(struct acpi_device *device); | 64 | static int acpi_power_resume(struct acpi_device *device); |
67 | static int acpi_power_open_fs(struct inode *inode, struct file *file); | ||
68 | 65 | ||
69 | static const struct acpi_device_id power_device_ids[] = { | 66 | static const struct acpi_device_id power_device_ids[] = { |
70 | {ACPI_POWER_HID, 0}, | 67 | {ACPI_POWER_HID, 0}, |
@@ -99,14 +96,6 @@ struct acpi_power_resource { | |||
99 | 96 | ||
100 | static struct list_head acpi_power_resource_list; | 97 | static struct list_head acpi_power_resource_list; |
101 | 98 | ||
102 | static const struct file_operations acpi_power_fops = { | ||
103 | .owner = THIS_MODULE, | ||
104 | .open = acpi_power_open_fs, | ||
105 | .read = seq_read, | ||
106 | .llseek = seq_lseek, | ||
107 | .release = single_release, | ||
108 | }; | ||
109 | |||
110 | /* -------------------------------------------------------------------------- | 99 | /* -------------------------------------------------------------------------- |
111 | Power Resource Management | 100 | Power Resource Management |
112 | -------------------------------------------------------------------------- */ | 101 | -------------------------------------------------------------------------- */ |
@@ -255,7 +244,6 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev) | |||
255 | struct list_head *node, *next; | 244 | struct list_head *node, *next; |
256 | struct acpi_power_reference *ref; | 245 | struct acpi_power_reference *ref; |
257 | 246 | ||
258 | |||
259 | result = acpi_power_get_context(handle, &resource); | 247 | result = acpi_power_get_context(handle, &resource); |
260 | if (result) | 248 | if (result) |
261 | return result; | 249 | return result; |
@@ -542,102 +530,6 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
542 | } | 530 | } |
543 | 531 | ||
544 | /* -------------------------------------------------------------------------- | 532 | /* -------------------------------------------------------------------------- |
545 | FS Interface (/proc) | ||
546 | -------------------------------------------------------------------------- */ | ||
547 | |||
548 | static struct proc_dir_entry *acpi_power_dir; | ||
549 | |||
550 | static int acpi_power_seq_show(struct seq_file *seq, void *offset) | ||
551 | { | ||
552 | int count = 0; | ||
553 | int result = 0, state; | ||
554 | struct acpi_power_resource *resource = NULL; | ||
555 | struct list_head *node, *next; | ||
556 | struct acpi_power_reference *ref; | ||
557 | |||
558 | |||
559 | resource = seq->private; | ||
560 | |||
561 | if (!resource) | ||
562 | goto end; | ||
563 | |||
564 | result = acpi_power_get_state(resource->device->handle, &state); | ||
565 | if (result) | ||
566 | goto end; | ||
567 | |||
568 | seq_puts(seq, "state: "); | ||
569 | switch (state) { | ||
570 | case ACPI_POWER_RESOURCE_STATE_ON: | ||
571 | seq_puts(seq, "on\n"); | ||
572 | break; | ||
573 | case ACPI_POWER_RESOURCE_STATE_OFF: | ||
574 | seq_puts(seq, "off\n"); | ||
575 | break; | ||
576 | default: | ||
577 | seq_puts(seq, "unknown\n"); | ||
578 | break; | ||
579 | } | ||
580 | |||
581 | mutex_lock(&resource->resource_lock); | ||
582 | list_for_each_safe(node, next, &resource->reference) { | ||
583 | ref = container_of(node, struct acpi_power_reference, node); | ||
584 | count++; | ||
585 | } | ||
586 | mutex_unlock(&resource->resource_lock); | ||
587 | |||
588 | seq_printf(seq, "system level: S%d\n" | ||
589 | "order: %d\n" | ||
590 | "reference count: %d\n", | ||
591 | resource->system_level, | ||
592 | resource->order, count); | ||
593 | |||
594 | end: | ||
595 | return 0; | ||
596 | } | ||
597 | |||
598 | static int acpi_power_open_fs(struct inode *inode, struct file *file) | ||
599 | { | ||
600 | return single_open(file, acpi_power_seq_show, PDE(inode)->data); | ||
601 | } | ||
602 | |||
603 | static int acpi_power_add_fs(struct acpi_device *device) | ||
604 | { | ||
605 | struct proc_dir_entry *entry = NULL; | ||
606 | |||
607 | |||
608 | if (!device) | ||
609 | return -EINVAL; | ||
610 | |||
611 | if (!acpi_device_dir(device)) { | ||
612 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | ||
613 | acpi_power_dir); | ||
614 | if (!acpi_device_dir(device)) | ||
615 | return -ENODEV; | ||
616 | } | ||
617 | |||
618 | /* 'status' [R] */ | ||
619 | entry = proc_create_data(ACPI_POWER_FILE_STATUS, | ||
620 | S_IRUGO, acpi_device_dir(device), | ||
621 | &acpi_power_fops, acpi_driver_data(device)); | ||
622 | if (!entry) | ||
623 | return -EIO; | ||
624 | return 0; | ||
625 | } | ||
626 | |||
627 | static int acpi_power_remove_fs(struct acpi_device *device) | ||
628 | { | ||
629 | |||
630 | if (acpi_device_dir(device)) { | ||
631 | remove_proc_entry(ACPI_POWER_FILE_STATUS, | ||
632 | acpi_device_dir(device)); | ||
633 | remove_proc_entry(acpi_device_bid(device), acpi_power_dir); | ||
634 | acpi_device_dir(device) = NULL; | ||
635 | } | ||
636 | |||
637 | return 0; | ||
638 | } | ||
639 | |||
640 | /* -------------------------------------------------------------------------- | ||
641 | Driver Interface | 533 | Driver Interface |
642 | -------------------------------------------------------------------------- */ | 534 | -------------------------------------------------------------------------- */ |
643 | 535 | ||
@@ -690,10 +582,6 @@ static int acpi_power_add(struct acpi_device *device) | |||
690 | break; | 582 | break; |
691 | } | 583 | } |
692 | 584 | ||
693 | result = acpi_power_add_fs(device); | ||
694 | if (result) | ||
695 | goto end; | ||
696 | |||
697 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), | 585 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), |
698 | acpi_device_bid(device), state ? "on" : "off"); | 586 | acpi_device_bid(device), state ? "on" : "off"); |
699 | 587 | ||
@@ -715,8 +603,6 @@ static int acpi_power_remove(struct acpi_device *device, int type) | |||
715 | 603 | ||
716 | resource = acpi_driver_data(device); | 604 | resource = acpi_driver_data(device); |
717 | 605 | ||
718 | acpi_power_remove_fs(device); | ||
719 | |||
720 | mutex_lock(&resource->resource_lock); | 606 | mutex_lock(&resource->resource_lock); |
721 | list_for_each_safe(node, next, &resource->reference) { | 607 | list_for_each_safe(node, next, &resource->reference) { |
722 | struct acpi_power_reference *ref = container_of(node, struct acpi_power_reference, node); | 608 | struct acpi_power_reference *ref = container_of(node, struct acpi_power_reference, node); |
@@ -760,19 +646,6 @@ static int acpi_power_resume(struct acpi_device *device) | |||
760 | 646 | ||
761 | int __init acpi_power_init(void) | 647 | int __init acpi_power_init(void) |
762 | { | 648 | { |
763 | int result = 0; | ||
764 | |||
765 | INIT_LIST_HEAD(&acpi_power_resource_list); | 649 | INIT_LIST_HEAD(&acpi_power_resource_list); |
766 | 650 | return acpi_bus_register_driver(&acpi_power_driver); | |
767 | acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); | ||
768 | if (!acpi_power_dir) | ||
769 | return -ENODEV; | ||
770 | |||
771 | result = acpi_bus_register_driver(&acpi_power_driver); | ||
772 | if (result < 0) { | ||
773 | remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir); | ||
774 | return -ENODEV; | ||
775 | } | ||
776 | |||
777 | return 0; | ||
778 | } | 651 | } |