All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Driver: Adding helper macro for platform_driver boilerplate.
@ 2020-05-09 10:07 ` Harshal Chaudhari
  0 siblings, 0 replies; 4+ messages in thread
From: Harshal Chaudhari @ 2020-05-09 10:07 UTC (permalink / raw)
  To: derek.kiernan, dragan.cvetic, arnd, gregkh, michal.simek
  Cc: linux-arm-kernel, linux-kernel, harshalchau04

From: Harshal <harshalchau04@gmail.com>

For simple module that contain a single platform_driver without any additional setup code then ends up being a block
of duplicated boilerplate.

This patch add a new micro, module_platform_driver(), which replace the module_init()/module_exit() registrations
with template functions.

Signed-off-by: harshal chaudhari <harshalchau04@gmail.com>
---
 drivers/misc/xilinx_sdfec.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index 71bbaa56bdb5..db16a42c66f4 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -1484,25 +1484,7 @@ static struct platform_driver xsdfec_driver = {
 	.remove =  xsdfec_remove,
 };
 
-static int __init xsdfec_init(void)
-{
-	int err;
-
-	err = platform_driver_register(&xsdfec_driver);
-	if (err < 0) {
-		pr_err("%s Unabled to register SDFEC driver", __func__);
-		return err;
-	}
-	return 0;
-}
-
-static void __exit xsdfec_exit(void)
-{
-	platform_driver_unregister(&xsdfec_driver);
-}
-
-module_init(xsdfec_init);
-module_exit(xsdfec_exit);
+module_platform_driver(xsdfec_driver);
 
 MODULE_AUTHOR("Xilinx, Inc");
 MODULE_DESCRIPTION("Xilinx SD-FEC16 Driver");
-- 
2.17.1


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

* [PATCH] Driver: Adding helper macro for platform_driver boilerplate.
@ 2020-05-09 10:07 ` Harshal Chaudhari
  0 siblings, 0 replies; 4+ messages in thread
From: Harshal Chaudhari @ 2020-05-09 10:07 UTC (permalink / raw)
  To: derek.kiernan, dragan.cvetic, arnd, gregkh, michal.simek
  Cc: harshalchau04, linux-kernel, linux-arm-kernel

From: Harshal <harshalchau04@gmail.com>

For simple module that contain a single platform_driver without any additional setup code then ends up being a block
of duplicated boilerplate.

This patch add a new micro, module_platform_driver(), which replace the module_init()/module_exit() registrations
with template functions.

Signed-off-by: harshal chaudhari <harshalchau04@gmail.com>
---
 drivers/misc/xilinx_sdfec.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index 71bbaa56bdb5..db16a42c66f4 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -1484,25 +1484,7 @@ static struct platform_driver xsdfec_driver = {
 	.remove =  xsdfec_remove,
 };
 
-static int __init xsdfec_init(void)
-{
-	int err;
-
-	err = platform_driver_register(&xsdfec_driver);
-	if (err < 0) {
-		pr_err("%s Unabled to register SDFEC driver", __func__);
-		return err;
-	}
-	return 0;
-}
-
-static void __exit xsdfec_exit(void)
-{
-	platform_driver_unregister(&xsdfec_driver);
-}
-
-module_init(xsdfec_init);
-module_exit(xsdfec_exit);
+module_platform_driver(xsdfec_driver);
 
 MODULE_AUTHOR("Xilinx, Inc");
 MODULE_DESCRIPTION("Xilinx SD-FEC16 Driver");
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] Driver: Adding helper macro for platform_driver boilerplate.
  2020-05-09 10:07 ` Harshal Chaudhari
@ 2020-05-09 17:05   ` Greg KH
  -1 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-05-09 17:05 UTC (permalink / raw)
  To: Harshal Chaudhari
  Cc: derek.kiernan, dragan.cvetic, arnd, michal.simek,
	linux-arm-kernel, linux-kernel

On Sat, May 09, 2020 at 03:37:16PM +0530, Harshal Chaudhari wrote:
> From: Harshal <harshalchau04@gmail.com>
> 
> For simple module that contain a single platform_driver without any additional setup code then ends up being a block
> of duplicated boilerplate.
> 
> This patch add a new micro, module_platform_driver(), which replace the module_init()/module_exit() registrations
> with template functions.

Please properly wrap your changelog text.

And fixup the Subject line to match other patches for this driver.

And the text needs to be revised a bit to say what this really is doing,
as what you describe is not correct.

> 
> Signed-off-by: harshal chaudhari <harshalchau04@gmail.com>

Finally, this does not match your "From:" line for the patch, which
means I couldn't take it even if all of the above was correct :(

Please fix up and resend.

thanks,

greg k-h

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

* Re: [PATCH] Driver: Adding helper macro for platform_driver boilerplate.
@ 2020-05-09 17:05   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-05-09 17:05 UTC (permalink / raw)
  To: Harshal Chaudhari
  Cc: arnd, dragan.cvetic, linux-kernel, michal.simek, derek.kiernan,
	linux-arm-kernel

On Sat, May 09, 2020 at 03:37:16PM +0530, Harshal Chaudhari wrote:
> From: Harshal <harshalchau04@gmail.com>
> 
> For simple module that contain a single platform_driver without any additional setup code then ends up being a block
> of duplicated boilerplate.
> 
> This patch add a new micro, module_platform_driver(), which replace the module_init()/module_exit() registrations
> with template functions.

Please properly wrap your changelog text.

And fixup the Subject line to match other patches for this driver.

And the text needs to be revised a bit to say what this really is doing,
as what you describe is not correct.

> 
> Signed-off-by: harshal chaudhari <harshalchau04@gmail.com>

Finally, this does not match your "From:" line for the patch, which
means I couldn't take it even if all of the above was correct :(

Please fix up and resend.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-05-09 17:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09 10:07 [PATCH] Driver: Adding helper macro for platform_driver boilerplate Harshal Chaudhari
2020-05-09 10:07 ` Harshal Chaudhari
2020-05-09 17:05 ` Greg KH
2020-05-09 17:05   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.