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

Commit a348d015 authored by Gustavo Pimentel's avatar Gustavo Pimentel Committed by Lorenzo Pieralisi
Browse files

PCI: dwc: Improve code readability and simplify mask/unmask operations



Improve code readability and simplifies mask/unmask operations by
inverting the applied logic (no functional change is intended).

Replace variable name from irq_status to irq_mask, since its goal is to
keep track of which interrupts are masked or not.

Signed-off-by: default avatarGustavo Pimentel <gustavo.pimentel@synopsys.com>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Jingoo Han <jingoohan1@gmail.com>
parent 4cfae0f1
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -164,9 +164,9 @@ static void dw_pci_bottom_mask(struct irq_data *d)
		res = ctrl * MSI_REG_CTRL_BLOCK_SIZE;
		bit = d->hwirq % MAX_MSI_IRQS_PER_CTRL;

		pp->irq_status[ctrl] &= ~(1 << bit);
		pp->irq_mask[ctrl] |= (1 << bit);
		dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + res, 4,
				    ~pp->irq_status[ctrl]);
				    pp->irq_mask[ctrl]);
	}

	raw_spin_unlock_irqrestore(&pp->lock, flags);
@@ -187,9 +187,9 @@ static void dw_pci_bottom_unmask(struct irq_data *d)
		res = ctrl * MSI_REG_CTRL_BLOCK_SIZE;
		bit = d->hwirq % MAX_MSI_IRQS_PER_CTRL;

		pp->irq_status[ctrl] |= 1 << bit;
		pp->irq_mask[ctrl] &= ~(1 << bit);
		dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK + res, 4,
				    ~pp->irq_status[ctrl]);
				    pp->irq_mask[ctrl]);
	}

	raw_spin_unlock_irqrestore(&pp->lock, flags);
@@ -665,13 +665,13 @@ void dw_pcie_setup_rc(struct pcie_port *pp)

	/* Initialize IRQ Status array */
	for (ctrl = 0; ctrl < num_ctrls; ctrl++) {
		pp->irq_mask[ctrl] = ~0;
		dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_MASK +
					(ctrl * MSI_REG_CTRL_BLOCK_SIZE),
				    4, ~0);
				    4, pp->irq_mask[ctrl]);
		dw_pcie_wr_own_conf(pp, PCIE_MSI_INTR0_ENABLE +
					(ctrl * MSI_REG_CTRL_BLOCK_SIZE),
				    4, ~0);
		pp->irq_status[ctrl] = 0;
	}

	/* Setup RC BARs */
+1 −1
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ struct pcie_port {
	struct irq_domain	*msi_domain;
	dma_addr_t		msi_data;
	u32			num_vectors;
	u32			irq_status[MAX_MSI_CTRLS];
	u32			irq_mask[MAX_MSI_CTRLS];
	raw_spinlock_t		lock;
	DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS);
};