taglinefilesource code
as528drivers/char/apm_bios.cstatic int queue_empty(struct apm_bios_struct * as)
as530drivers/char/apm_bios.creturn as->event_head == as->event_tail;
as533drivers/char/apm_bios.cstatic apm_event_t get_queued_event(struct apm_bios_struct * as)
as535drivers/char/apm_bios.cas->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS;
as536drivers/char/apm_bios.creturn as->events[as->event_tail];
as541drivers/char/apm_bios.cstruct apm_bios_struct *  as;
as545drivers/char/apm_bios.cfor (as = user_list; as != NULL; as = as->next) {
as546drivers/char/apm_bios.cas->event_head = (as->event_head + 1) % APM_MAX_EVENTS;
as547drivers/char/apm_bios.cif (as->event_head == as->event_tail)
as548drivers/char/apm_bios.cas->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS;
as549drivers/char/apm_bios.cas->events[as->event_head] = event;
as550drivers/char/apm_bios.cif (!as->suser)
as555drivers/char/apm_bios.cas->suspends_pending++;
as561drivers/char/apm_bios.cas->standbys_pending++;
as766drivers/char/apm_bios.cstatic int check_apm_bios_struct(struct apm_bios_struct *as, const char *func)
as768drivers/char/apm_bios.cif ((as == NULL) || (as->magic != APM_BIOS_MAGIC)) {
as777drivers/char/apm_bios.cstruct apm_bios_struct *  as;
as782drivers/char/apm_bios.cas = fp->private_data;
as783drivers/char/apm_bios.cif (check_apm_bios_struct(as, "read"))
as787drivers/char/apm_bios.cif (queue_empty(as)) {
as793drivers/char/apm_bios.cif (queue_empty(as)
as802drivers/char/apm_bios.cwhile ((i >= sizeof(event)) && !queue_empty(as)) {
as803drivers/char/apm_bios.cevent = get_queued_event(as);
as818drivers/char/apm_bios.cstruct apm_bios_struct *  as;
as820drivers/char/apm_bios.cas = fp->private_data;
as821drivers/char/apm_bios.cif (check_apm_bios_struct(as, "select"))
as825drivers/char/apm_bios.cif (!queue_empty(as))
as834drivers/char/apm_bios.cstruct apm_bios_struct *  as;
as836drivers/char/apm_bios.cas = filp->private_data;
as837drivers/char/apm_bios.cif (check_apm_bios_struct(as, "ioctl"))
as841drivers/char/apm_bios.cif (as->standbys_pending > 0) {
as842drivers/char/apm_bios.cas->standbys_pending--;
as849drivers/char/apm_bios.cif (as->suspends_pending > 0) {
as850drivers/char/apm_bios.cas->suspends_pending--;
as864drivers/char/apm_bios.cstruct apm_bios_struct *  as;
as866drivers/char/apm_bios.cas = filp->private_data;
as868drivers/char/apm_bios.cif (check_apm_bios_struct(as, "release"))
as870drivers/char/apm_bios.cif (as->standbys_pending > 0) {
as871drivers/char/apm_bios.cstandbys_pending -= as->standbys_pending;
as875drivers/char/apm_bios.cif (as->suspends_pending > 0) {
as876drivers/char/apm_bios.csuspends_pending -= as->suspends_pending;
as880drivers/char/apm_bios.cif (user_list == as)
as881drivers/char/apm_bios.cuser_list = as->next;
as886drivers/char/apm_bios.c(as1 != NULL) && (as1->next != as);
as892drivers/char/apm_bios.cas1->next = as->next;
as894drivers/char/apm_bios.ckfree_s(as, sizeof(*as));
as899drivers/char/apm_bios.cstruct apm_bios_struct *  as;
as901drivers/char/apm_bios.cas = (struct apm_bios_struct *)kmalloc(sizeof(*as), GFP_KERNEL);
as902drivers/char/apm_bios.cif (as == NULL) {
as904drivers/char/apm_bios.csizeof(*as));
as907drivers/char/apm_bios.cas->magic = APM_BIOS_MAGIC;
as908drivers/char/apm_bios.cas->event_tail = as->event_head = 0;
as909drivers/char/apm_bios.cas->suspends_pending = as->standbys_pending = 0;
as910drivers/char/apm_bios.cas->suser = suser();
as911drivers/char/apm_bios.cas->next = user_list;
as912drivers/char/apm_bios.cuser_list = as;
as913drivers/char/apm_bios.cfilp->private_data = as;