diff mbox series

[v14,6/7] PCI: endpoint: pci-epf-vntb: fix sparse build warning at epf_db

Message ID 20221028155703.318928-7-Frank.Li@nxp.com (mailing list archive)
State Superseded
Delegated to: Lorenzo Pieralisi
Headers show
Series pci-epf-vntb clean up | expand

Commit Message

Frank Li Oct. 28, 2022, 3:57 p.m. UTC
From: Frank Li <frank.li@nxp.com>

Using epf_db[i] instead of readl() because epf_db is in local
system memory and allocated by dma_alloc_coherent().

Signed-off-by: Frank Li <frank.li@nxp.com>
---
 drivers/pci/endpoint/functions/pci-epf-vntb.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Manivannan Sadhasivam Nov. 1, 2022, 12:24 p.m. UTC | #1
On Fri, Oct 28, 2022 at 11:57:02AM -0400, Frank Li wrote:
> From: Frank Li <frank.li@nxp.com>
> 
> Using epf_db[i] instead of readl() because epf_db is in local
> system memory and allocated by dma_alloc_coherent().
> 
> Signed-off-by: Frank Li <frank.li@nxp.com>
> ---
>  drivers/pci/endpoint/functions/pci-epf-vntb.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index 54616281da9e..db3455c1589b 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> @@ -136,7 +136,7 @@ struct epf_ntb {
>  
>  	struct epf_ntb_ctrl *reg;
>  
> -	void __iomem *epf_db;
> +	u32 *epf_db;
>  
>  	phys_addr_t vpci_mw_phy[MAX_MW];
>  	void __iomem *vpci_mw_addr[MAX_MW];
> @@ -257,12 +257,9 @@ static void epf_ntb_cmd_handler(struct work_struct *work)
>  	ntb = container_of(work, struct epf_ntb, cmd_handler.work);
>  
>  	for (i = 1; i < ntb->db_count; i++) {
> -		if (readl(ntb->epf_db + i * sizeof(u32))) {
> -			if (readl(ntb->epf_db + i * sizeof(u32)))
> -				ntb->db |= 1 << (i - 1);

Why did you remove above line?

Thanks,
Mani

> -
> +		if (ntb->epf_db[i]) {
>  			ntb_db_event(&ntb->ntb, i);
> -			writel(0, ntb->epf_db + i * sizeof(u32));
> +			ntb->epf_db[i] = 0;
>  		}
>  	}
>  
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
index 54616281da9e..db3455c1589b 100644
--- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
+++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
@@ -136,7 +136,7 @@  struct epf_ntb {
 
 	struct epf_ntb_ctrl *reg;
 
-	void __iomem *epf_db;
+	u32 *epf_db;
 
 	phys_addr_t vpci_mw_phy[MAX_MW];
 	void __iomem *vpci_mw_addr[MAX_MW];
@@ -257,12 +257,9 @@  static void epf_ntb_cmd_handler(struct work_struct *work)
 	ntb = container_of(work, struct epf_ntb, cmd_handler.work);
 
 	for (i = 1; i < ntb->db_count; i++) {
-		if (readl(ntb->epf_db + i * sizeof(u32))) {
-			if (readl(ntb->epf_db + i * sizeof(u32)))
-				ntb->db |= 1 << (i - 1);
-
+		if (ntb->epf_db[i]) {
 			ntb_db_event(&ntb->ntb, i);
-			writel(0, ntb->epf_db + i * sizeof(u32));
+			ntb->epf_db[i] = 0;
 		}
 	}