Lines Matching refs:head
296 * @head: list to sort
298 static int sort_by_size(struct pci_resource **head)
304 if (!(*head))
307 if (!((*head)->next))
313 /* Special case for swapping list head */
314 if (((*head)->next) &&
315 ((*head)->length > (*head)->next->length)) {
317 current_res = *head;
318 *head = (*head)->next;
319 current_res->next = (*head)->next;
320 (*head)->next = current_res;
323 current_res = *head;
344 * @head: list to sort
346 static int sort_by_max_size(struct pci_resource **head)
352 if (!(*head))
355 if (!((*head)->next))
361 /* Special case for swapping list head */
362 if (((*head)->next) &&
363 ((*head)->length < (*head)->next->length)) {
365 current_res = *head;
366 *head = (*head)->next;
367 current_res->next = (*head)->next;
368 (*head)->next = current_res;
371 current_res = *head;
392 * @head: new list head
393 * @orig_head: original list head
396 static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head,
406 if (!(*head) || !(*orig_head))
409 rc = cpqhp_resource_sort_and_combine(head);
414 if ((*head)->base != (*orig_head)->base)
417 if ((*head)->length == (*orig_head)->length)
425 node = *head;
445 *head = split_node;
453 if (*head == node) {
454 *head = node->next;
456 prevnode = *head;
470 * @head: list head
473 static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment)
480 rc = cpqhp_resource_sort_and_combine(head);
485 node = *head;
519 * @head: list to search
526 static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size)
533 if (!(*head))
536 if (cpqhp_resource_sort_and_combine(head))
539 if (sort_by_size(head))
542 for (node = *head; node; node = node->next) {
597 if (*head == node) {
598 *head = node->next;
600 prevnode = *head;
616 * @head: the list to search the node in
620 * list pointed to by head. It aligns the node on top and bottom
623 static struct pci_resource *get_max_resource(struct pci_resource **head, u32 size)
630 if (cpqhp_resource_sort_and_combine(head))
633 if (sort_by_max_size(head))
636 for (max = *head; max; max = max->next) {
690 temp = *head;
692 *head = max->next;
711 * @head: the list to search for resources
720 static struct pci_resource *get_resource(struct pci_resource **head, u32 size)
727 if (cpqhp_resource_sort_and_combine(head))
730 if (sort_by_size(head))
733 for (node = *head; node; node = node->next) {
787 if (*head == node) {
788 *head = node->next;
790 prevnode = *head;
805 * @head: the list to sort and clean up
813 int cpqhp_resource_sort_and_combine(struct pci_resource **head)
819 dbg("%s: head = %p, *head = %p\n", __func__, head, *head);
821 if (!(*head))
824 dbg("*head->next = %p\n", (*head)->next);
826 if (!(*head)->next)
829 dbg("*head->base = 0x%x\n", (*head)->base);
830 dbg("*head->next->base = 0x%x\n", (*head)->next->base);
834 /* Special case for swapping list head */
835 if (((*head)->next) &&
836 ((*head)->base > (*head)->next->base)) {
837 node1 = *head;
838 (*head) = (*head)->next;
839 node1->next = (*head)->next;
840 (*head)->next = node1;
844 node1 = (*head);
859 node1 = *head;