Re: [PATCH v8 4/8] PCI/portdrv: Create pcie_is_port_dev() func from existing code
From: Krzysztof Wilczyński
Date: Thu Nov 11 2021 - 18:50:59 EST
Hi Jim,
[...]
> +bool pcie_is_port_dev(struct pci_dev *dev)
> +{
> + int type;
> +
> + if (!dev)
> + return false;
> +
> + type = pci_pcie_type(dev);
> +
> + return pci_is_pcie(dev) &&
> + ((type == PCI_EXP_TYPE_ROOT_PORT) ||
> + (type == PCI_EXP_TYPE_UPSTREAM) ||
> + (type == PCI_EXP_TYPE_DOWNSTREAM) ||
> + (type == PCI_EXP_TYPE_RC_EC));
> +}
> +EXPORT_SYMBOL_GPL(pcie_is_port_dev);
It would be really nice to document what the above function does (not that
some of the logic has been extracted from other function). You know, for
the future generations of kernel hackers.
Krzysztof