Commit 6489d3b0 authored by Tom Rix's avatar Tom Rix Committed by Moritz Fischer

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: default avatarTom Rix <trix@redhat.com>
Signed-off-by: default avatarMoritz Fischer <mdf@kernel.org>
parent b02a4071
...@@ -25,6 +25,12 @@ struct fpga_mgr_devres { ...@@ -25,6 +25,12 @@ struct fpga_mgr_devres {
struct fpga_manager *mgr; 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) static inline enum fpga_mgr_states fpga_mgr_state(struct fpga_manager *mgr)
{ {
if (mgr->mops->state) if (mgr->mops->state)
...@@ -745,8 +751,7 @@ void fpga_mgr_unregister(struct fpga_manager *mgr) ...@@ -745,8 +751,7 @@ void fpga_mgr_unregister(struct fpga_manager *mgr)
* If the low level driver provides a method for putting fpga into * If the low level driver provides a method for putting fpga into
* a desired state upon unregister, do it. * a desired state upon unregister, do it.
*/ */
if (mgr->mops->fpga_remove) fpga_mgr_fpga_remove(mgr);
mgr->mops->fpga_remove(mgr);
device_unregister(&mgr->dev); device_unregister(&mgr->dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment