Messages in this thread | | | Date | Tue, 16 Feb 2021 18:53:03 +0100 | From | Krzysztof Wilczyński <> | Subject | Re: [PATCH v3 1/4] PCI: Introduce pcim_alloc_irq_vectors() |
| |
Hi Dejin,
> Introduce pcim_alloc_irq_vectors(), a device-managed version of > pci_alloc_irq_vectors(). Introducing this function can simplify > the error handling path in many drivers. > > And use pci_free_irq_vectors() to replace some code in pcim_release(), > they are equivalent, and no functional change. It is more explicit > that pcim_alloc_irq_vectors() is a device-managed function. [...]
Some suggestions about the commit message as per:
https://lore.kernel.org/linux-pci/YCwE2cf9X%2FGd6lWy@rocinante/
> +/** > + * pcim_alloc_irq_vectors - a device-managed pci_alloc_irq_vectors() > + * @dev: PCI device to operate on > + * @min_vecs: minimum number of vectors required (must be >= 1) > + * @max_vecs: maximum (desired) number of vectors > + * @flags: flags or quirks for the allocation > + * > + * Return the number of vectors allocated, (which might be smaller than > + * @max_vecs) if successful, or a negative error code on error. If less > + * than @min_vecs interrupt vectors are available for @dev the function > + * will fail with -ENOSPC. > + * > + * It depends on calling pcim_enable_device() to make IRQ resources > + * manageable. > + */ > +int pcim_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, > + unsigned int max_vecs, unsigned int flags) > +{ > + struct pci_devres *dr; > + > + dr = find_pci_dr(dev); > + if (!dr || !dr->enabled) > + return -EINVAL; > + > + return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags); > +} > +EXPORT_SYMBOL(pcim_alloc_irq_vectors); [...]
Looks good! Thank you for adding kernel-doc here! Much appreciated.
Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
Krzysztof
| |