aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fpga/dfl.h
diff options
context:
space:
mode:
authorWu Hao <[email protected]>2018-06-30 00:53:15 +0000
committerGreg Kroah-Hartman <[email protected]>2018-07-15 11:55:45 +0000
commit5d56e117001996766c3dab5767663b0c43b76639 (patch)
tree90ca25fdad1af397732654f312f633ed8655fd33 /drivers/fpga/dfl.h
parentfpga: dfl: add chardev support for feature devices (diff)
downloadkernel-5d56e117001996766c3dab5767663b0c43b76639.tar.gz
kernel-5d56e117001996766c3dab5767663b0c43b76639.zip
fpga: dfl: add dfl_fpga_cdev_find_port
For feature devices, we need a method to find the port dedicated to the device. This patch adds a function dfl_fpga_cdev_find_port for this purpose. e.g. FPGA Management Engine (FME) Partial Reconfiguration sub feature, it uses this function to find dedicated port on the device for PR function implementation. Signed-off-by: Tim Whisonant <[email protected]> Signed-off-by: Enno Luebbers <[email protected]> Signed-off-by: Shiva Rao <[email protected]> Signed-off-by: Christopher Rauer <[email protected]> Signed-off-by: Xiao Guangrong <[email protected]> Signed-off-by: Wu Hao <[email protected]> Acked-by: Alan Tull <[email protected]> Acked-by: Moritz Fischer <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/fpga/dfl.h')
-rw-r--r--drivers/fpga/dfl.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h
index 66c2ade5a06b..b4f65250a29c 100644
--- a/drivers/fpga/dfl.h
+++ b/drivers/fpga/dfl.h
@@ -284,4 +284,25 @@ struct dfl_fpga_cdev *
dfl_fpga_feature_devs_enumerate(struct dfl_fpga_enum_info *info);
void dfl_fpga_feature_devs_remove(struct dfl_fpga_cdev *cdev);
+/*
+ * need to drop the device reference with put_device() after use port platform
+ * device returned by __dfl_fpga_cdev_find_port and dfl_fpga_cdev_find_port
+ * functions.
+ */
+struct platform_device *
+__dfl_fpga_cdev_find_port(struct dfl_fpga_cdev *cdev, void *data,
+ int (*match)(struct platform_device *, void *));
+
+static inline struct platform_device *
+dfl_fpga_cdev_find_port(struct dfl_fpga_cdev *cdev, void *data,
+ int (*match)(struct platform_device *, void *))
+{
+ struct platform_device *pdev;
+
+ mutex_lock(&cdev->lock);
+ pdev = __dfl_fpga_cdev_find_port(cdev, data, match);
+ mutex_unlock(&cdev->lock);
+
+ return pdev;
+}
#endif /* __FPGA_DFL_H */