int get_ed_from_ready_q(bool f_isperiodic, ed_t **get_ed) { if(f_isperiodic) { otg_list_head *transreadyq_list_entity=NULL; if(periodic_trans_ready_q.trans_ready_entry_num==0) { return USB_ERR_NO_ENTITY; } transreadyq_list_entity = periodic_trans_ready_q.trans_ready_q_list_head.next; //if(transreadyq_list_entity!= &periodic_trans_ready_q.trans_ready_q_list_head) if(!otg_list_empty(&periodic_trans_ready_q.trans_ready_q_list_head)) { *get_ed = otg_list_get_node(transreadyq_list_entity,ed_t,trans_ready_q_list_entry); otg_list_pop(transreadyq_list_entity); periodic_trans_ready_q.trans_ready_entry_num--; return USB_ERR_SUCCESS; } else { return USB_ERR_NO_ENTITY; } } else { otg_list_head *transreadyq_list_entity=NULL; if(nonperiodic_trans_ready_q.trans_ready_entry_num==0) { return USB_ERR_NO_ENTITY; } transreadyq_list_entity = nonperiodic_trans_ready_q.trans_ready_q_list_head.next; //if(transreadyq_list_entity!= &nonperiodic_trans_ready_q.trans_ready_q_list_head) if(!otg_list_empty(&nonperiodic_trans_ready_q.trans_ready_q_list_head)) { *get_ed = otg_list_get_node(transreadyq_list_entity,ed_t, trans_ready_q_list_entry); otg_list_pop(transreadyq_list_entity); nonperiodic_trans_ready_q.trans_ready_entry_num--; return USB_ERR_SUCCESS; } else { return USB_ERR_NO_ENTITY; } } }
static int get_ed_from_ready_q(struct ed **get_ed, bool is_periodic) { otg_list_head *qlist = NULL; /* periodic transfer : control and bulk */ if (is_periodic) { if (periodic_trans_ready_q.entity_num == 0) return USB_ERR_NO_ENTITY; qlist = periodic_trans_ready_q.entity_list.next; if (!otg_list_empty(&periodic_trans_ready_q.entity_list)) { *get_ed = otg_list_get_node(qlist, struct ed, readyq_list); if (qlist->prev == LIST_POISON2 || qlist->next == LIST_POISON1) { printk(KERN_ERR "shost scheduler: get_ed_from_ready_q error\n"); periodic_trans_ready_q.entity_num = 0; } else { otg_list_pop(qlist); periodic_trans_ready_q.entity_num--; get_ed[0]->ed_status.is_in_transfer_ready_q = false; } return USB_ERR_SUCCESS; } else return USB_ERR_NO_ENTITY;