tag | line | file | source code |
as | 528 | drivers/char/apm_bios.c | static int queue_empty(struct apm_bios_struct * as) |
as | 530 | drivers/char/apm_bios.c | return as->event_head == as->event_tail; |
as | 533 | drivers/char/apm_bios.c | static apm_event_t get_queued_event(struct apm_bios_struct * as) |
as | 535 | drivers/char/apm_bios.c | as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; |
as | 536 | drivers/char/apm_bios.c | return as->events[as->event_tail]; |
as | 541 | drivers/char/apm_bios.c | struct apm_bios_struct * as; |
as | 545 | drivers/char/apm_bios.c | for (as = user_list; as != NULL; as = as->next) { |
as | 546 | drivers/char/apm_bios.c | as->event_head = (as->event_head + 1) % APM_MAX_EVENTS; |
as | 547 | drivers/char/apm_bios.c | if (as->event_head == as->event_tail) |
as | 548 | drivers/char/apm_bios.c | as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; |
as | 549 | drivers/char/apm_bios.c | as->events[as->event_head] = event; |
as | 550 | drivers/char/apm_bios.c | if (!as->suser) |
as | 555 | drivers/char/apm_bios.c | as->suspends_pending++; |
as | 561 | drivers/char/apm_bios.c | as->standbys_pending++; |
as | 766 | drivers/char/apm_bios.c | static int check_apm_bios_struct(struct apm_bios_struct *as, const char *func) |
as | 768 | drivers/char/apm_bios.c | if ((as == NULL) || (as->magic != APM_BIOS_MAGIC)) { |
as | 777 | drivers/char/apm_bios.c | struct apm_bios_struct * as; |
as | 782 | drivers/char/apm_bios.c | as = fp->private_data; |
as | 783 | drivers/char/apm_bios.c | if (check_apm_bios_struct(as, "read")) |
as | 787 | drivers/char/apm_bios.c | if (queue_empty(as)) { |
as | 793 | drivers/char/apm_bios.c | if (queue_empty(as) |
as | 802 | drivers/char/apm_bios.c | while ((i >= sizeof(event)) && !queue_empty(as)) { |
as | 803 | drivers/char/apm_bios.c | event = get_queued_event(as); |
as | 818 | drivers/char/apm_bios.c | struct apm_bios_struct * as; |
as | 820 | drivers/char/apm_bios.c | as = fp->private_data; |
as | 821 | drivers/char/apm_bios.c | if (check_apm_bios_struct(as, "select")) |
as | 825 | drivers/char/apm_bios.c | if (!queue_empty(as)) |
as | 834 | drivers/char/apm_bios.c | struct apm_bios_struct * as; |
as | 836 | drivers/char/apm_bios.c | as = filp->private_data; |
as | 837 | drivers/char/apm_bios.c | if (check_apm_bios_struct(as, "ioctl")) |
as | 841 | drivers/char/apm_bios.c | if (as->standbys_pending > 0) { |
as | 842 | drivers/char/apm_bios.c | as->standbys_pending--; |
as | 849 | drivers/char/apm_bios.c | if (as->suspends_pending > 0) { |
as | 850 | drivers/char/apm_bios.c | as->suspends_pending--; |
as | 864 | drivers/char/apm_bios.c | struct apm_bios_struct * as; |
as | 866 | drivers/char/apm_bios.c | as = filp->private_data; |
as | 868 | drivers/char/apm_bios.c | if (check_apm_bios_struct(as, "release")) |
as | 870 | drivers/char/apm_bios.c | if (as->standbys_pending > 0) { |
as | 871 | drivers/char/apm_bios.c | standbys_pending -= as->standbys_pending; |
as | 875 | drivers/char/apm_bios.c | if (as->suspends_pending > 0) { |
as | 876 | drivers/char/apm_bios.c | suspends_pending -= as->suspends_pending; |
as | 880 | drivers/char/apm_bios.c | if (user_list == as) |
as | 881 | drivers/char/apm_bios.c | user_list = as->next; |
as | 886 | drivers/char/apm_bios.c | (as1 != NULL) && (as1->next != as); |
as | 892 | drivers/char/apm_bios.c | as1->next = as->next; |
as | 894 | drivers/char/apm_bios.c | kfree_s(as, sizeof(*as)); |
as | 899 | drivers/char/apm_bios.c | struct apm_bios_struct * as; |
as | 901 | drivers/char/apm_bios.c | as = (struct apm_bios_struct *)kmalloc(sizeof(*as), GFP_KERNEL); |
as | 902 | drivers/char/apm_bios.c | if (as == NULL) { |
as | 904 | drivers/char/apm_bios.c | sizeof(*as)); |
as | 907 | drivers/char/apm_bios.c | as->magic = APM_BIOS_MAGIC; |
as | 908 | drivers/char/apm_bios.c | as->event_tail = as->event_head = 0; |
as | 909 | drivers/char/apm_bios.c | as->suspends_pending = as->standbys_pending = 0; |
as | 910 | drivers/char/apm_bios.c | as->suser = suser(); |
as | 911 | drivers/char/apm_bios.c | as->next = user_list; |
as | 912 | drivers/char/apm_bios.c | user_list = as; |
as | 913 | drivers/char/apm_bios.c | filp->private_data = as; |