Skip to content

Commit 36aace1

Browse files
MingLi-4davejiang
authored andcommitted
cxl/pci: Drop the parameter is_port of cxl_gpf_get_dvsec()
The first parameter of cxl_gpf_get_dvsec() is a struct device, can be used to distinguish if the device is a cxl dport or a cxl pci device by checking the PCIe type of it, so the parameter is_port is unnecessary to cxl_gpf_get_dvsec(), using parameter struct device is enough. Signed-off-by: Li Ming <ming.li@zohomail.com> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Tested-by: Davidlohr Bueso <dave@stgolabs.net> Link: https://patch.msgid.link/20250323093110.233040-4-ming.li@zohomail.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 6af941d commit 36aace1

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

drivers/cxl/core/pci.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,14 +1072,20 @@ int cxl_pci_get_bandwidth(struct pci_dev *pdev, struct access_coordinate *c)
10721072
#define GPF_TIMEOUT_BASE_MAX 2
10731073
#define GPF_TIMEOUT_SCALE_MAX 7 /* 10 seconds */
10741074

1075-
u16 cxl_gpf_get_dvsec(struct device *dev, bool is_port)
1075+
u16 cxl_gpf_get_dvsec(struct device *dev)
10761076
{
1077+
struct pci_dev *pdev;
1078+
bool is_port = true;
10771079
u16 dvsec;
10781080

10791081
if (!dev_is_pci(dev))
10801082
return 0;
10811083

1082-
dvsec = pci_find_dvsec_capability(to_pci_dev(dev), PCI_VENDOR_ID_CXL,
1084+
pdev = to_pci_dev(dev);
1085+
if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ENDPOINT)
1086+
is_port = false;
1087+
1088+
dvsec = pci_find_dvsec_capability(pdev, PCI_VENDOR_ID_CXL,
10831089
is_port ? CXL_DVSEC_PORT_GPF : CXL_DVSEC_DEVICE_GPF);
10841090
if (!dvsec)
10851091
dev_warn(dev, "%s GPF DVSEC not present\n",
@@ -1137,7 +1143,7 @@ int cxl_gpf_port_setup(struct cxl_dport *dport)
11371143
struct pci_dev *pdev;
11381144
int dvsec;
11391145

1140-
dvsec = cxl_gpf_get_dvsec(dport->dport_dev, true);
1146+
dvsec = cxl_gpf_get_dvsec(dport->dport_dev);
11411147
if (!dvsec)
11421148
return -EINVAL;
11431149

drivers/cxl/cxl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,6 @@ bool cxl_endpoint_decoder_reset_detected(struct cxl_port *port);
910910
#define __mock static
911911
#endif
912912

913-
u16 cxl_gpf_get_dvsec(struct device *dev, bool is_port);
913+
u16 cxl_gpf_get_dvsec(struct device *dev);
914914

915915
#endif /* __CXL_H__ */

drivers/cxl/pmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static void cxl_nvdimm_arm_dirty_shutdown_tracking(struct cxl_nvdimm *cxl_nvd)
108108
return;
109109
}
110110

111-
if (!cxl_gpf_get_dvsec(cxlds->dev, false))
111+
if (!cxl_gpf_get_dvsec(cxlds->dev))
112112
return;
113113

114114
if (cxl_get_dirty_count(mds, &count)) {

0 commit comments

Comments
 (0)