diff options
author | Russ Weight <russell.h.weight@intel.com> | 2021-11-19 02:55:51 +0100 |
---|---|---|
committer | Moritz Fischer <mdf@kernel.org> | 2021-11-28 22:59:13 +0100 |
commit | 4ba0b2c294fe691921271372f7b59e5cc2ce4b0f (patch) | |
tree | 720bcf39730f09c5ff63195820771fad77326389 /drivers/fpga/zynq-fpga.c | |
parent | Linux 5.16-rc1 (diff) | |
download | linux-4ba0b2c294fe691921271372f7b59e5cc2ce4b0f.tar.xz linux-4ba0b2c294fe691921271372f7b59e5cc2ce4b0f.zip |
fpga: mgr: Use standard dev_release for class driver
The FPGA manager class driver data structure is being treated as a
managed resource instead of using the standard dev_release call-back
function to release the class data structure. This change removes
the managed resource code for the freeing of the class data structure
and combines the create() and register() functions into a single
register() or register_full() function.
The register_full() function accepts an info data structure to provide
flexibility in passing optional parameters. The register() function
supports the current parameter list for users that don't require the
use of optional parameters.
The devm_fpga_mgr_register() function is retained, and the
devm_fpga_mgr_register_full() function is added.
Signed-off-by: Russ Weight <russell.h.weight@intel.com>
Reviewed-by: Xu Yilun <yilun.xu@intel.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Signed-off-by: Moritz Fischer <mdf@kernel.org>
Diffstat (limited to 'drivers/fpga/zynq-fpga.c')
-rw-r--r-- | drivers/fpga/zynq-fpga.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c index 9b75bd4f93d8..426aa34c6a0d 100644 --- a/drivers/fpga/zynq-fpga.c +++ b/drivers/fpga/zynq-fpga.c @@ -609,20 +609,16 @@ static int zynq_fpga_probe(struct platform_device *pdev) clk_disable(priv->clk); - mgr = devm_fpga_mgr_create(dev, "Xilinx Zynq FPGA Manager", - &zynq_fpga_ops, priv); - if (!mgr) - return -ENOMEM; - - platform_set_drvdata(pdev, mgr); - - err = fpga_mgr_register(mgr); - if (err) { + mgr = fpga_mgr_register(dev, "Xilinx Zynq FPGA Manager", + &zynq_fpga_ops, priv); + if (IS_ERR(mgr)) { dev_err(dev, "unable to register FPGA manager\n"); clk_unprepare(priv->clk); - return err; + return PTR_ERR(mgr); } + platform_set_drvdata(pdev, mgr); + return 0; } |