Re: [PATCH 01/11] pci: add pci_bridge_release_unused_res and pci_bus_release_unused_bridge_res

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Yinghai,

First, thank you very much for writing the summary in patch 0/11.
I feel like I finally understand what you are trying to do with
this series.

> +/*
> + * try to release pci bridge resources that is from leaf bridge,
> + * so we can allocate big new one later
> + */
> +static void __ref pci_bus_release_bridge_resources(struct pci_bus *bus,
> +						   unsigned long type,
> +						   enum release_type rel_type)
> +{
> +	struct pci_dev *dev;
> +	bool is_leaf_bridge = true;
> +
> +	list_for_each_entry(dev, &bus->devices, bus_list) {
> +		struct pci_bus *b = dev->subordinate;
> +		if (!b)
> +			continue;
> +

How about settting

		is_leaf_bridge = false;

here, and then you don't need the repeated assignments below?

> +		switch (dev->class >> 8) {
> +		case PCI_CLASS_BRIDGE_CARDBUS:
> +			is_leaf_bridge = false;
> +			break;
> +
> +		case PCI_CLASS_BRIDGE_PCI:
> +		default:
> +			is_leaf_bridge = false;
> +			if (rel_type == whole_subtree)
> +				pci_bus_release_bridge_resources(b, type,
> +							 whole_subtree);
> +			break;
> +		}
> +	}
> +
> +	/* The root bus? */
> +	if (!bus->self)
> +		return;

Won't work correctly on a non-materialized root bridge.

Use pci_is_root_bus() instead.

Thanks,
/ac
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux