Skip to contentSkip to conversation

drivers: video: use module_platform_driver_probe()

PATCH Superseded Fabio Porcedda 3 participants 5 messages Mar 15, 2013

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drivers: video: use module_platform_driver_probe()

This patch converts the drivers to use the module_platform_driver_probe() macro which makes the code smaller and a bit simpler.

Cc Florian Tobias Schandinat <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc David Howells <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Kuninori Morimoto <[email protected]>

---

Notes:
v3:
- add missing drivers: amifb, atmel_lcdfb, vrfb
- split patch set to each maintainer to easy up respin
v2:
- rebased over linux-next and remove already converted drivers

 drivers/video/amifb.c          | 14 +-------------
 drivers/video/atmel_lcdfb.c    | 13 +------------
 drivers/video/omap2/vrfb.c     | 13 +------------
 drivers/video/sh_mipi_dsi.c    | 12 +-----------
 drivers/video/sh_mobile_hdmi.c | 12 +-----------
 5 files changed, 5 insertions(+), 59 deletions(-)
drivers/video/amifb.c +1 -13
index 7fa1bf8..03e2de2 100644
@@ -3788,19 +3788,7 @@ static struct platform_driver amifb_driver = {
 	},
 };
 
-static int __init amifb_init(void)
-{
-	return platform_driver_probe(&amifb_driver, amifb_probe);
-}
-
-module_init(amifb_init);
-
-static void __exit amifb_exit(void)
-{
-	platform_driver_unregister(&amifb_driver);
-}
-
-module_exit(amifb_exit);
+return module_platform_driver_probe(amifb_driver, amifb_probe);
 
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:amiga-video");
drivers/video/atmel_lcdfb.c +1 -12
index 12cf5f3..654e102 100644
@@ -1150,18 +1150,7 @@ static struct platform_driver atmel_lcdfb_driver = {
 	},
 };
 
-static int __init atmel_lcdfb_init(void)
-{
-	return platform_driver_probe(&atmel_lcdfb_driver, atmel_lcdfb_probe);
-}
-
-static void __exit atmel_lcdfb_exit(void)
-{
-	platform_driver_unregister(&atmel_lcdfb_driver);
-}
-
-module_init(atmel_lcdfb_init);
-module_exit(atmel_lcdfb_exit);
+module_platform_driver_probe(atmel_lcdfb_driver, atmel_lcdfb_probe);
 
 MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver");
 MODULE_AUTHOR("Nicolas Ferre <[email protected]>");
drivers/video/omap2/vrfb.c +1 -12
index 10560ef..5261229 100644
@@ -397,18 +397,7 @@ static struct platform_driver vrfb_driver = {
 	.remove		= __exit_p(vrfb_remove),
 };
 
-static int __init vrfb_init(void)
-{
-	return platform_driver_probe(&vrfb_driver, &vrfb_probe);
-}
-
-static void __exit vrfb_exit(void)
-{
-	platform_driver_unregister(&vrfb_driver);
-}
-
-module_init(vrfb_init);
-module_exit(vrfb_exit);
+module_platform_driver_probe(vrfb_driver, vrfb_probe);
 
 MODULE_AUTHOR("Tomi Valkeinen <[email protected]>");
 MODULE_DESCRIPTION("OMAP VRFB");
drivers/video/sh_mipi_dsi.c +1 -11
index 701b461..6cad530 100644
@@ -581,17 +581,7 @@ static struct platform_driver sh_mipi_driver = {
 	},
 };
 
-static int __init sh_mipi_init(void)
-{
-	return platform_driver_probe(&sh_mipi_driver, sh_mipi_probe);
-}
-module_init(sh_mipi_init);
-
-static void __exit sh_mipi_exit(void)
-{
-	platform_driver_unregister(&sh_mipi_driver);
-}
-module_exit(sh_mipi_exit);
+module_platform_driver_probe(sh_mipi_driver, sh_mipi_probe);
 
 MODULE_AUTHOR("Guennadi Liakhovetski <[email protected]>");
 MODULE_DESCRIPTION("SuperH / ARM-shmobile MIPI DSI driver");
drivers/video/sh_mobile_hdmi.c +1 -11
index 930e550..bfe4728 100644
@@ -1445,17 +1445,7 @@ static struct platform_driver sh_hdmi_driver = {
 	},
 };
 
-static int __init sh_hdmi_init(void)
-{
-	return platform_driver_probe(&sh_hdmi_driver, sh_hdmi_probe);
-}
-module_init(sh_hdmi_init);
-
-static void __exit sh_hdmi_exit(void)
-{
-	platform_driver_unregister(&sh_hdmi_driver);
-}
-module_exit(sh_hdmi_exit);
+module_platform_driver_probe(sh_hdmi_driver, sh_hdmi_probe);
 
 MODULE_AUTHOR("Guennadi Liakhovetski <[email protected]>");
 MODULE_DESCRIPTION("SuperH / ARM-shmobile HDMI driver");
Signature · 1 line
1.8.1.5
Acked-by on v3 1/1
#1 lore raw

On 03/15/2013 10:00 AM, Fabio Porcedda :

Quoted 7 lines

This patch converts the drivers to use the module_platform_driver_probe() macro which makes the code smaller and a bit simpler.

Cc Florian Tobias Schandinat <[email protected]>
Cc Nicolas Ferre <[email protected]>

For atmel_lcdfb.c:

Thanks Fabio.

Quoted 141 lines
Cc Tomi Valkeinen <[email protected]>
Cc David Howells <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Kuninori Morimoto <[email protected]>

---

Notes:
v3:
- add missing drivers: amifb, atmel_lcdfb, vrfb
- split patch set to each maintainer to easy up respin
v2:
- rebased over linux-next and remove already converted drivers

 drivers/video/amifb.c          | 14 +-------------
 drivers/video/atmel_lcdfb.c    | 13 +------------
 drivers/video/omap2/vrfb.c     | 13 +------------
 drivers/video/sh_mipi_dsi.c    | 12 +-----------
 drivers/video/sh_mobile_hdmi.c | 12 +-----------
 5 files changed, 5 insertions(+), 59 deletions(-)
drivers/video/amifb.c +1 -13
index 7fa1bf8..03e2de2 100644
@@ -3788,19 +3788,7 @@ static struct platform_driver amifb_driver = {
 	},
 };
 
-static int __init amifb_init(void)
-{
-	return platform_driver_probe(&amifb_driver, amifb_probe);
-}
-
-module_init(amifb_init);
-
-static void __exit amifb_exit(void)
-{
-	platform_driver_unregister(&amifb_driver);
-}
-
-module_exit(amifb_exit);
+return module_platform_driver_probe(amifb_driver, amifb_probe);
 
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:amiga-video");
drivers/video/atmel_lcdfb.c +1 -12
index 12cf5f3..654e102 100644
@@ -1150,18 +1150,7 @@ static struct platform_driver atmel_lcdfb_driver = {
 	},
 };
 
-static int __init atmel_lcdfb_init(void)
-{
-	return platform_driver_probe(&atmel_lcdfb_driver, atmel_lcdfb_probe);
-}
-
-static void __exit atmel_lcdfb_exit(void)
-{
-	platform_driver_unregister(&atmel_lcdfb_driver);
-}
-
-module_init(atmel_lcdfb_init);
-module_exit(atmel_lcdfb_exit);
+module_platform_driver_probe(atmel_lcdfb_driver, atmel_lcdfb_probe);
 
 MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver");
 MODULE_AUTHOR("Nicolas Ferre <[email protected]>");
drivers/video/omap2/vrfb.c +1 -12
index 10560ef..5261229 100644
@@ -397,18 +397,7 @@ static struct platform_driver vrfb_driver = {
 	.remove		= __exit_p(vrfb_remove),
 };
 
-static int __init vrfb_init(void)
-{
-	return platform_driver_probe(&vrfb_driver, &vrfb_probe);
-}
-
-static void __exit vrfb_exit(void)
-{
-	platform_driver_unregister(&vrfb_driver);
-}
-
-module_init(vrfb_init);
-module_exit(vrfb_exit);
+module_platform_driver_probe(vrfb_driver, vrfb_probe);
 
 MODULE_AUTHOR("Tomi Valkeinen <[email protected]>");
 MODULE_DESCRIPTION("OMAP VRFB");
drivers/video/sh_mipi_dsi.c +1 -11
index 701b461..6cad530 100644
@@ -581,17 +581,7 @@ static struct platform_driver sh_mipi_driver = {
 	},
 };
 
-static int __init sh_mipi_init(void)
-{
-	return platform_driver_probe(&sh_mipi_driver, sh_mipi_probe);
-}
-module_init(sh_mipi_init);
-
-static void __exit sh_mipi_exit(void)
-{
-	platform_driver_unregister(&sh_mipi_driver);
-}
-module_exit(sh_mipi_exit);
+module_platform_driver_probe(sh_mipi_driver, sh_mipi_probe);
 
 MODULE_AUTHOR("Guennadi Liakhovetski <[email protected]>");
 MODULE_DESCRIPTION("SuperH / ARM-shmobile MIPI DSI driver");
drivers/video/sh_mobile_hdmi.c +1 -11
index 930e550..bfe4728 100644
@@ -1445,17 +1445,7 @@ static struct platform_driver sh_hdmi_driver = {
 	},
 };
 
-static int __init sh_hdmi_init(void)
-{
-	return platform_driver_probe(&sh_hdmi_driver, sh_hdmi_probe);
-}
-module_init(sh_hdmi_init);
-
-static void __exit sh_hdmi_exit(void)
-{
-	platform_driver_unregister(&sh_hdmi_driver);
-}
-module_exit(sh_hdmi_exit);
+module_platform_driver_probe(sh_hdmi_driver, sh_hdmi_probe);
 
 MODULE_AUTHOR("Guennadi Liakhovetski <[email protected]>");
 MODULE_DESCRIPTION("SuperH / ARM-shmobile HDMI driver");
Signature · 1 line
Nicolas Ferre
#2 lore raw
Quoted 9 lines · Nicolas Ferre

On 03/15/2013 10:00 AM, Fabio Porcedda :

Quoted 7 lines

This patch converts the drivers to use the module_platform_driver_probe() macro which makes the code smaller and a bit simpler.

Cc Florian Tobias Schandinat <[email protected]>
Cc Nicolas Ferre <[email protected]>
Quoted 12 lines

For atmel_lcdfb.c:

Thanks Fabio.

Quoted 6 lines
Cc Tomi Valkeinen <[email protected]>
Cc David Howells <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Kuninori Morimoto <[email protected]>

---

If you prefer a patch for each driver I will split the patch.

Best regards
Fabio Porcedda

Quoted 138 lines
Quoted 124 lines

Notes:
v3:
- add missing drivers: amifb, atmel_lcdfb, vrfb
- split patch set to each maintainer to easy up respin
v2:
- rebased over linux-next and remove already converted drivers

 drivers/video/amifb.c          | 14 +-------------
 drivers/video/atmel_lcdfb.c    | 13 +------------
 drivers/video/omap2/vrfb.c     | 13 +------------
 drivers/video/sh_mipi_dsi.c    | 12 +-----------
 drivers/video/sh_mobile_hdmi.c | 12 +-----------
 5 files changed, 5 insertions(+), 59 deletions(-)
drivers/video/amifb.c +1 -13
index 7fa1bf8..03e2de2 100644
@@ -3788,19 +3788,7 @@ static struct platform_driver amifb_driver = {
      },
 };
 
-static int __init amifb_init(void)
-{
-     return platform_driver_probe(&amifb_driver, amifb_probe);
-}
-
-module_init(amifb_init);
-
-static void __exit amifb_exit(void)
-{
-     platform_driver_unregister(&amifb_driver);
-}
-
-module_exit(amifb_exit);
+return module_platform_driver_probe(amifb_driver, amifb_probe);
 
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:amiga-video");
drivers/video/atmel_lcdfb.c +1 -12
index 12cf5f3..654e102 100644
@@ -1150,18 +1150,7 @@ static struct platform_driver atmel_lcdfb_driver = {
      },
 };
 
-static int __init atmel_lcdfb_init(void)
-{
-     return platform_driver_probe(&atmel_lcdfb_driver, atmel_lcdfb_probe);
-}
-
-static void __exit atmel_lcdfb_exit(void)
-{
-     platform_driver_unregister(&atmel_lcdfb_driver);
-}
-
-module_init(atmel_lcdfb_init);
-module_exit(atmel_lcdfb_exit);
+module_platform_driver_probe(atmel_lcdfb_driver, atmel_lcdfb_probe);
 
 MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver");
 MODULE_AUTHOR("Nicolas Ferre <[email protected]>");
drivers/video/omap2/vrfb.c +1 -12
index 10560ef..5261229 100644
@@ -397,18 +397,7 @@ static struct platform_driver vrfb_driver = {
      .remove         = __exit_p(vrfb_remove),
 };
 
-static int __init vrfb_init(void)
-{
-     return platform_driver_probe(&vrfb_driver, &vrfb_probe);
-}
-
-static void __exit vrfb_exit(void)
-{
-     platform_driver_unregister(&vrfb_driver);
-}
-
-module_init(vrfb_init);
-module_exit(vrfb_exit);
+module_platform_driver_probe(vrfb_driver, vrfb_probe);
 
 MODULE_AUTHOR("Tomi Valkeinen <[email protected]>");
 MODULE_DESCRIPTION("OMAP VRFB");
drivers/video/sh_mipi_dsi.c +1 -11
index 701b461..6cad530 100644
@@ -581,17 +581,7 @@ static struct platform_driver sh_mipi_driver = {
      },
 };
 
-static int __init sh_mipi_init(void)
-{
-     return platform_driver_probe(&sh_mipi_driver, sh_mipi_probe);
-}
-module_init(sh_mipi_init);
-
-static void __exit sh_mipi_exit(void)
-{
-     platform_driver_unregister(&sh_mipi_driver);
-}
-module_exit(sh_mipi_exit);
+module_platform_driver_probe(sh_mipi_driver, sh_mipi_probe);
 
 MODULE_AUTHOR("Guennadi Liakhovetski <[email protected]>");
 MODULE_DESCRIPTION("SuperH / ARM-shmobile MIPI DSI driver");
drivers/video/sh_mobile_hdmi.c +0 -5
index 930e550..bfe4728 100644
@@ -1445,17 +1445,7 @@ static struct platform_driver sh_hdmi_driver = {
      },
 };
 
-static int __init sh_hdmi_init(void)
-{
-     return platform_driver_probe(&sh_hdmi_driver, sh_hdmi_probe);
-}
-module_init(sh_hdmi_init);

drivers/video/sh_mobile_hdmi.c static struct platform_driver sh_hdmi_driver = { · line 1451

Quoted 10 lines
drivers/video/sh_mobile_hdmi.c +1 -6
-
-static void __exit sh_hdmi_exit(void)
-{
-     platform_driver_unregister(&sh_hdmi_driver);
-}
-module_exit(sh_hdmi_exit);
+module_platform_driver_probe(sh_hdmi_driver, sh_hdmi_probe);
 
 MODULE_AUTHOR("Guennadi Liakhovetski <[email protected]>");
 MODULE_DESCRIPTION("SuperH / ARM-shmobile HDMI driver");

--
Nicolas Ferre

Signature · 1 line
Fabio Porcedda
Acked-by on v3 1/1
#3 lore raw
In reply to Fabio Porcedda

Hi Fabio,

Thank you for the patch.

Quoted 40 lines · On Friday 15 March 2013 10:00:19 Fabio Porcedda wrote:

This patch converts the drivers to use the module_platform_driver_probe() macro which makes the code smaller and a bit simpler.

Cc Florian Tobias Schandinat <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc David Howells <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Kuninori Morimoto <[email protected]>

---

Notes:
v3:
- add missing drivers: amifb, atmel_lcdfb, vrfb
- split patch set to each maintainer to easy up respin
v2:
- rebased over linux-next and remove already converted drivers

 drivers/video/amifb.c          | 14 +-------------
 drivers/video/atmel_lcdfb.c    | 13 +------------
 drivers/video/omap2/vrfb.c     | 13 +------------
 drivers/video/sh_mipi_dsi.c    | 12 +-----------
 drivers/video/sh_mobile_hdmi.c | 12 +-----------
 5 files changed, 5 insertions(+), 59 deletions(-)
drivers/video/amifb.c +0 -4
index 7fa1bf8..03e2de2 100644
@@ -3788,19 +3788,7 @@ static struct platform_driver amifb_driver = {
 	},
 };
 
-static int __init amifb_init(void)
-{
-	return platform_driver_probe(&amifb_driver, amifb_probe);
-}

drivers/video/amifb.c static struct platform_driver amifb_driver = { · line 3791

Quoted 10 lines
drivers/video/amifb.c +1 -9
-
-module_init(amifb_init);
-
-static void __exit amifb_exit(void)
-{
-	platform_driver_unregister(&amifb_driver);
-}
-
-module_exit(amifb_exit);
+return module_platform_driver_probe(amifb_driver, amifb_probe);

I think think you need a "return" here.

After fixing that,

Quoted 2 lines
drivers/video/amifb.c +0 -0
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:amiga-video");
Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw
Quoted 58 lines · Laurent Pinchart

Hi Fabio,

Thank you for the patch.

Quoted 40 lines · On Friday 15 March 2013 10:00:19 Fabio Porcedda wrote:

This patch converts the drivers to use the module_platform_driver_probe() macro which makes the code smaller and a bit simpler.

Cc Florian Tobias Schandinat <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc David Howells <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Kuninori Morimoto <[email protected]>

---

Notes:
v3:
- add missing drivers: amifb, atmel_lcdfb, vrfb
- split patch set to each maintainer to easy up respin
v2:
- rebased over linux-next and remove already converted drivers

 drivers/video/amifb.c          | 14 +-------------
 drivers/video/atmel_lcdfb.c    | 13 +------------
 drivers/video/omap2/vrfb.c     | 13 +------------
 drivers/video/sh_mipi_dsi.c    | 12 +-----------
 drivers/video/sh_mobile_hdmi.c | 12 +-----------
 5 files changed, 5 insertions(+), 59 deletions(-)
drivers/video/amifb.c +0 -4
index 7fa1bf8..03e2de2 100644
@@ -3788,19 +3788,7 @@ static struct platform_driver amifb_driver = {
      },
 };
 
-static int __init amifb_init(void)
-{
-     return platform_driver_probe(&amifb_driver, amifb_probe);
-}

drivers/video/amifb.c static struct platform_driver amifb_driver = { · line 3791

Quoted 10 lines
drivers/video/amifb.c +1 -9
-
-module_init(amifb_init);
-
-static void __exit amifb_exit(void)
-{
-     platform_driver_unregister(&amifb_driver);
-}
-
-module_exit(amifb_exit);
+return module_platform_driver_probe(amifb_driver, amifb_probe);

I think think you need a "return" here.

Quoted 1 line

After fixing that,

Thanks for reviewing.
I will send shortly the patch v4.

Regards
Fabio Porcedda

Quoted 10 lines

drivers/video/amifb.c static struct platform_driver amifb_driver = { · line 3794

Quoted 2 lines
drivers/video/amifb.c +0 -0
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:amiga-video");

--
Regards,

Laurent Pinchart