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/xilinx-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/xilinx-spi.c')
-rw-r--r-- | drivers/fpga/xilinx-spi.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c index 8d1945966533..469486be20c4 100644 --- a/drivers/fpga/xilinx-spi.c +++ b/drivers/fpga/xilinx-spi.c | |||
@@ -144,7 +144,6 @@ static int xilinx_spi_probe(struct spi_device *spi) | |||
144 | { | 144 | { |
145 | struct xilinx_spi_conf *conf; | 145 | struct xilinx_spi_conf *conf; |
146 | struct fpga_manager *mgr; | 146 | struct fpga_manager *mgr; |
147 | int ret; | ||
148 | 147 | ||
149 | conf = devm_kzalloc(&spi->dev, sizeof(*conf), GFP_KERNEL); | 148 | conf = devm_kzalloc(&spi->dev, sizeof(*conf), GFP_KERNEL); |
150 | if (!conf) | 149 | if (!conf) |
@@ -167,18 +166,15 @@ static int xilinx_spi_probe(struct spi_device *spi) | |||
167 | return PTR_ERR(conf->done); | 166 | return PTR_ERR(conf->done); |
168 | } | 167 | } |
169 | 168 | ||
170 | mgr = fpga_mgr_create(&spi->dev, "Xilinx Slave Serial FPGA Manager", | 169 | mgr = devm_fpga_mgr_create(&spi->dev, |
171 | &xilinx_spi_ops, conf); | 170 | "Xilinx Slave Serial FPGA Manager", |
171 | &xilinx_spi_ops, conf); | ||
172 | if (!mgr) | 172 | if (!mgr) |
173 | return -ENOMEM; | 173 | return -ENOMEM; |
174 | 174 | ||
175 | spi_set_drvdata(spi, mgr); | 175 | spi_set_drvdata(spi, mgr); |
176 | 176 | ||
177 | ret = fpga_mgr_register(mgr); | 177 | return fpga_mgr_register(mgr); |
178 | if (ret) | ||
179 | fpga_mgr_free(mgr); | ||
180 | |||
181 | return ret; | ||
182 | } | 178 | } |
183 | 179 | ||
184 | static int xilinx_spi_remove(struct spi_device *spi) | 180 | static int xilinx_spi_remove(struct spi_device *spi) |