linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: orion: Use module_platform_driver()
@ 2013-02-04 12:26 Ezequiel Garcia
       [not found] ` <1359980786-4606-1-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Ezequiel Garcia @ 2013-02-04 12:26 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: shadi-eYqpPyKDWXRBDgjK7y7TUQ, Ezequiel Garcia

This patch reduces and simplifies initalization code by
using module_platform_driver().
With this change it's necessary to remove the __init annotation
to avoid section mismatch warnings.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 drivers/spi/spi-orion.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index b7e7182..d8cbf20 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -396,7 +396,7 @@ static int orion_spi_setup(struct spi_device *spi)
 	return 0;
 }
 
-static int __init orion_spi_probe(struct platform_device *pdev)
+static int orion_spi_probe(struct platform_device *pdev)
 {
 	struct spi_master *master;
 	struct orion_spi *spi;
@@ -513,20 +513,11 @@ static struct platform_driver orion_spi_driver = {
 		.owner	= THIS_MODULE,
 		.of_match_table = of_match_ptr(orion_spi_of_match_table),
 	},
+	.probe		= orion_spi_probe,
 	.remove		= __exit_p(orion_spi_remove),
 };
 
-static int __init orion_spi_init(void)
-{
-	return platform_driver_probe(&orion_spi_driver, orion_spi_probe);
-}
-module_init(orion_spi_init);
-
-static void __exit orion_spi_exit(void)
-{
-	platform_driver_unregister(&orion_spi_driver);
-}
-module_exit(orion_spi_exit);
+module_platform_driver(orion_spi_driver);
 
 MODULE_DESCRIPTION("Orion SPI driver");
 MODULE_AUTHOR("Shadi Ammouri <shadi-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>");
-- 
1.7.8.6


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: orion: Use module_platform_driver()
       [not found] ` <1359980786-4606-1-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
@ 2013-02-05 14:39   ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2013-02-05 14:39 UTC (permalink / raw)
  To: Ezequiel Garcia,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: shadi-eYqpPyKDWXRBDgjK7y7TUQ, Ezequiel Garcia

On Mon,  4 Feb 2013 09:26:26 -0300, Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> This patch reduces and simplifies initalization code by
> using module_platform_driver().
> With this change it's necessary to remove the __init annotation
> to avoid section mismatch warnings.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Applied, thanks.

g.

> ---
>  drivers/spi/spi-orion.c |   15 +++------------
>  1 files changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
> index b7e7182..d8cbf20 100644
> --- a/drivers/spi/spi-orion.c
> +++ b/drivers/spi/spi-orion.c
> @@ -396,7 +396,7 @@ static int orion_spi_setup(struct spi_device *spi)
>  	return 0;
>  }
>  
> -static int __init orion_spi_probe(struct platform_device *pdev)
> +static int orion_spi_probe(struct platform_device *pdev)
>  {
>  	struct spi_master *master;
>  	struct orion_spi *spi;
> @@ -513,20 +513,11 @@ static struct platform_driver orion_spi_driver = {
>  		.owner	= THIS_MODULE,
>  		.of_match_table = of_match_ptr(orion_spi_of_match_table),
>  	},
> +	.probe		= orion_spi_probe,
>  	.remove		= __exit_p(orion_spi_remove),
>  };
>  
> -static int __init orion_spi_init(void)
> -{
> -	return platform_driver_probe(&orion_spi_driver, orion_spi_probe);
> -}
> -module_init(orion_spi_init);
> -
> -static void __exit orion_spi_exit(void)
> -{
> -	platform_driver_unregister(&orion_spi_driver);
> -}
> -module_exit(orion_spi_exit);
> +module_platform_driver(orion_spi_driver);
>  
>  MODULE_DESCRIPTION("Orion SPI driver");
>  MODULE_AUTHOR("Shadi Ammouri <shadi-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>");
> -- 
> 1.7.8.6
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-05 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-04 12:26 [PATCH] spi: orion: Use module_platform_driver() Ezequiel Garcia
     [not found] ` <1359980786-4606-1-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-02-05 14:39   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).