Lines Matching refs:head

312 static int sort_by_size(struct pci_resource **head)  in sort_by_size()  argument
318 if (!(*head)) in sort_by_size()
321 if (!((*head)->next)) in sort_by_size()
328 if (((*head)->next) && in sort_by_size()
329 ((*head)->length > (*head)->next->length)) { in sort_by_size()
331 current_res = *head; in sort_by_size()
332 *head = (*head)->next; in sort_by_size()
333 current_res->next = (*head)->next; in sort_by_size()
334 (*head)->next = current_res; in sort_by_size()
337 current_res = *head; in sort_by_size()
360 static int sort_by_max_size(struct pci_resource **head) in sort_by_max_size() argument
366 if (!(*head)) in sort_by_max_size()
369 if (!((*head)->next)) in sort_by_max_size()
376 if (((*head)->next) && in sort_by_max_size()
377 ((*head)->length < (*head)->next->length)) { in sort_by_max_size()
379 current_res = *head; in sort_by_max_size()
380 *head = (*head)->next; in sort_by_max_size()
381 current_res->next = (*head)->next; in sort_by_max_size()
382 (*head)->next = current_res; in sort_by_max_size()
385 current_res = *head; in sort_by_max_size()
410 static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head, in do_pre_bridge_resource_split() argument
420 if (!(*head) || !(*orig_head)) in do_pre_bridge_resource_split()
423 rc = cpqhp_resource_sort_and_combine(head); in do_pre_bridge_resource_split()
428 if ((*head)->base != (*orig_head)->base) in do_pre_bridge_resource_split()
431 if ((*head)->length == (*orig_head)->length) in do_pre_bridge_resource_split()
439 node = *head; in do_pre_bridge_resource_split()
459 *head = split_node; in do_pre_bridge_resource_split()
467 if (*head == node) { in do_pre_bridge_resource_split()
468 *head = node->next; in do_pre_bridge_resource_split()
470 prevnode = *head; in do_pre_bridge_resource_split()
487 static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment) in do_bridge_resource_split() argument
494 rc = cpqhp_resource_sort_and_combine(head); in do_bridge_resource_split()
499 node = *head; in do_bridge_resource_split()
540 static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size) in get_io_resource() argument
547 if (!(*head)) in get_io_resource()
550 if (cpqhp_resource_sort_and_combine(head)) in get_io_resource()
553 if (sort_by_size(head)) in get_io_resource()
556 for (node = *head; node; node = node->next) { in get_io_resource()
611 if (*head == node) { in get_io_resource()
612 *head = node->next; in get_io_resource()
614 prevnode = *head; in get_io_resource()
637 static struct pci_resource *get_max_resource(struct pci_resource **head, u32 size) in get_max_resource() argument
644 if (cpqhp_resource_sort_and_combine(head)) in get_max_resource()
647 if (sort_by_max_size(head)) in get_max_resource()
650 for (max = *head; max; max = max->next) { in get_max_resource()
704 temp = *head; in get_max_resource()
706 *head = max->next; in get_max_resource()
734 static struct pci_resource *get_resource(struct pci_resource **head, u32 size) in get_resource() argument
741 if (cpqhp_resource_sort_and_combine(head)) in get_resource()
744 if (sort_by_size(head)) in get_resource()
747 for (node = *head; node; node = node->next) { in get_resource()
801 if (*head == node) { in get_resource()
802 *head = node->next; in get_resource()
804 prevnode = *head; in get_resource()
827 int cpqhp_resource_sort_and_combine(struct pci_resource **head) in cpqhp_resource_sort_and_combine() argument
833 dbg("%s: head = %p, *head = %p\n", __func__, head, *head); in cpqhp_resource_sort_and_combine()
835 if (!(*head)) in cpqhp_resource_sort_and_combine()
838 dbg("*head->next = %p\n",(*head)->next); in cpqhp_resource_sort_and_combine()
840 if (!(*head)->next) in cpqhp_resource_sort_and_combine()
843 dbg("*head->base = 0x%x\n",(*head)->base); in cpqhp_resource_sort_and_combine()
844 dbg("*head->next->base = 0x%x\n",(*head)->next->base); in cpqhp_resource_sort_and_combine()
849 if (((*head)->next) && in cpqhp_resource_sort_and_combine()
850 ((*head)->base > (*head)->next->base)) { in cpqhp_resource_sort_and_combine()
851 node1 = *head; in cpqhp_resource_sort_and_combine()
852 (*head) = (*head)->next; in cpqhp_resource_sort_and_combine()
853 node1->next = (*head)->next; in cpqhp_resource_sort_and_combine()
854 (*head)->next = node1; in cpqhp_resource_sort_and_combine()
858 node1 = (*head); in cpqhp_resource_sort_and_combine()
873 node1 = *head; in cpqhp_resource_sort_and_combine()