Commit 2c08ec0f authored by Ondrej Zary's avatar Ondrej Zary Committed by Damien Le Moal

ata: pata_parport: Introduce module_pata_parport_driver macro

Introduce module_pata_parport_driver macro and use it in protocol
drivers to reduce boilerplate code. Remove paride_(un)register
compatibility defines.
Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: default avatarOndrej Zary <linux@zary.sk>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
parent cfe1e632
...@@ -147,16 +147,5 @@ static struct pi_protocol aten = { ...@@ -147,16 +147,5 @@ static struct pi_protocol aten = {
.log_adapter = aten_log_adapter, .log_adapter = aten_log_adapter,
}; };
static int __init aten_init(void)
{
return paride_register(&aten);
}
static void __exit aten_exit(void)
{
paride_unregister( &aten );
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(aten_init) module_pata_parport_driver(aten);
module_exit(aten_exit)
...@@ -462,16 +462,5 @@ static struct pi_protocol bpck = { ...@@ -462,16 +462,5 @@ static struct pi_protocol bpck = {
.log_adapter = bpck_log_adapter, .log_adapter = bpck_log_adapter,
}; };
static int __init bpck_init(void)
{
return paride_register(&bpck);
}
static void __exit bpck_exit(void)
{
paride_unregister(&bpck);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(bpck_init) module_pata_parport_driver(bpck);
module_exit(bpck_exit)
...@@ -245,19 +245,8 @@ static struct pi_protocol bpck6 = { ...@@ -245,19 +245,8 @@ static struct pi_protocol bpck6 = {
.release_proto = bpck6_release_proto, .release_proto = bpck6_release_proto,
}; };
static int __init bpck6_init(void)
{
return paride_register(&bpck6);
}
static void __exit bpck6_exit(void)
{
paride_unregister(&bpck6);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Micro Solutions Inc."); MODULE_AUTHOR("Micro Solutions Inc.");
MODULE_DESCRIPTION("BACKPACK Protocol module, compatible with PARIDE"); MODULE_DESCRIPTION("BACKPACK Protocol module, compatible with PARIDE");
module_param(verbose, bool, 0644); module_param(verbose, bool, 0644);
module_init(bpck6_init) module_pata_parport_driver(bpck6);
module_exit(bpck6_exit)
...@@ -206,16 +206,5 @@ static struct pi_protocol comm = { ...@@ -206,16 +206,5 @@ static struct pi_protocol comm = {
.log_adapter = comm_log_adapter, .log_adapter = comm_log_adapter,
}; };
static int __init comm_init(void)
{
return paride_register(&comm);
}
static void __exit comm_exit(void)
{
paride_unregister(&comm);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(comm_init) module_pata_parport_driver(comm);
module_exit(comm_exit)
...@@ -218,16 +218,5 @@ static struct pi_protocol dstr = { ...@@ -218,16 +218,5 @@ static struct pi_protocol dstr = {
.log_adapter = dstr_log_adapter, .log_adapter = dstr_log_adapter,
}; };
static int __init dstr_init(void)
{
return paride_register(&dstr);
}
static void __exit dstr_exit(void)
{
paride_unregister(&dstr);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(dstr_init) module_pata_parport_driver(dstr);
module_exit(dstr_exit)
...@@ -327,12 +327,12 @@ static int __init epat_init(void) ...@@ -327,12 +327,12 @@ static int __init epat_init(void)
#ifdef CONFIG_PATA_PARPORT_EPATC8 #ifdef CONFIG_PATA_PARPORT_EPATC8
epatc8 = 1; epatc8 = 1;
#endif #endif
return paride_register(&epat); return pata_parport_register_driver(&epat);
} }
static void __exit epat_exit(void) static void __exit epat_exit(void)
{ {
paride_unregister(&epat); pata_parport_unregister_driver(&epat);
} }
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -301,16 +301,5 @@ static struct pi_protocol epia = { ...@@ -301,16 +301,5 @@ static struct pi_protocol epia = {
.log_adapter = epia_log_adapter, .log_adapter = epia_log_adapter,
}; };
static int __init epia_init(void)
{
return paride_register(&epia);
}
static void __exit epia_exit(void)
{
paride_unregister(&epia);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(epia_init) module_pata_parport_driver(epia);
module_exit(epia_exit)
...@@ -136,16 +136,5 @@ static struct pi_protocol fit2 = { ...@@ -136,16 +136,5 @@ static struct pi_protocol fit2 = {
.log_adapter = fit2_log_adapter, .log_adapter = fit2_log_adapter,
}; };
static int __init fit2_init(void)
{
return paride_register(&fit2);
}
static void __exit fit2_exit(void)
{
paride_unregister(&fit2);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(fit2_init) module_pata_parport_driver(fit2);
module_exit(fit2_exit)
...@@ -196,16 +196,5 @@ static struct pi_protocol fit3 = { ...@@ -196,16 +196,5 @@ static struct pi_protocol fit3 = {
.log_adapter = fit3_log_adapter, .log_adapter = fit3_log_adapter,
}; };
static int __init fit3_init(void)
{
return paride_register(&fit3);
}
static void __exit fit3_exit(void)
{
paride_unregister(&fit3);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(fit3_init) module_pata_parport_driver(fit3);
module_exit(fit3_exit)
...@@ -261,16 +261,5 @@ static struct pi_protocol friq = { ...@@ -261,16 +261,5 @@ static struct pi_protocol friq = {
.release_proto = friq_release_proto, .release_proto = friq_release_proto,
}; };
static int __init friq_init(void)
{
return paride_register(&friq);
}
static void __exit friq_exit(void)
{
paride_unregister(&friq);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(friq_init) module_pata_parport_driver(friq);
module_exit(friq_exit)
...@@ -298,16 +298,5 @@ static struct pi_protocol frpw = { ...@@ -298,16 +298,5 @@ static struct pi_protocol frpw = {
.log_adapter = frpw_log_adapter, .log_adapter = frpw_log_adapter,
}; };
static int __init frpw_init(void)
{
return paride_register(&frpw);
}
static void __exit frpw_exit(void)
{
paride_unregister(&frpw);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(frpw_init) module_pata_parport_driver(frpw);
module_exit(frpw_exit)
...@@ -288,19 +288,19 @@ static int __init kbic_init(void) ...@@ -288,19 +288,19 @@ static int __init kbic_init(void)
{ {
int rv; int rv;
rv = paride_register(&k951); rv = pata_parport_register_driver(&k951);
if (rv < 0) if (rv < 0)
return rv; return rv;
rv = paride_register(&k971); rv = pata_parport_register_driver(&k971);
if (rv < 0) if (rv < 0)
paride_unregister(&k951); pata_parport_unregister_driver(&k951);
return rv; return rv;
} }
static void __exit kbic_exit(void) static void __exit kbic_exit(void)
{ {
paride_unregister(&k951); pata_parport_unregister_driver(&k951);
paride_unregister(&k971); pata_parport_unregister_driver(&k971);
} }
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -113,16 +113,5 @@ static struct pi_protocol ktti = { ...@@ -113,16 +113,5 @@ static struct pi_protocol ktti = {
.log_adapter = ktti_log_adapter, .log_adapter = ktti_log_adapter,
}; };
static int __init ktti_init(void)
{
return paride_register(&ktti);
}
static void __exit ktti_exit(void)
{
paride_unregister(&ktti);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(ktti_init) module_pata_parport_driver(ktti);
module_exit(ktti_exit)
...@@ -138,16 +138,5 @@ static struct pi_protocol on20 = { ...@@ -138,16 +138,5 @@ static struct pi_protocol on20 = {
.log_adapter = on20_log_adapter, .log_adapter = on20_log_adapter,
}; };
static int __init on20_init(void)
{
return paride_register(&on20);
}
static void __exit on20_exit(void)
{
paride_unregister(&on20);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(on20_init) module_pata_parport_driver(on20);
module_exit(on20_exit)
...@@ -304,16 +304,5 @@ static struct pi_protocol on26 = { ...@@ -304,16 +304,5 @@ static struct pi_protocol on26 = {
.log_adapter = on26_log_adapter, .log_adapter = on26_log_adapter,
}; };
static int __init on26_init(void)
{
return paride_register(&on26);
}
static void __exit on26_exit(void)
{
paride_unregister(&on26);
}
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(on26_init) module_pata_parport_driver(on26);
module_exit(on26_exit)
...@@ -87,8 +87,16 @@ struct pi_protocol { ...@@ -87,8 +87,16 @@ struct pi_protocol {
int pata_parport_register_driver(struct pi_protocol *pr); int pata_parport_register_driver(struct pi_protocol *pr);
void pata_parport_unregister_driver(struct pi_protocol *pr); void pata_parport_unregister_driver(struct pi_protocol *pr);
/* defines for old paride protocol modules */
#define paride_register pata_parport_register_driver /**
#define paride_unregister pata_parport_unregister_driver * module_pata_parport_driver() - Helper macro for registering a pata_parport driver
* @__pi_protocol: pi_protocol struct
*
* Helper macro for pata_parport drivers which do not do anything special in module
* init/exit. This eliminates a lot of boilerplate. Each module may only
* use this macro once, and calling it replaces module_init() and module_exit()
*/
#define module_pata_parport_driver(__pi_protocol) \
module_driver(__pi_protocol, pata_parport_register_driver, pata_parport_unregister_driver)
#endif /* LINUX_PATA_PARPORT_H */ #endif /* LINUX_PATA_PARPORT_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment