Commit 6f992271 authored by Tom Rix's avatar Tom Rix Committed by Moritz Fischer

fpga: fpga-mgr: wrap the status() op

An FPGA manager is not required to provide a status() op.
Add a wrapper consistent with the other op wrappers.
Move the op check to the wrapper.
Default to 0, no errors to report.

[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 8ebab40f
......@@ -25,6 +25,13 @@ struct fpga_mgr_devres {
struct fpga_manager *mgr;
};
static inline u64 fpga_mgr_status(struct fpga_manager *mgr)
{
if (mgr->mops->status)
return mgr->mops->status(mgr);
return 0;
}
static inline int fpga_mgr_write(struct fpga_manager *mgr, const char *buf, size_t count)
{
if (mgr->mops->write)
......@@ -434,10 +441,7 @@ static ssize_t status_show(struct device *dev,
u64 status;
int len = 0;
if (!mgr->mops->status)
return -ENOENT;
status = mgr->mops->status(mgr);
status = fpga_mgr_status(mgr);
if (status & FPGA_MGR_STATUS_OPERATION_ERR)
len += sprintf(buf + len, "reconfig operation error\n");
......
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