From c17df7f9d76e141c976e3c0dd98ca8ff5c0e477c Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Tue, 2 Mar 2004 19:06:19 -0800 Subject: [PATCH] [PATCH] parport: use module_init() Init of low-level drivers (except parport_pc) turned into module_init(). --- drivers/parport/init.c | 19 ----------------- drivers/parport/parport_amiga.c | 4 ++-- drivers/parport/parport_arc.c | 4 +++- drivers/parport/parport_atari.c | 36 +++++++++++++------------------- drivers/parport/parport_mfc3.c | 5 ++--- drivers/parport/parport_sunbpp.c | 21 +++++++------------ 6 files changed, 29 insertions(+), 60 deletions(-) diff --git a/drivers/parport/init.c b/drivers/parport/init.c index 522670f9bdefc..1b14d8f146543 100644 --- a/drivers/parport/init.c +++ b/drivers/parport/init.c @@ -28,10 +28,6 @@ static int irq[PARPORT_MAX] __initdata = { [0 ... PARPORT_MAX-1] = PARPORT_IRQ_P static int dma[PARPORT_MAX] __initdata = { [0 ... PARPORT_MAX-1] = PARPORT_DMA_NONE }; extern int parport_pc_init(int *io, int *io_hi, int *irq, int *dma); -extern int parport_sunbpp_init(void); -extern int parport_amiga_init(void); -extern int parport_mfc3_init(void); -extern int parport_atari_init(void); static int parport_setup_ptr __initdata = 0; @@ -148,21 +144,6 @@ int __init parport_init (void) #ifdef CONFIG_PARPORT_PC parport_pc_init(io, io_hi, irq, dma); -#endif -#ifdef CONFIG_PARPORT_AMIGA - parport_amiga_init(); -#endif -#ifdef CONFIG_PARPORT_MFC3 - parport_mfc3_init(); -#endif -#ifdef CONFIG_PARPORT_ATARI - parport_atari_init(); -#endif -#ifdef CONFIG_PARPORT_ARC - parport_arc_init(); -#endif -#ifdef CONFIG_PARPORT_SUNBPP - parport_sunbpp_init(); #endif return 0; } diff --git a/drivers/parport/parport_amiga.c b/drivers/parport/parport_amiga.c index 2dd959a4e0056..b40d9bcce915a 100644 --- a/drivers/parport/parport_amiga.c +++ b/drivers/parport/parport_amiga.c @@ -234,7 +234,7 @@ static struct parport_operations pp_amiga_ops = { /* ----------- Initialisation code --------------------------------- */ -int __init parport_amiga_init(void) +static int __init parport_amiga_init(void) { struct parport *p; int err; @@ -276,7 +276,7 @@ out_mem: return err; } -void __exit parport_amiga_exit(void) +static void __exit parport_amiga_exit(void) { if (this_port->irq != PARPORT_IRQ_NONE) free_irq(IRQ_AMIGA_CIAA_FLG, this_port); diff --git a/drivers/parport/parport_arc.c b/drivers/parport/parport_arc.c index f6efa4fd7536f..00af74dadea5b 100644 --- a/drivers/parport/parport_arc.c +++ b/drivers/parport/parport_arc.c @@ -104,7 +104,7 @@ static struct parport_operations parport_arc_ops = /* --- Initialisation code -------------------------------- */ -int parport_arc_init(void) +static int parport_arc_init(void) { /* Archimedes hardware provides only one port, at a fixed address */ struct parport *p; @@ -136,3 +136,5 @@ int parport_arc_init(void) return 1; } + +module_init(parport_arc_init) diff --git a/drivers/parport/parport_atari.c b/drivers/parport/parport_atari.c index 1fd616d120ee2..91ced449570a8 100644 --- a/drivers/parport/parport_atari.c +++ b/drivers/parport/parport_atari.c @@ -185,8 +185,7 @@ static struct parport_operations parport_atari_ops = { }; -int __init -parport_atari_init(void) +static int __init parport_atari_init(void) { struct parport *p; unsigned long flags; @@ -208,11 +207,11 @@ parport_atari_init(void) IRQ_MFP_BUSY, PARPORT_DMA_NONE, &parport_atari_ops); if (!p) - return 0; + return -ENODEV; if (request_irq(IRQ_MFP_BUSY, parport_atari_interrupt, IRQ_TYPE_SLOW, p->name, p)) { parport_unregister_port (p); - return 0; + return -ENODEV; } this_port = p; @@ -221,30 +220,23 @@ parport_atari_init(void) parport_announce_port (p); - return 1; + return 0; } - return 0; + return -ENODEV; } -#ifdef MODULE - -MODULE_AUTHOR("Andreas Schwab"); -MODULE_DESCRIPTION("Parport Driver for Atari builtin Port"); -MODULE_SUPPORTED_DEVICE("Atari builtin Parallel Port"); -MODULE_LICENSE("GPL"); - -int -init_module(void) -{ - return parport_atari_init() ? 0 : -ENODEV; -} - -void -cleanup_module(void) +static void __exit parport_atari_exit(void) { if (this_port->irq != PARPORT_IRQ_NONE) free_irq(IRQ_MFP_BUSY, this_port); parport_proc_unregister(this_port); parport_unregister_port(this_port); } -#endif + +MODULE_AUTHOR("Andreas Schwab"); +MODULE_DESCRIPTION("Parport Driver for Atari builtin Port"); +MODULE_SUPPORTED_DEVICE("Atari builtin Parallel Port"); +MODULE_LICENSE("GPL"); + +module_init(parport_atari_init) +module_exit(parport_atari_exit) diff --git a/drivers/parport/parport_mfc3.c b/drivers/parport/parport_mfc3.c index 8dcc3c6509744..7ed93e407a8d9 100644 --- a/drivers/parport/parport_mfc3.c +++ b/drivers/parport/parport_mfc3.c @@ -320,7 +320,7 @@ static struct parport_operations pp_mfc3_ops = { /* ----------- Initialisation code --------------------------------- */ -int __init parport_mfc3_init(void) +static int __init parport_mfc3_init(void) { struct parport *p; int pias = 0; @@ -378,7 +378,7 @@ int __init parport_mfc3_init(void) return pias ? 0 : -ENODEV; } -void __exit parport_mfc3_exit(void) +static void __exit parport_mfc3_exit(void) { int i; @@ -403,4 +403,3 @@ MODULE_LICENSE("GPL"); module_init(parport_mfc3_init) module_exit(parport_mfc3_exit) - diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c index 69f13168a2940..d7a57224055fb 100644 --- a/drivers/parport/parport_sunbpp.c +++ b/drivers/parport/parport_sunbpp.c @@ -349,11 +349,7 @@ static int __init init_one_port(struct sbus_dev *sdev) return 1; } -#ifdef MODULE -int init_module(void) -#else -int __init parport_sunbpp_init(void) -#endif +static int __init parport_sunbpp_init(void) { struct sbus_bus *sbus; struct sbus_dev *sdev; @@ -368,13 +364,7 @@ int __init parport_sunbpp_init(void) return count ? 0 : -ENODEV; } -#ifdef MODULE -MODULE_AUTHOR("Derrick J Brashear"); -MODULE_DESCRIPTION("Parport Driver for Sparc bidirectional Port"); -MODULE_SUPPORTED_DEVICE("Sparc Bidirectional Parallel Port"); - -void -cleanup_module(void) +static void __exit parport_sunbpp_exit(void) { struct parport *p = parport_enumerate(); @@ -396,6 +386,11 @@ cleanup_module(void) p = next; } } -#endif +MODULE_AUTHOR("Derrick J Brashear"); +MODULE_DESCRIPTION("Parport Driver for Sparc bidirectional Port"); +MODULE_SUPPORTED_DEVICE("Sparc Bidirectional Parallel Port"); MODULE_LICENSE("GPL"); + +module_init(parport_sunbpp_init) +module_exit(parport_sunbpp_exit) -- 2.53.0