All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] PCI: dwc: dra7xx: Fix compilation warning.
@ 2017-06-15  6:22 Arvind Yadav
  2017-06-15  7:28   ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 3+ messages in thread
From: Arvind Yadav @ 2017-06-15  6:22 UTC (permalink / raw)
  To: kishon, bhelgaas; +Cc: linux-omap, linux-pci, linux-kernel

drivers/pci/dwc/pci-dra7xx.c: In function ‘dra7xx_pcie_enable_msi_interrupts’:
drivers/pci/dwc/pci-dra7xx.c:177:7: warning: large integer implicitly truncated to unsigned type [-Woverflow]
       ~LEG_EP_INTERRUPTS & ~MSI);
       ^
drivers/pci/dwc/pci-dra7xx.c: In function ‘dra7xx_pcie_enable_wrapper_interrupts’:
drivers/pci/dwc/pci-dra7xx.c:187:7: warning: large integer implicitly truncated to unsigned type [-Woverflow]
       ~INTERRUPTS);

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>

Changes in v2:
             Add casts in the definitions.
---
 drivers/pci/dwc/pci-dra7xx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/dwc/pci-dra7xx.c b/drivers/pci/dwc/pci-dra7xx.c
index 8decf46..0286d6d 100644
--- a/drivers/pci/dwc/pci-dra7xx.c
+++ b/drivers/pci/dwc/pci-dra7xx.c
@@ -48,7 +48,7 @@
 #define	LINK_UP_EVT					BIT(12)
 #define	CFG_BME_EVT					BIT(13)
 #define	CFG_MSE_EVT					BIT(14)
-#define	INTERRUPTS (ERR_SYS | ERR_FATAL | ERR_NONFATAL | ERR_COR | ERR_AXI | \
+#define	INTERRUPTS (u32)(ERR_SYS | ERR_FATAL | ERR_NONFATAL | ERR_COR | ERR_AXI | \
 			ERR_ECRC | PME_TURN_OFF | PME_TO_ACK | PM_PME | \
 			LINK_REQ_RST | LINK_UP_EVT | CFG_BME_EVT | CFG_MSE_EVT)
 
@@ -58,8 +58,8 @@
 #define	INTB						BIT(1)
 #define	INTC						BIT(2)
 #define	INTD						BIT(3)
-#define	MSI						BIT(4)
-#define	LEG_EP_INTERRUPTS (INTA | INTB | INTC | INTD)
+#define	MSI						(u32)(BIT(4))
+#define	LEG_EP_INTERRUPTS (u32)(INTA | INTB | INTC | INTD)
 
 #define	PCIECTRL_TI_CONF_DEVICE_TYPE			0x0100
 #define	DEVICE_TYPE_EP					0x0
-- 
1.9.1

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

* Re: [PATCH v2] PCI: dwc: dra7xx: Fix compilation warning.
  2017-06-15  6:22 [PATCH v2] PCI: dwc: dra7xx: Fix compilation warning Arvind Yadav
@ 2017-06-15  7:28   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2017-06-15  7:28 UTC (permalink / raw)
  To: Arvind Yadav, bhelgaas; +Cc: linux-omap, linux-pci, linux-kernel

Hi,

On Thursday 15 June 2017 11:52 AM, Arvind Yadav wrote:
> drivers/pci/dwc/pci-dra7xx.c: In function ‘dra7xx_pcie_enable_msi_interrupts’:
> drivers/pci/dwc/pci-dra7xx.c:177:7: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>        ~LEG_EP_INTERRUPTS & ~MSI);
>        ^
> drivers/pci/dwc/pci-dra7xx.c: In function ‘dra7xx_pcie_enable_wrapper_interrupts’:
> drivers/pci/dwc/pci-dra7xx.c:187:7: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>        ~INTERRUPTS);

Er.. actually both PCIECTRL_TI_CONF_IRQSTATUS_MSI and
PCIECTRL_TI_CONF_IRQSTATUS_MAIN are "write 1 to clear" registers. So writing
'0' here means no action.

So the right fix should be

diff --git a/drivers/pci/dwc/pci-dra7xx.c b/drivers/pci/dwc/pci-dra7xx.c
index 8decf46cf525..aab0187cdf87 100644
--- a/drivers/pci/dwc/pci-dra7xx.c
+++ b/drivers/pci/dwc/pci-dra7xx.c
@@ -174,7 +174,7 @@ static int dra7xx_pcie_establish_link(struct dw_pcie *pci)
 static void dra7xx_pcie_enable_msi_interrupts(struct dra7xx_pcie *dra7xx)
 {
        dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI,
-                          ~LEG_EP_INTERRUPTS & ~MSI);
+                          MSI | LEG_EP_INTERRUPTS);

        dra7xx_pcie_writel(dra7xx,
                           PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI,
@@ -184,7 +184,7 @@ static void dra7xx_pcie_enable_msi_interrupts(struct
dra7xx_pcie *dra7xx)
 static void dra7xx_pcie_enable_wrapper_interrupts(struct dra7xx_pcie *dra7xx)
 {
        dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN,
-                          ~INTERRUPTS);
+                          INTERRUPTS);
        dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MAIN,
                           INTERRUPTS);
 }
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> 
> Changes in v2:
>              Add casts in the definitions.

please move the change log below "---"

Thanks
Kishon

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

* Re: [PATCH v2] PCI: dwc: dra7xx: Fix compilation warning.
@ 2017-06-15  7:28   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2017-06-15  7:28 UTC (permalink / raw)
  To: Arvind Yadav, bhelgaas; +Cc: linux-omap, linux-pci, linux-kernel

Hi,

On Thursday 15 June 2017 11:52 AM, Arvind Yadav wrote:
> drivers/pci/dwc/pci-dra7xx.c: In function ‘dra7xx_pcie_enable_msi_interrupts’:
> drivers/pci/dwc/pci-dra7xx.c:177:7: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>        ~LEG_EP_INTERRUPTS & ~MSI);
>        ^
> drivers/pci/dwc/pci-dra7xx.c: In function ‘dra7xx_pcie_enable_wrapper_interrupts’:
> drivers/pci/dwc/pci-dra7xx.c:187:7: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>        ~INTERRUPTS);

Er.. actually both PCIECTRL_TI_CONF_IRQSTATUS_MSI and
PCIECTRL_TI_CONF_IRQSTATUS_MAIN are "write 1 to clear" registers. So writing
'0' here means no action.

So the right fix should be

diff --git a/drivers/pci/dwc/pci-dra7xx.c b/drivers/pci/dwc/pci-dra7xx.c
index 8decf46cf525..aab0187cdf87 100644
--- a/drivers/pci/dwc/pci-dra7xx.c
+++ b/drivers/pci/dwc/pci-dra7xx.c
@@ -174,7 +174,7 @@ static int dra7xx_pcie_establish_link(struct dw_pcie *pci)
 static void dra7xx_pcie_enable_msi_interrupts(struct dra7xx_pcie *dra7xx)
 {
        dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI,
-                          ~LEG_EP_INTERRUPTS & ~MSI);
+                          MSI | LEG_EP_INTERRUPTS);

        dra7xx_pcie_writel(dra7xx,
                           PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI,
@@ -184,7 +184,7 @@ static void dra7xx_pcie_enable_msi_interrupts(struct
dra7xx_pcie *dra7xx)
 static void dra7xx_pcie_enable_wrapper_interrupts(struct dra7xx_pcie *dra7xx)
 {
        dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN,
-                          ~INTERRUPTS);
+                          INTERRUPTS);
        dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MAIN,
                           INTERRUPTS);
 }
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> 
> Changes in v2:
>              Add casts in the definitions.

please move the change log below "---"

Thanks
Kishon

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

end of thread, other threads:[~2017-06-15  7:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15  6:22 [PATCH v2] PCI: dwc: dra7xx: Fix compilation warning Arvind Yadav
2017-06-15  7:28 ` Kishon Vijay Abraham I
2017-06-15  7:28   ` Kishon Vijay Abraham I

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.