Re: [RFC] driver: Adding helper macro for platform_driver boilerplate.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/8/20 4:39 AM, harshal chaudhari wrote:
> Hi Wim and Guenter,
> 
> 
> 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@xxxxxxxxx <mailto:harshalchau04@xxxxxxxxx>>
> 

First, this is not in correct patch format. Second, I don't really see
the point of making such changes without converting the driver to use
the watchdog subsystem.

Guenter

> Patch as below:
> 
> diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
> index f6541d1b65e3..e1e9d5ecd31c 100644
> --- a/drivers/watchdog/gef_wdt.c
> +++ b/drivers/watchdog/gef_wdt.c
> @@ -300,6 +300,7 @@ static const struct of_device_id gef_wdt_ids[] = {
>         },
>         {},
>  };
> +
>  MODULE_DEVICE_TABLE(of, gef_wdt_ids);
>  
>  static struct platform_driver gef_wdt_driver = {
> @@ -311,19 +312,7 @@ static struct platform_driver gef_wdt_driver = {
>         .remove         = gef_wdt_remove,
>  };
>  
> -static int __init gef_wdt_init(void)
> -{
> -       pr_info("GE watchdog driver\n");
> -       return platform_driver_register(&gef_wdt_driver);
> -}
> -
> -static void __exit gef_wdt_exit(void)
> -{
> -       platform_driver_unregister(&gef_wdt_driver);
> -}
> -
> -module_init(gef_wdt_init);
> -module_exit(gef_wdt_exit);
> +module_platform_driver(gef_wdt_driver);
> 
> 
> 
> Thanks & Regards,
> 
> Harshal Chaudhari
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux