Re: [PATCH 08/11] pci: pciehp second try to get big range for pcie devices

Alex Chiang
2010-01-16T04:52:23Z

Code looks ok, just need to fix up some of the explanations.

> handle the case the slot bridge that doesn't get pre-allocated big enough res
> from FW.

Please change "res" to "resource" for changelog posterity.

> @@ -1009,12 +1009,60 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
> {
> struct pci_bus *bus;
> struct pci_bus *parent = bridge->subordinate;
> + bool second_tried = false;

second_try ?

> + struct resource_list_x head, *list;
> int retval;
> + unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
> + IORESOURCE_PREFETCH;
> +
> + head.next = NULL;
>
> +again:
> pci_bus_size_bridges(parent);
> - __pci_bridge_assign_resources(bridge, NULL);
> + __pci_bridge_assign_resources(bridge, &head);
> retval = pci_reenable_device(bridge);
> pci_set_master(bridge);
> pci_enable_bridges(parent);
> +
> + /* any device complain? */
> + if (!head.next)
> + return;
> +
> + if (second_tried) {
> + /* still fail, don't need to try more */
> + free_failed_list(&head);
> + return;
> + }
> +
> + second_tried = true;
> + printk(KERN_DEBUG "PCI: second try to assign unassigned res\n");

res -> resource

> + /*
> + * Try to release leaf bridge's resources that doesn't fit resource of
> + * child device under that bridge
> + */
> + for (list = head.next; list;) {
> + unsigned long flags = list->flags;
> +
> + bus = list->dev->bus;
> + pci_bus_release_bridge_resources(bus, flags & type_mask,
> + whole_subtree);
> + list = list->next;
> + }
> + /* retore size and flags */

retore -> restore

/ac