]> git.itanic.dy.fi Git - linux-stable/commitdiff
tools/testing/cxl: Make cxl_memdev_state available to other command emulation
authorDan Williams <dan.j.williams@intel.com>
Wed, 4 Oct 2023 23:56:34 +0000 (16:56 -0700)
committerDan Williams <dan.j.williams@intel.com>
Mon, 9 Oct 2023 18:35:45 +0000 (11:35 -0700)
Move @mds out of the event specific 'struct mock_event_store' and into
the base 'struct cxl_mockmem_data' directly. This is in preparation for
enabling cxl_test to exercise the notifier flow for 'sanitize' operation
completion.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
tools/testing/cxl/test/mem.c

index 68118c37f0b5616a77a5123755753b50ed610807..ab311b59899acef905df93a7647ed67de1f6a7a2 100644 (file)
@@ -133,7 +133,6 @@ struct mock_event_log {
 };
 
 struct mock_event_store {
-       struct cxl_memdev_state *mds;
        struct mock_event_log mock_logs[CXL_EVENT_TYPE_MAX];
        u32 ev_status;
 };
@@ -150,6 +149,7 @@ struct cxl_mockmem_data {
        int user_limit;
        int master_limit;
        struct mock_event_store mes;
+       struct cxl_memdev_state *mds;
        u8 event_buf[SZ_4K];
        u64 timestamp;
 };
@@ -326,7 +326,7 @@ static void cxl_mock_event_trigger(struct device *dev)
                        event_reset_log(log);
        }
 
-       cxl_mem_get_event_records(mes->mds, mes->ev_status);
+       cxl_mem_get_event_records(mdata->mds, mes->ev_status);
 }
 
 struct cxl_event_record_raw maint_needed = {
@@ -1415,6 +1415,7 @@ static int cxl_mock_mem_probe(struct platform_device *pdev)
        if (IS_ERR(mds))
                return PTR_ERR(mds);
 
+       mdata->mds = mds;
        mds->mbox_send = cxl_mock_mbox_send;
        mds->payload_size = SZ_4K;
        mds->event.buf = (struct cxl_get_event_payload *) mdata->event_buf;
@@ -1447,7 +1448,6 @@ static int cxl_mock_mem_probe(struct platform_device *pdev)
        if (rc)
                return rc;
 
-       mdata->mes.mds = mds;
        cxl_mock_add_event_logs(&mdata->mes);
 
        cxlmd = devm_cxl_add_memdev(&pdev->dev, cxlds);