[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210607172402.2938697-7-trix@redhat.com>
Date: Mon, 7 Jun 2021 10:24:01 -0700
From: trix@...hat.com
To: hao.wu@...el.com, mdf@...nel.org, michal.simek@...inx.com
Cc: linux-fpga@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, Tom Rix <trix@...hat.com>
Subject: [PATCH 6/7] fpga: wrap the fpga_remove() op
From: Tom Rix <trix@...hat.com>
The board is not required to provide a fpga_remove() op.
Add a wrapper consistent with the other op wrappers.
Move op check to wrapper.
Signed-off-by: Tom Rix <trix@...hat.com>
---
drivers/fpga/fpga-mgr.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index d06752be9c6e..84808c7ca440 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -731,6 +731,12 @@ int fpga_mgr_register(struct fpga_manager *mgr)
}
EXPORT_SYMBOL_GPL(fpga_mgr_register);
+static void fpga_mgr_fpga_remove(struct fpga_manager *mgr)
+{
+ if (mgr->mops && mgr->mops->fpga_remove)
+ mgr->mops->fpga_remove(mgr);
+}
+
/**
* fpga_mgr_unregister - unregister a FPGA manager
* @mgr: fpga manager struct
@@ -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);
}
--
2.26.3
Powered by blists - more mailing lists