lkml.org 
[lkml]   [2022]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 3/3] CXL/doe: Use devm_xa_init()
    Date
    From: Ira Weiny <ira.weiny@intel.com>

    The DOE mailboxes are all allocated with device managed calls.
    Therefore, the XArray can go away when the device goes away.

    Use devm_xa_init() and remove the callback needed for xa_destroy().

    Signed-off-by: Ira Weiny <ira.weiny@intel.com>
    ---
    drivers/cxl/pci.c | 8 +-------
    1 file changed, 1 insertion(+), 7 deletions(-)

    diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
    index 6228c95fd142..adb8198fc6ad 100644
    --- a/drivers/cxl/pci.c
    +++ b/drivers/cxl/pci.c
    @@ -387,11 +387,6 @@ static int cxl_setup_regs(struct pci_dev *pdev, enum cxl_regloc_type type,
    return rc;
    }

    -static void cxl_pci_destroy_doe(void *mbs)
    -{
    - xa_destroy(mbs);
    -}
    -
    static void devm_cxl_pci_create_doe(struct cxl_dev_state *cxlds)
    {
    struct device *dev = cxlds->dev;
    @@ -446,8 +441,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
    if (IS_ERR(cxlds))
    return PTR_ERR(cxlds);

    - xa_init(&cxlds->doe_mbs);
    - if (devm_add_action(&pdev->dev, cxl_pci_destroy_doe, &cxlds->doe_mbs))
    + if (devm_xa_init(&pdev->dev, &cxlds->doe_mbs))
    return -ENOMEM;

    cxlds->serial = pci_get_dsn(pdev);
    --
    2.35.3
    \
     
     \ /
      Last update: 2022-07-06 01:24    [W:5.309 / U:0.044 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site