Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Li Ming and committed by
Dave Jiang
36aace15 6af941db

+11 -5
+9 -3
drivers/cxl/core/pci.c
··· 1072 1072 #define GPF_TIMEOUT_BASE_MAX 2 1073 1073 #define GPF_TIMEOUT_SCALE_MAX 7 /* 10 seconds */ 1074 1074 1075 - u16 cxl_gpf_get_dvsec(struct device *dev, bool is_port) 1075 + u16 cxl_gpf_get_dvsec(struct device *dev) 1076 1076 { 1077 + struct pci_dev *pdev; 1078 + bool is_port = true; 1077 1079 u16 dvsec; 1078 1080 1079 1081 if (!dev_is_pci(dev)) 1080 1082 return 0; 1081 1083 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, 1083 1089 is_port ? CXL_DVSEC_PORT_GPF : CXL_DVSEC_DEVICE_GPF); 1084 1090 if (!dvsec) 1085 1091 dev_warn(dev, "%s GPF DVSEC not present\n", ··· 1143 1137 struct pci_dev *pdev; 1144 1138 int dvsec; 1145 1139 1146 - dvsec = cxl_gpf_get_dvsec(dport->dport_dev, true); 1140 + dvsec = cxl_gpf_get_dvsec(dport->dport_dev); 1147 1141 if (!dvsec) 1148 1142 return -EINVAL; 1149 1143
+1 -1
drivers/cxl/cxl.h
··· 910 910 #define __mock static 911 911 #endif 912 912 913 - u16 cxl_gpf_get_dvsec(struct device *dev, bool is_port); 913 + u16 cxl_gpf_get_dvsec(struct device *dev); 914 914 915 915 #endif /* __CXL_H__ */
+1 -1
drivers/cxl/pmem.c
··· 108 108 return; 109 109 } 110 110 111 - if (!cxl_gpf_get_dvsec(cxlds->dev, false)) 111 + if (!cxl_gpf_get_dvsec(cxlds->dev)) 112 112 return; 113 113 114 114 if (cxl_get_dirty_count(mds, &count)) {