Skip to content

Commit

Permalink
fpga: fpga-mgr: wrap the fpga_remove() op
Browse files Browse the repository at this point in the history
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.

[[email protected]: Reworded first line]
Signed-off-by: Tom Rix <[email protected]>
Signed-off-by: Moritz Fischer <[email protected]>
  • Loading branch information
Tom Rix authored and mfischer committed Jul 24, 2021
1 parent b02a407 commit 6489d3b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/fpga/fpga-mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 6489d3b

Please sign in to comment.