Skip to content

Commit 2b35c88

Browse files
nxpfrankliLorenzo Pieralisi
authored andcommitted
PCI: endpoint: pci-epf-vntb: Replace hardcoded 4 with sizeof(u32)
NTB spad entry item size is sizeof(u32), replace hardcoded 4 with it. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Frank Li <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Acked-by: Manivannan Sadhasivam <[email protected]>
1 parent 03d426a commit 2b35c88

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/pci/endpoint/functions/pci-epf-vntb.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ static void epf_ntb_cmd_handler(struct work_struct *work)
257257
ntb = container_of(work, struct epf_ntb, cmd_handler.work);
258258

259259
for (i = 1; i < ntb->db_count; i++) {
260-
if (readl(ntb->epf_db + i * 4)) {
261-
if (readl(ntb->epf_db + i * 4))
260+
if (readl(ntb->epf_db + i * sizeof(u32))) {
261+
if (readl(ntb->epf_db + i * sizeof(u32)))
262262
ntb->db |= 1 << (i - 1);
263263

264264
ntb_db_event(&ntb->ntb, i);
265-
writel(0, ntb->epf_db + i * 4);
265+
writel(0, ntb->epf_db + i * sizeof(u32));
266266
}
267267
}
268268

@@ -433,7 +433,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb)
433433
spad_count = ntb->spad_count;
434434

435435
ctrl_size = sizeof(struct epf_ntb_ctrl);
436-
spad_size = 2 * spad_count * 4;
436+
spad_size = 2 * spad_count * sizeof(u32);
437437

438438
if (!align) {
439439
ctrl_size = roundup_pow_of_two(ctrl_size);
@@ -463,7 +463,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb)
463463
ctrl->num_mws = ntb->num_mws;
464464
ntb->spad_size = spad_size;
465465

466-
ctrl->db_entry_size = 4;
466+
ctrl->db_entry_size = sizeof(u32);
467467

468468
for (i = 0; i < ntb->db_count; i++) {
469469
ntb->reg->db_data[i] = 1 + i;
@@ -535,7 +535,7 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb)
535535
struct pci_epf_bar *epf_bar;
536536
void __iomem *mw_addr;
537537
enum pci_barno barno;
538-
size_t size = 4 * ntb->db_count;
538+
size_t size = sizeof(u32) * ntb->db_count;
539539

540540
epc_features = pci_epc_get_features(ntb->epf->epc,
541541
ntb->epf->func_no,
@@ -1121,22 +1121,22 @@ static int vntb_epf_link_enable(struct ntb_dev *ntb,
11211121
static u32 vntb_epf_spad_read(struct ntb_dev *ndev, int idx)
11221122
{
11231123
struct epf_ntb *ntb = ntb_ndev(ndev);
1124-
int off = ntb->reg->spad_offset, ct = ntb->reg->spad_count * 4;
1124+
int off = ntb->reg->spad_offset, ct = ntb->reg->spad_count * sizeof(u32);
11251125
u32 val;
11261126
void __iomem *base = ntb->reg;
11271127

1128-
val = readl(base + off + ct + idx * 4);
1128+
val = readl(base + off + ct + idx * sizeof(u32));
11291129
return val;
11301130
}
11311131

11321132
static int vntb_epf_spad_write(struct ntb_dev *ndev, int idx, u32 val)
11331133
{
11341134
struct epf_ntb *ntb = ntb_ndev(ndev);
11351135
struct epf_ntb_ctrl *ctrl = ntb->reg;
1136-
int off = ctrl->spad_offset, ct = ctrl->spad_count * 4;
1136+
int off = ctrl->spad_offset, ct = ctrl->spad_count * sizeof(u32);
11371137
void __iomem *base = ntb->reg;
11381138

1139-
writel(val, base + off + ct + idx * 4);
1139+
writel(val, base + off + ct + idx * sizeof(u32));
11401140
return 0;
11411141
}
11421142

@@ -1148,7 +1148,7 @@ static u32 vntb_epf_peer_spad_read(struct ntb_dev *ndev, int pidx, int idx)
11481148
void __iomem *base = ntb->reg;
11491149
u32 val;
11501150

1151-
val = readl(base + off + idx * 4);
1151+
val = readl(base + off + idx * sizeof(u32));
11521152
return val;
11531153
}
11541154

@@ -1159,7 +1159,7 @@ static int vntb_epf_peer_spad_write(struct ntb_dev *ndev, int pidx, int idx, u32
11591159
int off = ctrl->spad_offset;
11601160
void __iomem *base = ntb->reg;
11611161

1162-
writel(val, base + off + idx * 4);
1162+
writel(val, base + off + idx * sizeof(u32));
11631163
return 0;
11641164
}
11651165

0 commit comments

Comments
 (0)