From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Cc: linux-pci@vger.kernel.org, Joao Pinto <joao.pinto@synopsys.com>,
Jingoo Han <jingoohan1@gmail.com>
Subject: Re: [PATCH 7/9] PCI: dwc: Improve code readability and simplifies mask/unmask operations
Date: Thu, 31 Jan 2019 16:22:59 +0000 [thread overview]
Message-ID: <20190131162259.GB28941@e107981-ln.cambridge.arm.com> (raw)
In-Reply-To: <eba21fed997cdf148bc03cb459c12d1a32a77a8f.1547631485.git.gustavo.pimentel@synopsys.com>
On Wed, Jan 16, 2019 at 11:14:20AM +0100, Gustavo Pimentel wrote:
> 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 interuptions are mask or not.
>
> Replace bit rotation operation (1 << bit) by BIT(bit), which simplifies
> code reading.
Two changes, two patches, I know it is tempting to squash trivial
changes in one patch but logically that's not correct.
Lorenzo
> Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Joao Pinto <jpinto@synopsys.com>
> Cc: Jingoo Han <jingoohan1@gmail.com>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++------
> drivers/pci/controller/dwc/pcie-designware.h | 2 +-
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 768e16a..d53e6f7 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -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] |= BIT(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] &= ~BIT(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 */
> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
> index 9943d8c..2790002 100644
> --- a/drivers/pci/controller/dwc/pcie-designware.h
> +++ b/drivers/pci/controller/dwc/pcie-designware.h
> @@ -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);
> };
> --
> 2.7.4
>
next prev parent reply other threads:[~2019-01-31 16:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-16 10:14 [PATCH 0/9] Improve Synopsys DesignWare Root Complex driver code Gustavo Pimentel
2019-01-16 10:14 ` [PATCH 1/9] PCI: dwc: Remove unnecessary header include (of_gpio.h) Gustavo Pimentel
2019-01-16 10:14 ` [PATCH 2/9] PCI: dwc: Remove unnecessary header include (signal.h) Gustavo Pimentel
2019-01-16 10:14 ` [PATCH 3/9] PCI: dwc: Replace variable name from data to d on dw_pci_bottom_mask/unmask() Gustavo Pimentel
2019-01-31 16:21 ` Lorenzo Pieralisi
2019-01-16 10:14 ` [PATCH 4/9] PCI: dwc: Replace variable name from data to d on dw_pci_setup_msi_msg() Gustavo Pimentel
2019-01-16 10:14 ` [PATCH 5/9] PCI: dwc: Replace variable name from data to d on dw_pci_msi_set_affinity() Gustavo Pimentel
2019-01-16 10:14 ` [PATCH 6/9] PCI: dwc: Replace variable name from data to d on dw_pcie_irq_domain_free() Gustavo Pimentel
2019-01-16 10:14 ` [PATCH 7/9] PCI: dwc: Improve code readability and simplifies mask/unmask operations Gustavo Pimentel
2019-01-31 16:22 ` Lorenzo Pieralisi [this message]
2019-01-31 18:00 ` Gustavo Pimentel
2019-01-16 10:14 ` [PATCH 8/9] PCI: dwc: Replace bit rotation operation (1 << bit) by BIT(bit) Gustavo Pimentel
2019-01-16 10:14 ` [PATCH 9/9] PCI: dwc: Add pcie port pointer validation Gustavo Pimentel
2019-01-31 16:51 ` Lorenzo Pieralisi
2019-01-31 17:37 ` Gustavo Pimentel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190131162259.GB28941@e107981-ln.cambridge.arm.com \
--to=lorenzo.pieralisi@arm.com \
--cc=gustavo.pimentel@synopsys.com \
--cc=jingoohan1@gmail.com \
--cc=joao.pinto@synopsys.com \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).