cxl: Update prototype of function get_support_feature_info()
authorShiju Jose <shiju.jose@huawei.com>
Wed, 21 May 2025 12:47:40 +0000 (13:47 +0100)
committerDave Jiang <dave.jiang@intel.com>
Fri, 23 May 2025 20:24:00 +0000 (13:24 -0700)
Add following changes to function get_support_feature_info()
1. Make generic to share between cxl-fwctl and cxl-edac paths.
2. Rename get_support_feature_info() to cxl_feature_info()
3. Change parameter const struct fwctl_rpc_cxl *rpc_in to
   const uuid_t *uuid.

Suggested-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Link: https://patch.msgid.link/20250521124749.817-3-shiju.jose@huawei.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/core.h
drivers/cxl/core/features.c

index 17b692eb325713bde91fadfc44045f99e3a3c24c..613cce5c4f7bcf30aa1145047f2530b291e2ad00 100644 (file)
@@ -124,6 +124,8 @@ int cxl_acpi_get_extended_linear_cache_size(struct resource *backing_res,
                                            int nid, resource_size_t *size);
 
 #ifdef CONFIG_CXL_FEATURES
+struct cxl_feat_entry *
+cxl_feature_info(struct cxl_features_state *cxlfs, const uuid_t *uuid);
 size_t cxl_get_feature(struct cxl_mailbox *cxl_mbox, const uuid_t *feat_uuid,
                       enum cxl_get_feat_selection selection,
                       void *feat_out, size_t feat_out_size, u16 offset,
index efe88c0432278f63918fbdcecaefe556036ddc27..4599e1d7668aeb8a011f25b1f2690478e638db5b 100644 (file)
@@ -355,17 +355,11 @@ static void cxlctl_close_uctx(struct fwctl_uctx *uctx)
 {
 }
 
-static struct cxl_feat_entry *
-get_support_feature_info(struct cxl_features_state *cxlfs,
-                        const struct fwctl_rpc_cxl *rpc_in)
+struct cxl_feat_entry *
+cxl_feature_info(struct cxl_features_state *cxlfs,
+                const uuid_t *uuid)
 {
        struct cxl_feat_entry *feat;
-       const uuid_t *uuid;
-
-       if (rpc_in->op_size < sizeof(uuid))
-               return ERR_PTR(-EINVAL);
-
-       uuid = &rpc_in->set_feat_in.uuid;
 
        for (int i = 0; i < cxlfs->entries->num_features; i++) {
                feat = &cxlfs->entries->ent[i];
@@ -547,7 +541,10 @@ static bool cxlctl_validate_set_features(struct cxl_features_state *cxlfs,
        struct cxl_feat_entry *feat;
        u32 flags;
 
-       feat = get_support_feature_info(cxlfs, rpc_in);
+       if (rpc_in->op_size < sizeof(uuid_t))
+               return ERR_PTR(-EINVAL);
+
+       feat = cxl_feature_info(cxlfs, &rpc_in->set_feat_in.uuid);
        if (IS_ERR(feat))
                return false;