Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e8b96b2 authored by Tony Truong's avatar Tony Truong
Browse files

msm: pcie: use log2 API to round up nvec



PCIe bus driver incorrectly rounds nvec to the next
power of 2. Use log2 API to do the rounding instead.

Change-Id: Ide3a4cb200855ac5db3d75b674ed6796e8d22c92
Signed-off-by: default avatarTony Truong <truong@codeaurora.org>
parent 85a10b57
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -5094,20 +5094,6 @@ int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
		return arch_setup_msi_irq_default(pdev, desc, 1);
}

static int msm_pcie_get_msi_multiple(int nvec)
{
	int msi_multiple = 0;

	while (nvec) {
		nvec = nvec >> 1;
		msi_multiple++;
	}
	PCIE_GEN_DBG("log2 number of MSI multiple:%d\n",
		msi_multiple - 1);

	return msi_multiple - 1;
}

int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
{
	struct msi_desc *entry;
@@ -5123,7 +5109,7 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)

	list_for_each_entry(entry, &dev->dev.msi_list, list) {
		entry->msi_attrib.multiple =
				msm_pcie_get_msi_multiple(nvec);
			__ilog2_u32(__roundup_pow_of_two(nvec));

		if (pcie_dev->msi_gicm_addr)
			ret = arch_setup_msi_irq_qgic(dev, entry, nvec);