aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/fpga/machxo2-spi.c
diff options
context:
space:
mode:
authorRuss Weight <russell.h.weight@intel.com>2021-11-18 17:55:51 -0800
committerMoritz Fischer <mdf@kernel.org>2021-11-28 13:59:13 -0800
commit4ba0b2c294fe691921271372f7b59e5cc2ce4b0f (patch)
tree720bcf39730f09c5ff63195820771fad77326389 /drivers/fpga/machxo2-spi.c
parentLinux 5.16-rc1 (diff)
downloadwireguard-linux-4ba0b2c294fe691921271372f7b59e5cc2ce4b0f.tar.xz
wireguard-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/machxo2-spi.c')
-rw-r--r--drivers/fpga/machxo2-spi.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/fpga/machxo2-spi.c b/drivers/fpga/machxo2-spi.c
index ea2ec3c6815c..905607992a12 100644
--- a/drivers/fpga/machxo2-spi.c
+++ b/drivers/fpga/machxo2-spi.c
@@ -370,12 +370,9 @@ static int machxo2_spi_probe(struct spi_device *spi)
return -EINVAL;
}
- mgr = devm_fpga_mgr_create(dev, "Lattice MachXO2 SPI FPGA Manager",
- &machxo2_ops, spi);
- if (!mgr)
- return -ENOMEM;
-
- return devm_fpga_mgr_register(dev, mgr);
+ mgr = devm_fpga_mgr_register(dev, "Lattice MachXO2 SPI FPGA Manager",
+ &machxo2_ops, spi);
+ return PTR_ERR_OR_ZERO(mgr);
}
#ifdef CONFIG_OF