Re: [PATCH] pcie: Ensure hotplug ports have a minimum number of resources.

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

 



Eric W. Biederman wrote:
> In general a BIOS may goof or we may hotplug in a hotplug controller.
> In either case the kernel needs to reserve resources for plugging
> in more devices in the future instead of creating a minimal resource
> assignment.
> 
> We already do this for cardbus bridges I am just adding a variant
> for pcie bridges.

> +static int is_pci_hotplug_bridge(struct pci_bus *bus)
> +{
> +	struct pci_dev *bridge = bus->self;
> +	int pos;
> +
> +	/* Test for a generic pci hotplug bridge */
> +	pos = pci_find_capability(bridge, PCI_CAP_ID_EXP);
> +	if (pos) {
> +		u32 reg32;
> +		u16 reg16;
> +		pci_read_config_word(bridge, pos + PCI_EXP_FLAGS, &reg16);
> +		if (reg16 & PCI_EXP_FLAGS_SLOT) {
> +			pci_read_config_dword(bridge,
> +				pos + PCI_EXP_SLTCAP, &reg32);
> +			if (reg32 & PCI_EXP_SLTCAP_HPC)
> +				return 1;
> +		}
> +	}
> +	return 0;
> +}

Can that return "bool"?

Eike

Attachment: signature.asc
Description: This is a digitally signed message part.


[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