mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
pps: clients: parport: Switch to use module_parport_driver()
Switch to use module_parport_driver() to reduce boilerplate code. Acked-by: Rodolfo Giometti <giometti@enneenne.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210607153729.58623-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
fa11c81ce2
commit
9b945d74a5
@ -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;
|
||||
}
|
||||
|
||||
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@lvk.cs.msu.su>");
|
||||
MODULE_DESCRIPTION(DRVDESC);
|
||||
MODULE_DESCRIPTION("parallel port PPS client");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
Loading…
Reference in New Issue
Block a user