aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fpga/dfl.c
diff options
context:
space:
mode:
authorPeter Colberg <[email protected]>2024-11-20 01:10:33 +0000
committerXu Yilun <[email protected]>2024-12-18 14:28:48 +0000
commitff1f06b60ab041b3ff69c7b3e23d5d5d5ae2f97e (patch)
tree3ea25f875fb5d9dff6480333116350e12d4f40a1 /drivers/fpga/dfl.c
parentfpga: dfl: remove unneeded function build_info_create_dev() (diff)
downloadkernel-ff1f06b60ab041b3ff69c7b3e23d5d5d5ae2f97e.tar.gz
kernel-ff1f06b60ab041b3ff69c7b3e23d5d5d5ae2f97e.zip
fpga: dfl: drop unneeded get_device() and put_device() of feature device
The feature device data was originally stored as platform data, hence the memory allocation was tied to the lifetime of the feature device. Now that the feature device data is tied to the lifetime of the DFL PCIe FPGA device instead, get_device() and put_device() are no longer needed. Signed-off-by: Peter Colberg <[email protected]> Reviewed-by: Matthew Gerlach <[email protected]> Reviewed-by: Basheer Ahmed Muddebihal <[email protected]> Acked-by: Xu Yilun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Xu Yilun <[email protected]>
Diffstat (limited to 'drivers/fpga/dfl.c')
-rw-r--r--drivers/fpga/dfl.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index b62507492a69..c20937ef2c9a 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -734,7 +734,6 @@ static void dfl_fpga_cdev_add_port_data(struct dfl_fpga_cdev *cdev,
{
mutex_lock(&cdev->lock);
list_add(&fdata->node, &cdev->port_dev_list);
- get_device(&fdata->dev->dev);
mutex_unlock(&cdev->lock);
}
@@ -1645,7 +1644,6 @@ void dfl_fpga_feature_devs_remove(struct dfl_fpga_cdev *cdev)
platform_device_put(port_dev);
list_del(&fdata->node);
- put_device(&port_dev->dev);
}
mutex_unlock(&cdev->lock);
@@ -1677,7 +1675,7 @@ __dfl_fpga_cdev_find_port_data(struct dfl_fpga_cdev *cdev, void *data,
struct dfl_feature_dev_data *fdata;
list_for_each_entry(fdata, &cdev->port_dev_list, node) {
- if (match(fdata, data) && get_device(&fdata->dev->dev))
+ if (match(fdata, data))
return fdata;
}
@@ -1728,19 +1726,17 @@ int dfl_fpga_cdev_release_port(struct dfl_fpga_cdev *cdev, int port_id)
if (!device_is_registered(&fdata->dev->dev)) {
ret = -EBUSY;
- goto put_dev_exit;
+ goto unlock_exit;
}
mutex_lock(&fdata->lock);
ret = dfl_feature_dev_use_begin(fdata, true);
mutex_unlock(&fdata->lock);
if (ret)
- goto put_dev_exit;
+ goto unlock_exit;
platform_device_del(fdata->dev);
cdev->released_port_num++;
-put_dev_exit:
- put_device(&fdata->dev->dev);
unlock_exit:
mutex_unlock(&cdev->lock);
return ret;
@@ -1771,20 +1767,18 @@ int dfl_fpga_cdev_assign_port(struct dfl_fpga_cdev *cdev, int port_id)
if (device_is_registered(&fdata->dev->dev)) {
ret = -EBUSY;
- goto put_dev_exit;
+ goto unlock_exit;
}
ret = platform_device_add(fdata->dev);
if (ret)
- goto put_dev_exit;
+ goto unlock_exit;
mutex_lock(&fdata->lock);
dfl_feature_dev_use_end(fdata);
mutex_unlock(&fdata->lock);
cdev->released_port_num--;
-put_dev_exit:
- put_device(&fdata->dev->dev);
unlock_exit:
mutex_unlock(&cdev->lock);
return ret;