diff mbox series

PCI: brcmstb: Do not use __GENMASK

Message ID 20211122190459.3189616-1-f.fainelli@gmail.com (mailing list archive)
State New, archived
Headers show
Series PCI: brcmstb: Do not use __GENMASK | expand

Commit Message

Florian Fainelli Nov. 22, 2021, 7:04 p.m. UTC
Define the legacy MSI intterupt bitmask as well as the non-legacy
interrupt bitmask using GENMASK and then use them in brcm_msi_set_regs()
in place of __GENMASK().

Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/pci/controller/pcie-brcmstb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Andy Shevchenko Nov. 22, 2021, 7:26 p.m. UTC | #1
On Mon, Nov 22, 2021 at 9:07 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>
> Define the legacy MSI intterupt bitmask as well as the non-legacy

interrupt

> interrupt bitmask using GENMASK and then use them in brcm_msi_set_regs()
> in place of __GENMASK().

LGTM, thanks!
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/pci/controller/pcie-brcmstb.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index 1fc7bd49a7ad..3391b4135b65 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -144,6 +144,9 @@
>  #define BRCM_INT_PCI_MSI_NR            32
>  #define BRCM_INT_PCI_MSI_LEGACY_NR     8
>  #define BRCM_INT_PCI_MSI_SHIFT         0
> +#define BRCM_INT_PCI_MSI_MASK          GENMASK(BRCM_INT_PCI_MSI_NR - 1, 0)
> +#define BRCM_INT_PCI_MSI_LEGACY_MASK   GENMASK(31, \
> +                                               32 - BRCM_INT_PCI_MSI_LEGACY_NR)
>
>  /* MSI target addresses */
>  #define BRCM_MSI_TARGET_ADDR_LT_4GB    0x0fffffffcULL
> @@ -619,7 +622,8 @@ 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 = msi->legacy ? BRCM_INT_PCI_MSI_LEGACY_MASK :
> +                               BRCM_INT_PCI_MSI_MASK;
>
>         writel(val, msi->intr_base + MSI_INT_MASK_CLR);
>         writel(val, msi->intr_base + MSI_INT_CLR);
> --
> 2.25.1
>
Lorenzo Pieralisi Dec. 1, 2021, 4:37 p.m. UTC | #2
On Mon, 22 Nov 2021 11:04:58 -0800, Florian Fainelli wrote:
> Define the legacy MSI intterupt bitmask as well as the non-legacy
> interrupt bitmask using GENMASK and then use them in brcm_msi_set_regs()
> in place of __GENMASK().
> 
> 

Applied to pci/brcmstb, thanks!

[1/1] PCI: brcmstb: Do not use __GENMASK
      https://git.kernel.org/lpieralisi/pci/c/53c6ccfa65

Thanks,
Lorenzo
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 1fc7bd49a7ad..3391b4135b65 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -144,6 +144,9 @@ 
 #define BRCM_INT_PCI_MSI_NR		32
 #define BRCM_INT_PCI_MSI_LEGACY_NR	8
 #define BRCM_INT_PCI_MSI_SHIFT		0
+#define BRCM_INT_PCI_MSI_MASK		GENMASK(BRCM_INT_PCI_MSI_NR - 1, 0)
+#define BRCM_INT_PCI_MSI_LEGACY_MASK	GENMASK(31, \
+						32 - BRCM_INT_PCI_MSI_LEGACY_NR)
 
 /* MSI target addresses */
 #define BRCM_MSI_TARGET_ADDR_LT_4GB	0x0fffffffcULL
@@ -619,7 +622,8 @@  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 = msi->legacy ? BRCM_INT_PCI_MSI_LEGACY_MASK :
+				BRCM_INT_PCI_MSI_MASK;
 
 	writel(val, msi->intr_base + MSI_INT_MASK_CLR);
 	writel(val, msi->intr_base + MSI_INT_CLR);