[02/10] fpga: fpga-mgr: altera-ps-spi: Simplify registration
diff mbox series

Message ID 20201004051423.75879-3-mdf@kernel.org
State New, archived
Headers show
Series
  • Introduce devm_fpga_mgr_register()
Related show

Commit Message

Moritz Fischer Oct. 4, 2020, 5:14 a.m. UTC
Simplify registration by using new devm_fpga_mgr_register() API.

Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
 drivers/fpga/altera-ps-spi.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

Comments

Tom Rix Oct. 4, 2020, 6:15 p.m. UTC | #1
On 10/3/20 10:14 PM, Moritz Fischer wrote:
> Simplify registration by using new devm_fpga_mgr_register() API.
>
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
> ---
>  drivers/fpga/altera-ps-spi.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)

Looks fine

Reviewed-by: Tom Rix <trix@redhat.com>

Patch
diff mbox series

diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c
index 0221dee8dd4c..23bfd4d1ad0f 100644
--- a/drivers/fpga/altera-ps-spi.c
+++ b/drivers/fpga/altera-ps-spi.c
@@ -307,18 +307,7 @@  static int altera_ps_probe(struct spi_device *spi)
 	if (!mgr)
 		return -ENOMEM;
 
-	spi_set_drvdata(spi, mgr);
-
-	return fpga_mgr_register(mgr);
-}
-
-static int altera_ps_remove(struct spi_device *spi)
-{
-	struct fpga_manager *mgr = spi_get_drvdata(spi);
-
-	fpga_mgr_unregister(mgr);
-
-	return 0;
+	return devm_fpga_mgr_register(&spi->dev, mgr);
 }
 
 static const struct spi_device_id altera_ps_spi_ids[] = {
@@ -337,7 +326,6 @@  static struct spi_driver altera_ps_driver = {
 	},
 	.id_table = altera_ps_spi_ids,
 	.probe = altera_ps_probe,
-	.remove = altera_ps_remove,
 };
 
 module_spi_driver(altera_ps_driver)