linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] PCI: brcmstb: Use BIT() as __GENMASK() is for internal use only
@ 2021-11-15 11:20 Andy Shevchenko
  2021-11-15 11:57 ` Krzysztof Wilczyński
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Andy Shevchenko @ 2021-11-15 11:20 UTC (permalink / raw)
  To: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-pci, linux-kernel
  Cc: Jim Quinlan, Nicolas Saenz Julienne, Florian Fainelli,
	Lorenzo Pieralisi, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, Andy Shevchenko

Use BIT() as __GENMASK() is for internal use only. The rationale
of switching to BIT() is to provide better generated code. The
GENMASK() against non-constant numbers may produce an ugly assembler
code. On contrary the BIT() is simply converted to corresponding shift
operation.

Note, it's the only user of __GENMASK() in the kernel outside of its own realm.

Fixes: 3baec684a531 ("PCI: brcmstb: Accommodate MSI for older chips")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: switched to BIT() and elaborated why, hence not included tag
 drivers/pci/controller/pcie-brcmstb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 1fc7bd49a7ad..0c49fc65792c 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -619,7 +619,7 @@ static void brcm_msi_remove(struct brcm_pcie *pcie)
 
 static void brcm_msi_set_regs(struct brcm_msi *msi)
 {
-	u32 val = __GENMASK(31, msi->legacy_shift);
+	u32 val = ~(BIT(msi->legacy_shift) - 1);
 
 	writel(val, msi->intr_base + MSI_INT_MASK_CLR);
 	writel(val, msi->intr_base + MSI_INT_CLR);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-12-01 17:14 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 11:20 [PATCH v2 1/1] PCI: brcmstb: Use BIT() as __GENMASK() is for internal use only Andy Shevchenko
2021-11-15 11:57 ` Krzysztof Wilczyński
2021-11-15 13:59 ` Robin Murphy
2021-11-15 14:14   ` Andy Shevchenko
2021-11-15 14:39     ` Andy Shevchenko
2021-11-16 18:20       ` Rob Herring
2021-11-16 20:41         ` Florian Fainelli
2021-11-16 20:56           ` Florian Fainelli
2021-11-17 10:37             ` Andy Shevchenko
2021-11-17 22:46             ` Rob Herring
2021-11-16 20:38 ` Florian Fainelli
2021-11-17 12:42   ` Andy Shevchenko
2021-12-01 15:53 ` Lorenzo Pieralisi
2021-12-01 16:01   ` Andy Shevchenko
2021-12-01 17:13     ` Lorenzo Pieralisi

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).