Commit a89d7e43 authored by Bjorn Helgaas's avatar Bjorn Helgaas

Merge branch 'pci/host-altera' into next

* pci/host-altera:
  PCI: altera: Fix platform_get_irq() error handling
  PCI: altera: Use size=4 IRQ domain for legacy INTx
  PCI: altera: Remove unused num_of_vectors variable
parents 741e2237 ef75369a
...@@ -64,13 +64,11 @@ static void altera_msi_isr(struct irq_desc *desc) ...@@ -64,13 +64,11 @@ static void altera_msi_isr(struct irq_desc *desc)
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
struct altera_msi *msi; struct altera_msi *msi;
unsigned long status; unsigned long status;
u32 num_of_vectors;
u32 bit; u32 bit;
u32 virq; u32 virq;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
msi = irq_desc_get_handler_data(desc); msi = irq_desc_get_handler_data(desc);
num_of_vectors = msi->num_of_vectors;
while ((status = msi_readl(msi, MSI_STATUS)) != 0) { while ((status = msi_readl(msi, MSI_STATUS)) != 0) {
for_each_set_bit(bit, &status, msi->num_of_vectors) { for_each_set_bit(bit, &status, msi->num_of_vectors) {
...@@ -267,9 +265,9 @@ static int altera_msi_probe(struct platform_device *pdev) ...@@ -267,9 +265,9 @@ static int altera_msi_probe(struct platform_device *pdev)
return ret; return ret;
msi->irq = platform_get_irq(pdev, 0); msi->irq = platform_get_irq(pdev, 0);
if (msi->irq <= 0) { if (msi->irq < 0) {
dev_err(&pdev->dev, "failed to map IRQ: %d\n", msi->irq); dev_err(&pdev->dev, "failed to map IRQ: %d\n", msi->irq);
ret = -ENODEV; ret = msi->irq;
goto err; goto err;
} }
......
...@@ -76,8 +76,6 @@ ...@@ -76,8 +76,6 @@
#define LINK_UP_TIMEOUT HZ #define LINK_UP_TIMEOUT HZ
#define LINK_RETRAIN_TIMEOUT HZ #define LINK_RETRAIN_TIMEOUT HZ
#define INTX_NUM 4
#define DWORD_MASK 3 #define DWORD_MASK 3
struct altera_pcie { struct altera_pcie {
...@@ -464,6 +462,7 @@ static int altera_pcie_intx_map(struct irq_domain *domain, unsigned int irq, ...@@ -464,6 +462,7 @@ static int altera_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
static const struct irq_domain_ops intx_domain_ops = { static const struct irq_domain_ops intx_domain_ops = {
.map = altera_pcie_intx_map, .map = altera_pcie_intx_map,
.xlate = pci_irqd_intx_xlate,
}; };
static void altera_pcie_isr(struct irq_desc *desc) static void altera_pcie_isr(struct irq_desc *desc)
...@@ -481,11 +480,11 @@ static void altera_pcie_isr(struct irq_desc *desc) ...@@ -481,11 +480,11 @@ static void altera_pcie_isr(struct irq_desc *desc)
while ((status = cra_readl(pcie, P2A_INT_STATUS) while ((status = cra_readl(pcie, P2A_INT_STATUS)
& P2A_INT_STS_ALL) != 0) { & P2A_INT_STS_ALL) != 0) {
for_each_set_bit(bit, &status, INTX_NUM) { for_each_set_bit(bit, &status, PCI_NUM_INTX) {
/* clear interrupts */ /* clear interrupts */
cra_writel(pcie, 1 << bit, P2A_INT_STATUS); cra_writel(pcie, 1 << bit, P2A_INT_STATUS);
virq = irq_find_mapping(pcie->irq_domain, bit + 1); virq = irq_find_mapping(pcie->irq_domain, bit);
if (virq) if (virq)
generic_handle_irq(virq); generic_handle_irq(virq);
else else
...@@ -536,7 +535,7 @@ static int altera_pcie_init_irq_domain(struct altera_pcie *pcie) ...@@ -536,7 +535,7 @@ static int altera_pcie_init_irq_domain(struct altera_pcie *pcie)
struct device_node *node = dev->of_node; struct device_node *node = dev->of_node;
/* Setup INTx */ /* Setup INTx */
pcie->irq_domain = irq_domain_add_linear(node, INTX_NUM + 1, pcie->irq_domain = irq_domain_add_linear(node, PCI_NUM_INTX,
&intx_domain_ops, pcie); &intx_domain_ops, pcie);
if (!pcie->irq_domain) { if (!pcie->irq_domain) {
dev_err(dev, "Failed to get a INTx IRQ domain\n"); dev_err(dev, "Failed to get a INTx IRQ domain\n");
...@@ -559,9 +558,9 @@ static int altera_pcie_parse_dt(struct altera_pcie *pcie) ...@@ -559,9 +558,9 @@ static int altera_pcie_parse_dt(struct altera_pcie *pcie)
/* setup IRQ */ /* setup IRQ */
pcie->irq = platform_get_irq(pdev, 0); pcie->irq = platform_get_irq(pdev, 0);
if (pcie->irq <= 0) { if (pcie->irq < 0) {
dev_err(dev, "failed to get IRQ: %d\n", pcie->irq); dev_err(dev, "failed to get IRQ: %d\n", pcie->irq);
return -EINVAL; return pcie->irq;
} }
irq_set_chained_handler_and_data(pcie->irq, altera_pcie_isr, pcie); irq_set_chained_handler_and_data(pcie->irq, altera_pcie_isr, pcie);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment