Skip to content

Commit 92804ed

Browse files
committed
cxl/pci: Drop @info argument to cxl_hdm_decode_init()
Now that nothing external to cxl_hdm_decode_init() considers 'struct cxl_endpoint_dvec_info' move it internal to cxl_hdm_decode_init(). Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/165291690612.1426646.7866084245521113414.stgit@dwillia2-xfh Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent a12562b commit 92804ed

4 files changed

Lines changed: 12 additions & 19 deletions

File tree

drivers/cxl/core/pci.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,13 @@ static bool __cxl_hdm_decode_init(struct cxl_dev_state *cxlds,
234234
/**
235235
* cxl_hdm_decode_init() - Setup HDM decoding for the endpoint
236236
* @cxlds: Device state
237-
* @info: DVSEC Range cached enumeration
238237
*
239238
* Try to enable the endpoint's HDM Decoder Capability
240239
*/
241-
int cxl_hdm_decode_init(struct cxl_dev_state *cxlds,
242-
struct cxl_endpoint_dvsec_info *info)
240+
int cxl_hdm_decode_init(struct cxl_dev_state *cxlds)
243241
{
244242
struct pci_dev *pdev = to_pci_dev(cxlds->dev);
243+
struct cxl_endpoint_dvsec_info info = { 0 };
245244
int hdm_count, rc, i, ranges = 0;
246245
struct device *dev = &pdev->dev;
247246
int d = cxlds->cxl_dvsec;
@@ -281,8 +280,8 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds,
281280
return rc;
282281
}
283282

284-
info->mem_enabled = FIELD_GET(CXL_DVSEC_MEM_ENABLE, ctrl);
285-
if (!info->mem_enabled)
283+
info.mem_enabled = FIELD_GET(CXL_DVSEC_MEM_ENABLE, ctrl);
284+
if (!info.mem_enabled)
286285
return 0;
287286

288287
for (i = 0; i < hdm_count; i++) {
@@ -317,7 +316,7 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds,
317316

318317
base |= temp & CXL_DVSEC_MEM_BASE_LOW_MASK;
319318

320-
info->dvsec_range[i] = (struct range) {
319+
info.dvsec_range[i] = (struct range) {
321320
.start = base,
322321
.end = base + size - 1
323322
};
@@ -326,13 +325,13 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds,
326325
ranges++;
327326
}
328327

329-
info->ranges = ranges;
328+
info.ranges = ranges;
330329

331330
/*
332331
* If DVSEC ranges are being used instead of HDM decoder registers there
333332
* is no use in trying to manage those.
334333
*/
335-
if (!__cxl_hdm_decode_init(cxlds, info)) {
334+
if (!__cxl_hdm_decode_init(cxlds, &info)) {
336335
dev_err(dev,
337336
"Legacy range registers configuration prevents HDM operation.\n");
338337
return -EBUSY;

drivers/cxl/cxlpci.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,5 @@ static inline resource_size_t cxl_regmap_to_base(struct pci_dev *pdev,
7373

7474
int devm_cxl_port_enumerate_dports(struct cxl_port *port);
7575
struct cxl_dev_state;
76-
struct cxl_endpoint_dvsec_info;
77-
int cxl_hdm_decode_init(struct cxl_dev_state *cxlds,
78-
struct cxl_endpoint_dvsec_info *info);
76+
int cxl_hdm_decode_init(struct cxl_dev_state *cxlds);
7977
#endif /* __CXL_PCI_H__ */

drivers/cxl/mem.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ static void enable_suspend(void *data)
5454
static int cxl_mem_probe(struct device *dev)
5555
{
5656
struct cxl_memdev *cxlmd = to_cxl_memdev(dev);
57-
struct cxl_endpoint_dvsec_info info = { 0 };
5857
struct cxl_dev_state *cxlds = cxlmd->cxlds;
5958
struct cxl_port *parent_port;
6059
int rc;
@@ -95,7 +94,7 @@ static int cxl_mem_probe(struct device *dev)
9594
if (rc)
9695
return rc;
9796

98-
rc = cxl_hdm_decode_init(cxlds, &info);
97+
rc = cxl_hdm_decode_init(cxlds);
9998
if (rc)
10099
return rc;
101100

tools/testing/cxl/test/mock.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,13 @@ int __wrap_cxl_await_media_ready(struct cxl_dev_state *cxlds)
208208
}
209209
EXPORT_SYMBOL_NS_GPL(__wrap_cxl_await_media_ready, CXL);
210210

211-
int __wrap_cxl_hdm_decode_init(struct cxl_dev_state *cxlds,
212-
struct cxl_endpoint_dvsec_info *info)
211+
bool __wrap_cxl_hdm_decode_init(struct cxl_dev_state *cxlds)
213212
{
214213
int rc = 0, index;
215214
struct cxl_mock_ops *ops = get_cxl_mock_ops(&index);
216215

217-
if (ops && ops->is_mock_dev(cxlds->dev))
218-
info->mem_enabled = 1;
219-
else
220-
rc = cxl_hdm_decode_init(cxlds, info);
216+
if (!ops || !ops->is_mock_dev(cxlds->dev))
217+
rc = cxl_hdm_decode_init(cxlds);
221218
put_cxl_mock_ops(index);
222219

223220
return rc;

0 commit comments

Comments
 (0)