summaryrefslogtreecommitdiffstats
path: root/drivers/fpga
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2021-06-25 12:51:47 -0700
committerMoritz Fischer <mdf@kernel.org>2021-07-24 15:10:31 -0700
commit6489d3b00398f02457eea566d4a99698c68cc89f (patch)
treec0926bf8e6daa135d24f04baf8e29774e77c71d2 /drivers/fpga
parentb02a40713db95ebd8f72151b0fea8080d9f74c27 (diff)
downloadlinux-6489d3b00398f02457eea566d4a99698c68cc89f.tar.bz2
fpga: fpga-mgr: wrap the fpga_remove() op
An FPGA manager is not required to provide a fpga_remove() op. Add a wrapper consistent with the other op wrappers. Move op check to wrapper. [mdf@kernel.org: Reworded first line] Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: Moritz Fischer <mdf@kernel.org>
Diffstat (limited to 'drivers/fpga')
-rw-r--r--drivers/fpga/fpga-mgr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index b3380ad341d2..077c0f9edbe4 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -25,6 +25,12 @@ struct fpga_mgr_devres {
struct fpga_manager *mgr;
};
+static inline void fpga_mgr_fpga_remove(struct fpga_manager *mgr)
+{
+ if (mgr->mops->fpga_remove)
+ mgr->mops->fpga_remove(mgr);
+}
+
static inline enum fpga_mgr_states fpga_mgr_state(struct fpga_manager *mgr)
{
if (mgr->mops->state)
@@ -745,8 +751,7 @@ void fpga_mgr_unregister(struct fpga_manager *mgr)
* If the low level driver provides a method for putting fpga into
* a desired state upon unregister, do it.
*/
- if (mgr->mops->fpga_remove)
- mgr->mops->fpga_remove(mgr);
+ fpga_mgr_fpga_remove(mgr);
device_unregister(&mgr->dev);
}