[PATCH 7/9] RDMA/hfi2: Drop device data from hfi2_validate_rcvhdrcnt()
Dennis Dalessandro <[email protected]> Mon, 03 Aug 2026 12:11:27 -0400
| Newsgroups | org.kernel.vger.linux-rdma |
|---|---|
| Message-ID | <178577348742.1793053.6416513242041155702.stgit@awdrv-04> |
hfi2_validate_rcvhdrcnt() only needs the struct pci_dev to report
errors, but currently requires the full struct hfi2_devdata, which
does not yet exist at the point in probe where this validation is
desired to happen. Change the signature to take a struct pci_dev
pointer directly and switch its internal error messages from
dd_dev_err() to dev_err() accordingly. Also fix a latent %d/%u format
specifier mismatch for the unsigned thecnt parameter in the
divisibility check message.
Matches hfi1 fix 4ebd241071af ("RDMA/hfi1: Drop device data from
hfi1_validate_rcvhdrcnt()").
Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: Dennis Dalessandro <[email protected]>
---
drivers/infiniband/hw/hfi2/chip.c | 14 ++++++--------
drivers/infiniband/hw/hfi2/chip.h | 2 +-
drivers/infiniband/hw/hfi2/init.c | 2 +-
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/infiniband/hw/hfi2/chip.c b/drivers/infiniband/hw/hfi2/chip.c
index 64489c117b65..b46dd5cea5de 100644
--- a/drivers/infiniband/hw/hfi2/chip.c
+++ b/drivers/infiniband/hw/hfi2/chip.c
@@ -8213,28 +8213,26 @@ u8 hfi2_encode_rcv_header_entry_size(u8 size)
/**
* hfi2_validate_rcvhdrcnt - validate hdrcnt
- * @dd: the device data
+ * @pdev: the pci device
* @thecnt: the header count
*/
-int hfi2_validate_rcvhdrcnt(struct hfi2_devdata *dd, uint thecnt)
+int hfi2_validate_rcvhdrcnt(struct pci_dev *pdev, uint thecnt)
{
if (thecnt <= HFI2_MIN_HDRQ_EGRBUF_CNT) {
- dd_dev_err(dd, "Receive header queue count too small\n");
+ dev_err(&pdev->dev, "Receive header queue count too small\n");
return -EINVAL;
}
if (thecnt > HFI2_MAX_HDRQ_EGRBUF_CNT) {
- dd_dev_err(
- dd,
+ dev_err(&pdev->dev,
"Receive header queue count cannot be greater than %u\n",
HFI2_MAX_HDRQ_EGRBUF_CNT);
return -EINVAL;
}
if (thecnt % HDRQ_INCREMENT) {
- dd_dev_err(
- dd,
- "Receive header queue count %d must be divisible by %lu\n",
+ dev_err(&pdev->dev,
+ "Receive header queue count %u must be divisible by %lu\n",
thecnt, HDRQ_INCREMENT);
return -EINVAL;
}
diff --git a/drivers/infiniband/hw/hfi2/chip.h b/drivers/infiniband/hw/hfi2/chip.h
index cf25ea55aaec..b01ec9221992 100644
--- a/drivers/infiniband/hw/hfi2/chip.h
+++ b/drivers/infiniband/hw/hfi2/chip.h
@@ -610,7 +610,7 @@ bool hfi2_wfr_check_synth_status(struct hfi2_devdata *dd);
void hfi2_wfr_update_synth_status(struct hfi2_devdata *dd);
u8 hfi2_encode_rcv_header_entry_size(u8 size);
-int hfi2_validate_rcvhdrcnt(struct hfi2_devdata *dd, uint thecnt);
+int hfi2_validate_rcvhdrcnt(struct pci_dev *pdev, uint thecnt);
void hfi2_set_hdrq_regs(struct hfi2_pportdata *ppd, u16 ctxt, u8 entsize,
u16 hdrcnt, u8 kdeth_rcv_hdr);
void hfi2_wfr_update_rcv_hdr_size(struct hfi2_pportdata *ppd, u16 ctxt,
diff --git a/drivers/infiniband/hw/hfi2/init.c b/drivers/infiniband/hw/hfi2/init.c
index 71ae134b5e86..12035b21b582 100644
--- a/drivers/infiniband/hw/hfi2/init.c
+++ b/drivers/infiniband/hw/hfi2/init.c
@@ -2434,7 +2434,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
return PTR_ERR(dd);
/* Validate some global module parameters */
- ret = hfi2_validate_rcvhdrcnt(dd, rcvhdrcnt);
+ ret = hfi2_validate_rcvhdrcnt(pdev, rcvhdrcnt);
if (ret)
goto free_dd;