diff mbox series

[03/10] fpga: fpga-mgr: dfl-fme-mgr: Simplify registration

Message ID 20201004051423.75879-4-mdf@kernel.org (mailing list archive)
State Superseded, archived
Headers show
Series Introduce devm_fpga_mgr_register() | expand

Commit Message

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

Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
 drivers/fpga/dfl-fme-mgr.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

Comments

Tom Rix Oct. 4, 2020, 6:22 p.m. UTC | #1
On 10/3/20 10:14 PM, Moritz Fischer wrote:
> Simplify registration using new devm_fpga_mgr_register() API.
>
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
> ---
>  drivers/fpga/dfl-fme-mgr.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/fpga/dfl-fme-mgr.c b/drivers/fpga/dfl-fme-mgr.c
> index b3f7eee3c93f..3fc2be87d059 100644
> --- a/drivers/fpga/dfl-fme-mgr.c
> +++ b/drivers/fpga/dfl-fme-mgr.c
> @@ -316,16 +316,7 @@ static int fme_mgr_probe(struct platform_device *pdev)
>  	mgr->compat_id = compat_id;
>  	platform_set_drvdata(pdev, mgr);

Is this call is still needed ?

Tom

>  
> -	return fpga_mgr_register(mgr);
> -}
> -
> -static int fme_mgr_remove(struct platform_device *pdev)
> -{
> -	struct fpga_manager *mgr = platform_get_drvdata(pdev);
> -
> -	fpga_mgr_unregister(mgr);
> -
> -	return 0;
> +	return devm_fpga_mgr_register(dev, mgr);
>  }
>  
>  static struct platform_driver fme_mgr_driver = {
> @@ -333,7 +324,6 @@ static struct platform_driver fme_mgr_driver = {
>  		.name    = DFL_FPGA_FME_MGR,
>  	},
>  	.probe   = fme_mgr_probe,
> -	.remove  = fme_mgr_remove,
>  };
>  
>  module_platform_driver(fme_mgr_driver);
Moritz Fischer Oct. 4, 2020, 11:40 p.m. UTC | #2
On Sun, Oct 04, 2020 at 11:22:31AM -0700, Tom Rix wrote:
> 
> On 10/3/20 10:14 PM, Moritz Fischer wrote:
> > Simplify registration using new devm_fpga_mgr_register() API.
> >
> > Signed-off-by: Moritz Fischer <mdf@kernel.org>
> > ---
> >  drivers/fpga/dfl-fme-mgr.c | 12 +-----------
> >  1 file changed, 1 insertion(+), 11 deletions(-)
> >
> > diff --git a/drivers/fpga/dfl-fme-mgr.c b/drivers/fpga/dfl-fme-mgr.c
> > index b3f7eee3c93f..3fc2be87d059 100644
> > --- a/drivers/fpga/dfl-fme-mgr.c
> > +++ b/drivers/fpga/dfl-fme-mgr.c
> > @@ -316,16 +316,7 @@ static int fme_mgr_probe(struct platform_device *pdev)
> >  	mgr->compat_id = compat_id;
> >  	platform_set_drvdata(pdev, mgr);
> 
Nice catch. Will fix.
> Is this call is still needed ?
> 
> Tom
> 
> >  
> > -	return fpga_mgr_register(mgr);
> > -}
> > -
> > -static int fme_mgr_remove(struct platform_device *pdev)
> > -{
> > -	struct fpga_manager *mgr = platform_get_drvdata(pdev);
> > -
> > -	fpga_mgr_unregister(mgr);
> > -
> > -	return 0;
> > +	return devm_fpga_mgr_register(dev, mgr);
> >  }
> >  
> >  static struct platform_driver fme_mgr_driver = {
> > @@ -333,7 +324,6 @@ static struct platform_driver fme_mgr_driver = {
> >  		.name    = DFL_FPGA_FME_MGR,
> >  	},
> >  	.probe   = fme_mgr_probe,
> > -	.remove  = fme_mgr_remove,
> >  };
> >  
> >  module_platform_driver(fme_mgr_driver);
> 

Cheers,
Moritz
diff mbox series

Patch

diff --git a/drivers/fpga/dfl-fme-mgr.c b/drivers/fpga/dfl-fme-mgr.c
index b3f7eee3c93f..3fc2be87d059 100644
--- a/drivers/fpga/dfl-fme-mgr.c
+++ b/drivers/fpga/dfl-fme-mgr.c
@@ -316,16 +316,7 @@  static int fme_mgr_probe(struct platform_device *pdev)
 	mgr->compat_id = compat_id;
 	platform_set_drvdata(pdev, mgr);
 
-	return fpga_mgr_register(mgr);
-}
-
-static int fme_mgr_remove(struct platform_device *pdev)
-{
-	struct fpga_manager *mgr = platform_get_drvdata(pdev);
-
-	fpga_mgr_unregister(mgr);
-
-	return 0;
+	return devm_fpga_mgr_register(dev, mgr);
 }
 
 static struct platform_driver fme_mgr_driver = {
@@ -333,7 +324,6 @@  static struct platform_driver fme_mgr_driver = {
 		.name    = DFL_FPGA_FME_MGR,
 	},
 	.probe   = fme_mgr_probe,
-	.remove  = fme_mgr_remove,
 };
 
 module_platform_driver(fme_mgr_driver);