public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@enneenne.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org
Cc: Alexander Gordeev <lasaine@lvk.cs.msu.su>
Subject: Re: [PATCH v2 1/1] pps: generators: pps_gen_parport: Switch to use module_parport_driver()
Date: Wed, 6 Oct 2021 08:54:50 +0200	[thread overview]
Message-ID: <bd72ecdb-7d7c-726d-85a4-84ea1088eb70@enneenne.com> (raw)
In-Reply-To: <20211001150316.12545-1-andriy.shevchenko@linux.intel.com>

On 01/10/21 17:03, Andy Shevchenko wrote:
> Switch to use module_parport_driver() to reduce boilerplate code.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Rodolfo Giometti <giometti@enneenne.com>

> ---
> v2: remove useless message (Greg), Cc to the original (hopefully) author
>  drivers/pps/generators/pps_gen_parport.c | 42 ++++--------------------
>  1 file changed, 7 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/pps/generators/pps_gen_parport.c b/drivers/pps/generators/pps_gen_parport.c
> index 6a1af7664f3b..fba6c490977c 100644
> --- a/drivers/pps/generators/pps_gen_parport.c
> +++ b/drivers/pps/generators/pps_gen_parport.c
> @@ -20,8 +20,6 @@
>  #include <linux/hrtimer.h>
>  #include <linux/parport.h>
>  
> -#define DRVDESC "parallel port PPS signal generator"
> -
>  #define SIGNAL		0
>  #define NO_SIGNAL	PARPORT_CONTROL_STROBE
>  
> @@ -180,6 +178,11 @@ static void parport_attach(struct parport *port)
>  {
>  	struct pardev_cb pps_cb;
>  
> +	if (send_delay > SEND_DELAY_MAX) {
> +		pr_err("delay value should be not greater then %d\n", SEND_DELAY_MAX);
> +		return -EINVAL;
> +	}
> +
>  	if (attached) {
>  		/* we already have a port */
>  		return;
> @@ -231,39 +234,8 @@ static struct parport_driver pps_gen_parport_driver = {
>  	.detach = parport_detach,
>  	.devmodel = true,
>  };
> -
> -/* module staff */
> -
> -static int __init pps_gen_parport_init(void)
> -{
> -	int ret;
> -
> -	pr_info(DRVDESC "\n");
> -
> -	if (send_delay > SEND_DELAY_MAX) {
> -		pr_err("delay value should be not greater"
> -				" then %d\n", SEND_DELAY_MAX);
> -		return -EINVAL;
> -	}
> -
> -	ret = parport_register_driver(&pps_gen_parport_driver);
> -	if (ret) {
> -		pr_err("unable to register with parport\n");
> -		return ret;
> -	}
> -
> -	return  0;
> -}
> -
> -static void __exit pps_gen_parport_exit(void)
> -{
> -	parport_unregister_driver(&pps_gen_parport_driver);
> -	pr_info("hrtimer avg error is %ldns\n", hrtimer_error);
> -}
> -
> -module_init(pps_gen_parport_init);
> -module_exit(pps_gen_parport_exit);
> +module_parport_driver(pps_gen_parport_driver);
>  
>  MODULE_AUTHOR("Alexander Gordeev <lasaine@lvk.cs.msu.su>");
> -MODULE_DESCRIPTION(DRVDESC);
> +MODULE_DESCRIPTION("parallel port PPS signal generator");
>  MODULE_LICENSE("GPL");
> 


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

  parent reply	other threads:[~2021-10-06  6:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 15:03 [PATCH v2 1/1] pps: generators: pps_gen_parport: Switch to use module_parport_driver() Andy Shevchenko
2021-10-04  6:44 ` Rodolfo Giometti
2021-10-04  7:32   ` Andy Shevchenko
2021-10-06  6:54 ` Rodolfo Giometti [this message]
2022-02-03 15:09   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd72ecdb-7d7c-726d-85a4-84ea1088eb70@enneenne.com \
    --to=giometti@enneenne.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=lasaine@lvk.cs.msu.su \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox