cxl/pci: Consolidate wait_for_media() and wait_for_media_ready()
authorDan Williams <dan.j.williams@intel.com>
Wed, 18 May 2022 23:34:20 +0000 (16:34 -0700)
committerDan Williams <dan.j.williams@intel.com>
Thu, 19 May 2022 15:50:40 +0000 (08:50 -0700)
Now that wait_for_media() does nothing supplemental to
wait_for_media_ready() just promote wait_for_media_ready() to a common
helper and drop wait_for_media().

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/165291686046.1426646.4390664747934592185.stgit@dwillia2-xfh
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/mem.c
drivers/cxl/pci.c

index c2d9dadf4a2e0783257e33d095bb39be53131d77..7622cfefa1b0fa0d9dec440bc983b17c6fbf9ed1 100644 (file)
  * in higher level operations.
  */
 
-static int wait_for_media(struct cxl_memdev *cxlmd)
-{
-       struct cxl_dev_state *cxlds = cxlmd->cxlds;
-       int rc;
-
-       rc = cxlds->wait_media_ready(cxlds);
-       if (rc)
-               return rc;
-
-       /*
-        * We know the device is active, and enabled, if any ranges are non-zero
-        * we'll need to check later before adding the port since that owns the
-        * HDM decoder registers.
-        */
-       return 0;
-}
-
 static int create_endpoint(struct cxl_memdev *cxlmd,
                           struct cxl_port *parent_port)
 {
@@ -157,7 +140,7 @@ static int cxl_mem_probe(struct device *dev)
        if (work_pending(&cxlmd->detach_work))
                return -EBUSY;
 
-       rc = wait_for_media(cxlmd);
+       rc = cxlds->wait_media_ready(cxlds);
        if (rc) {
                dev_err(dev, "Media not active (%d)\n", rc);
                return rc;
index e7ab9a34d7189cfa376dd03d9875b0c4146eed5e..435f9f89b7937a3bcb5d5759770834be0c144959 100644 (file)
@@ -423,7 +423,7 @@ static int wait_for_valid(struct cxl_dev_state *cxlds)
  * Wait up to @mbox_ready_timeout for the device to report memory
  * active.
  */
-static int wait_for_media_ready(struct cxl_dev_state *cxlds)
+static int cxl_await_media_ready(struct cxl_dev_state *cxlds)
 {
        struct pci_dev *pdev = to_pci_dev(cxlds->dev);
        int d = cxlds->cxl_dvsec;
@@ -593,7 +593,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                dev_warn(&pdev->dev,
                         "Device DVSEC not present, skip CXL.mem init\n");
 
-       cxlds->wait_media_ready = wait_for_media_ready;
+       cxlds->wait_media_ready = cxl_await_media_ready;
 
        rc = cxl_setup_regs(pdev, CXL_REGLOC_RBI_MEMDEV, &map);
        if (rc)