]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fpga: dfl: store platform device name in feature device data
authorPeter Colberg <peter.colberg@intel.com>
Wed, 20 Nov 2024 01:10:29 +0000 (20:10 -0500)
committerXu Yilun <yilun.xu@linux.intel.com>
Wed, 18 Dec 2024 14:28:48 +0000 (22:28 +0800)
Add a new member, pdev_name, to the structure dfl_feature_dev_data that
holds the platform device name for convenience. A subsequent commit will
completely destroy the platform device during port release, after which
fdata->dev is unavailable, while fdata itself remains available.

Signed-off-by: Peter Colberg <peter.colberg@intel.com>
Reviewed-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
Reviewed-by: Basheer Ahmed Muddebihal <basheer.ahmed.muddebihal@linux.intel.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20241120011035.230574-14-peter.colberg@intel.com
Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
drivers/fpga/dfl.c
drivers/fpga/dfl.h

index 143c5b4797894b7b3ebcb692f3acc4ce4e37643d..bd6ca3e0beb1649c85d5ead00447bb22c762095f 100644 (file)
@@ -160,7 +160,7 @@ struct dfl_fpga_port_ops *dfl_fpga_port_ops_get(struct dfl_feature_dev_data *fda
 
        list_for_each_entry(ops, &dfl_port_ops_list, node) {
                /* match port_ops using the name of platform device */
-               if (!strcmp(fdata->dev->name, ops->name)) {
+               if (!strcmp(fdata->pdev_name, ops->name)) {
                        if (!try_module_get(ops->owner))
                                ops = NULL;
                        goto done;
@@ -768,6 +768,7 @@ binfo_create_feature_dev_data(struct build_feature_devs_info *binfo)
 
        fdata->dev = fdev;
        fdata->type = type;
+       fdata->pdev_name = dfl_devs[type].name;
        fdata->num = binfo->feature_num;
        fdata->dfl_cdev = binfo->cdev;
        fdata->id = FEATURE_DEV_ID_UNUSED;
index 921d946e4820852470c89f316c9e1b58ff6e2fd9..cbff5d543c44c52ebe8057bec9d0059fda34a631 100644 (file)
@@ -309,6 +309,7 @@ struct dfl_feature {
  * @lock: mutex to protect feature dev data.
  * @dev: ptr to the feature's platform device linked with this structure.
  * @type: type of DFL FIU for the feature dev. See enum dfl_id_type.
+ * @pdev_name: platform device name for the feature dev.
  * @dfl_cdev: ptr to container device.
  * @id: id used for the feature device.
  * @disable_count: count for port disable.
@@ -325,6 +326,7 @@ struct dfl_feature_dev_data {
        struct mutex lock;
        struct platform_device *dev;
        enum dfl_id_type type;
+       const char *pdev_name;
        struct dfl_fpga_cdev *dfl_cdev;
        int id;
        unsigned int disable_count;