mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
PCI/MSI: Simplify PCI MSI code by initializing msi_desc.nvec_used earlier
Simplify PCI MSI code by initializing msi_desc.nvec_used and msi_desc.msi_attrib.multiple when creating MSI descriptors. Also remove redundant checks in IRQ remapping drivers, PCI MSI core already guarantees these. Signed-off-by: Jiang Liu <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Grant Likely <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Yingjoe Chen <[email protected]> Cc: Yijing Wang <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
This commit is contained in:
parent
3f3cecaeaf
commit
63a7b17e3f
2 changed files with 15 additions and 33 deletions
|
|
@ -56,19 +56,13 @@ static int do_setup_msi_irqs(struct pci_dev *dev, int nvec)
|
|||
unsigned int irq;
|
||||
struct msi_desc *msidesc;
|
||||
|
||||
WARN_ON(!list_is_singular(&dev->msi_list));
|
||||
msidesc = list_entry(dev->msi_list.next, struct msi_desc, list);
|
||||
WARN_ON(msidesc->irq);
|
||||
WARN_ON(msidesc->msi_attrib.multiple);
|
||||
WARN_ON(msidesc->nvec_used);
|
||||
|
||||
irq = irq_alloc_hwirqs(nvec, dev_to_node(&dev->dev));
|
||||
if (irq == 0)
|
||||
return -ENOSPC;
|
||||
|
||||
nvec_pow2 = __roundup_pow_of_two(nvec);
|
||||
msidesc->nvec_used = nvec;
|
||||
msidesc->msi_attrib.multiple = ilog2(nvec_pow2);
|
||||
for (sub_handle = 0; sub_handle < nvec; sub_handle++) {
|
||||
if (!sub_handle) {
|
||||
index = msi_alloc_remapped_irq(dev, irq, nvec_pow2);
|
||||
|
|
@ -96,8 +90,6 @@ error:
|
|||
* IRQs from tearing down again in default_teardown_msi_irqs()
|
||||
*/
|
||||
msidesc->irq = 0;
|
||||
msidesc->nvec_used = 0;
|
||||
msidesc->msi_attrib.multiple = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue