lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77c821e1-adc7-4088-0dcb-da65ba7a39a2@enneenne.com>
Date:   Tue, 11 May 2021 09:05:00 +0200
From:   Rodolfo Giometti <giometti@...eenne.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        linux-kernel@...r.kernel.org
Cc:     gregkh@...uxfoundation.org
Subject: Re: [PATCH v1 1/1] pps: clients: parport: Switch to use
 module_parport_driver()

On 10/05/21 16:13, Andy Shevchenko wrote:
> Switch to use module_parport_driver() to reduce boilerplate code.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/pps/clients/pps_parport.c | 42 ++++++-------------------------
>  1 file changed, 8 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c
> index 7a41fb7b0dec..42f93d4c6ee3 100644
> --- a/drivers/pps/clients/pps_parport.c
> +++ b/drivers/pps/clients/pps_parport.c
> @@ -22,8 +22,6 @@
>  #include <linux/parport.h>
>  #include <linux/pps_kernel.h>
>  
> -#define DRVDESC "parallel port PPS client"
> -
>  /* module parameters */
>  
>  #define CLEAR_WAIT_MAX		100
> @@ -138,6 +136,12 @@ static void parport_attach(struct parport *port)
>  		.dev		= NULL
>  	};
>  
> +	if (clear_wait > CLEAR_WAIT_MAX) {
> +		pr_err("clear_wait value should be not greater then %d\n",
> +		       CLEAR_WAIT_MAX);
> +		return;
> +	}
> +

Why do you need to do so? Maybe a comment would be welcomed.

>  	device = kzalloc(sizeof(struct pps_client_pp), GFP_KERNEL);
>  	if (!device) {
>  		pr_err("memory allocation failed, not attaching\n");
> @@ -214,38 +218,8 @@ static struct parport_driver pps_parport_driver = {
>  	.detach = parport_detach,
>  	.devmodel = true,
>  };
> -
> -/* module staff */
> -
> -static int __init pps_parport_init(void)
> -{
> -	int ret;
> -
> -	pr_info(DRVDESC "\n");
> -
> -	if (clear_wait > CLEAR_WAIT_MAX) {
> -		pr_err("clear_wait value should be not greater"
> -				" then %d\n", CLEAR_WAIT_MAX);
> -		return -EINVAL;
> -	}
> -
> -	ret = parport_register_driver(&pps_parport_driver);
> -	if (ret) {
> -		pr_err("unable to register with parport\n");
> -		return ret;
> -	}
> -
> -	return  0;
> -}
> -
> -static void __exit pps_parport_exit(void)
> -{
> -	parport_unregister_driver(&pps_parport_driver);
> -}
> -
> -module_init(pps_parport_init);
> -module_exit(pps_parport_exit);
> +module_parport_driver(pps_parport_driver);
>  
>  MODULE_AUTHOR("Alexander Gordeev <lasaine@....cs.msu.su>");
> -MODULE_DESCRIPTION(DRVDESC);
> +MODULE_DESCRIPTION("parallel port PPS client");
>  MODULE_LICENSE("GPL");
> 

Ciao,

Rodolfo

-- 
GNU/Linux Solutions                  e-mail: giometti@...eenne.com
Linux Device Driver                          giometti@...ux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ