diff options
author | Alan Tull <atull@kernel.org> | 2018-10-15 18:20:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-10-16 05:13:50 -0400 |
commit | 084181fe8cc7472695b907f0018f4cd00934cb12 (patch) | |
tree | 812b6c10de92d91bccfdec2da621abacc2745c4d /drivers/fpga/altera-ps-spi.c | |
parent | 1c87dc897b8c8ace3aa4480fa29ef6439dabb3ab (diff) |
fpga: mgr: add devm_fpga_mgr_create
Add devm_fpga_mgr_create() which is the managed
version of fpga_mgr_create().
Change current FPGA manager drivers to use
devm_fpga_mgr_create()
Signed-off-by: Alan Tull <atull@kernel.org>
Suggested-by: Federico Vaga <federico.vaga@cern.ch>
Acked-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/fpga/altera-ps-spi.c')
-rw-r--r-- | drivers/fpga/altera-ps-spi.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c index 24b25c626036..33aafda50af5 100644 --- a/drivers/fpga/altera-ps-spi.c +++ b/drivers/fpga/altera-ps-spi.c | |||
@@ -239,7 +239,6 @@ static int altera_ps_probe(struct spi_device *spi) | |||
239 | struct altera_ps_conf *conf; | 239 | struct altera_ps_conf *conf; |
240 | const struct of_device_id *of_id; | 240 | const struct of_device_id *of_id; |
241 | struct fpga_manager *mgr; | 241 | struct fpga_manager *mgr; |
242 | int ret; | ||
243 | 242 | ||
244 | conf = devm_kzalloc(&spi->dev, sizeof(*conf), GFP_KERNEL); | 243 | conf = devm_kzalloc(&spi->dev, sizeof(*conf), GFP_KERNEL); |
245 | if (!conf) | 244 | if (!conf) |
@@ -275,18 +274,14 @@ static int altera_ps_probe(struct spi_device *spi) | |||
275 | snprintf(conf->mgr_name, sizeof(conf->mgr_name), "%s %s", | 274 | snprintf(conf->mgr_name, sizeof(conf->mgr_name), "%s %s", |
276 | dev_driver_string(&spi->dev), dev_name(&spi->dev)); | 275 | dev_driver_string(&spi->dev), dev_name(&spi->dev)); |
277 | 276 | ||
278 | mgr = fpga_mgr_create(&spi->dev, conf->mgr_name, | 277 | mgr = devm_fpga_mgr_create(&spi->dev, conf->mgr_name, |
279 | &altera_ps_ops, conf); | 278 | &altera_ps_ops, conf); |
280 | if (!mgr) | 279 | if (!mgr) |
281 | return -ENOMEM; | 280 | return -ENOMEM; |
282 | 281 | ||
283 | spi_set_drvdata(spi, mgr); | 282 | spi_set_drvdata(spi, mgr); |
284 | 283 | ||
285 | ret = fpga_mgr_register(mgr); | 284 | return fpga_mgr_register(mgr); |
286 | if (ret) | ||
287 | fpga_mgr_free(mgr); | ||
288 | |||
289 | return ret; | ||
290 | } | 285 | } |
291 | 286 | ||
292 | static int altera_ps_remove(struct spi_device *spi) | 287 | static int altera_ps_remove(struct spi_device *spi) |