From: Manivannan Sadhasivam <mani@kernel.org>
To: Frank Li <Frank.Li@nxp.com>
Cc: allenbh@gmail.com, bhelgaas@google.com, dave.jiang@intel.com,
helgaas@kernel.org, imx@lists.linux.dev, jdmason@kudzu.us,
kw@linux.com, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org, lpieralisi@kernel.org,
ntb@lists.linux.dev
Subject: Re: [PATCH v14 5/7] PCI: endpoint: pci-epf-vntb: replace hardcode 4 with sizeof(u32)
Date: Tue, 1 Nov 2022 17:30:53 +0530 [thread overview]
Message-ID: <20221101120053.GI54667@thinkpad> (raw)
In-Reply-To: <20221028155703.318928-6-Frank.Li@nxp.com>
On Fri, Oct 28, 2022 at 11:57:01AM -0400, Frank Li wrote:
> From: Frank Li <frank.li@nxp.com>
>
> ntb span entry item size is sizeof(u32).
>
s/span/spad
> Signed-off-by: Frank Li <frank.li@nxp.com>
With that,
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Thanks,
Mani
> ---
> drivers/pci/endpoint/functions/pci-epf-vntb.c | 24 +++++++++----------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index ee66101cb5c4..54616281da9e 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> @@ -257,12 +257,12 @@ 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 * 4)) {
> - if (readl(ntb->epf_db + i * 4))
> + if (readl(ntb->epf_db + i * sizeof(u32))) {
> + if (readl(ntb->epf_db + i * sizeof(u32)))
> ntb->db |= 1 << (i - 1);
>
> ntb_db_event(&ntb->ntb, i);
> - writel(0, ntb->epf_db + i * 4);
> + writel(0, ntb->epf_db + i * sizeof(u32));
> }
> }
>
> @@ -433,7 +433,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb)
> spad_count = ntb->spad_count;
>
> ctrl_size = sizeof(struct epf_ntb_ctrl);
> - spad_size = 2 * spad_count * 4;
> + spad_size = 2 * spad_count * sizeof(u32);
>
> if (!align) {
> ctrl_size = roundup_pow_of_two(ctrl_size);
> @@ -463,7 +463,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb)
> ctrl->num_mws = ntb->num_mws;
> ntb->spad_size = spad_size;
>
> - ctrl->db_entry_size = 4;
> + ctrl->db_entry_size = sizeof(u32);
>
> for (i = 0; i < ntb->db_count; i++) {
> ntb->reg->db_data[i] = 1 + i;
> @@ -535,7 +535,7 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb)
> struct pci_epf_bar *epf_bar;
> void __iomem *mw_addr;
> enum pci_barno barno;
> - size_t size = 4 * ntb->db_count;
> + size_t size = sizeof(u32) * ntb->db_count;
>
> epc_features = pci_epc_get_features(ntb->epf->epc,
> ntb->epf->func_no,
> @@ -1121,11 +1121,11 @@ static int vntb_epf_link_enable(struct ntb_dev *ntb,
> static u32 vntb_epf_spad_read(struct ntb_dev *ndev, int idx)
> {
> struct epf_ntb *ntb = ntb_ndev(ndev);
> - int off = ntb->reg->spad_offset, ct = ntb->reg->spad_count * 4;
> + int off = ntb->reg->spad_offset, ct = ntb->reg->spad_count * sizeof(u32);
> u32 val;
> void __iomem *base = ntb->reg;
>
> - val = readl(base + off + ct + idx * 4);
> + val = readl(base + off + ct + idx * sizeof(u32));
> return val;
> }
>
> @@ -1133,10 +1133,10 @@ static int vntb_epf_spad_write(struct ntb_dev *ndev, int idx, u32 val)
> {
> struct epf_ntb *ntb = ntb_ndev(ndev);
> struct epf_ntb_ctrl *ctrl = ntb->reg;
> - int off = ctrl->spad_offset, ct = ctrl->spad_count * 4;
> + int off = ctrl->spad_offset, ct = ctrl->spad_count * sizeof(u32);
> void __iomem *base = ntb->reg;
>
> - writel(val, base + off + ct + idx * 4);
> + writel(val, base + off + ct + idx * sizeof(u32));
> return 0;
> }
>
> @@ -1148,7 +1148,7 @@ static u32 vntb_epf_peer_spad_read(struct ntb_dev *ndev, int pidx, int idx)
> void __iomem *base = ntb->reg;
> u32 val;
>
> - val = readl(base + off + idx * 4);
> + val = readl(base + off + idx * sizeof(u32));
> return val;
> }
>
> @@ -1159,7 +1159,7 @@ static int vntb_epf_peer_spad_write(struct ntb_dev *ndev, int pidx, int idx, u32
> int off = ctrl->spad_offset;
> void __iomem *base = ntb->reg;
>
> - writel(val, base + off + idx * 4);
> + writel(val, base + off + idx * sizeof(u32));
> return 0;
> }
>
> --
> 2.34.1
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2022-11-01 12:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 15:56 [PATCH v14 0/7] pci-epf-vntb clean up Frank Li
2022-10-28 15:56 ` [PATCH v14 1/7] PCI: endpoint: pci-epf-vntb: Clean up kernel_doc warning Frank Li
2022-11-01 11:49 ` Manivannan Sadhasivam
2022-10-28 15:56 ` [PATCH v14 2/7] PCI: endpoint: pci-epf-vntb: Fix indentation of the struct epf_ntb_ctrl Frank Li
2022-11-01 11:56 ` Manivannan Sadhasivam
2022-11-01 16:08 ` [EXT] " Frank Li
2022-10-28 15:56 ` [PATCH v14 3/7] PCI: endpoint: pci-epf-vntb: fix call pci_epc_mem_free_addr at err path Frank Li
2022-11-01 11:57 ` Manivannan Sadhasivam
2022-10-28 15:57 ` [PATCH v14 4/7] PCI: endpoint: pci-epf-vntb: remove unused field epf_db_phy Frank Li
2022-11-01 11:58 ` Manivannan Sadhasivam
2022-10-28 15:57 ` [PATCH v14 5/7] PCI: endpoint: pci-epf-vntb: replace hardcode 4 with sizeof(u32) Frank Li
2022-11-01 12:00 ` Manivannan Sadhasivam [this message]
2022-10-28 15:57 ` [PATCH v14 6/7] PCI: endpoint: pci-epf-vntb: fix sparse build warning at epf_db Frank Li
2022-11-01 12:24 ` Manivannan Sadhasivam
2022-10-28 15:57 ` [PATCH v14 7/7] PCI: endpoint: pci-epf-vntb: fix sparse build warning at ntb->reg Frank Li
2022-11-01 12:27 ` Manivannan Sadhasivam
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=20221101120053.GI54667@thinkpad \
--to=mani@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=allenbh@gmail.com \
--cc=bhelgaas@google.com \
--cc=dave.jiang@intel.com \
--cc=helgaas@kernel.org \
--cc=imx@lists.linux.dev \
--cc=jdmason@kudzu.us \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=ntb@lists.linux.dev \
/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).