Commit 7c81ce02 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller

[NET]: Switch comx over to initcalls.

parent ad5f4823
...@@ -16,7 +16,6 @@ extern int scc_enet_init(void); ...@@ -16,7 +16,6 @@ extern int scc_enet_init(void);
extern int fec_enet_init(void); extern int fec_enet_init(void);
extern int sdla_setup(void); extern int sdla_setup(void);
extern int sdla_c_setup(void); extern int sdla_c_setup(void);
extern int comx_init(void);
extern int lmc_setup(void); extern int lmc_setup(void);
extern int madgemc_probe(void); extern int madgemc_probe(void);
...@@ -52,10 +51,6 @@ static struct net_probe pci_probes[] __initdata = { ...@@ -52,10 +51,6 @@ static struct net_probe pci_probes[] __initdata = {
#if defined(CONFIG_FEC_ENET) #if defined(CONFIG_FEC_ENET)
{fec_enet_init, 0}, {fec_enet_init, 0},
#endif #endif
#if defined(CONFIG_COMX)
{comx_init, 0},
#endif
#if defined(CONFIG_LANMEDIA) #if defined(CONFIG_LANMEDIA)
{lmc_setup, 0}, {lmc_setup, 0},
#endif #endif
......
...@@ -1427,24 +1427,20 @@ static struct comx_hardware hicomx_hw = { ...@@ -1427,24 +1427,20 @@ static struct comx_hardware hicomx_hw = {
NULL NULL
}; };
#ifdef MODULE static int __init comx_hw_comx_init(void)
#define comx_hw_comx_init init_module
#endif
int __init comx_hw_comx_init(void)
{ {
comx_register_hardware(&comx_hw); comx_register_hardware(&comx_hw);
comx_register_hardware(&cmx_hw); comx_register_hardware(&cmx_hw);
comx_register_hardware(&hicomx_hw); comx_register_hardware(&hicomx_hw);
memset(memory_used, 0, sizeof(memory_used));
return 0; return 0;
} }
#ifdef MODULE static void __exit comx_hw_comx_exit(void)
void cleanup_module(void)
{ {
comx_unregister_hardware("comx"); comx_unregister_hardware("comx");
comx_unregister_hardware("cmx"); comx_unregister_hardware("cmx");
comx_unregister_hardware("hicomx"); comx_unregister_hardware("hicomx");
} }
#endif
module_init(comx_hw_comx_init);
module_exit(comx_hw_comx_exit);
...@@ -479,20 +479,16 @@ static struct comx_hardware locomx_hw = { ...@@ -479,20 +479,16 @@ static struct comx_hardware locomx_hw = {
NULL NULL
}; };
#ifdef MODULE static int __init comx_hw_locomx_init(void)
#define comx_hw_locomx_init init_module
#endif
int __init comx_hw_locomx_init(void)
{ {
comx_register_hardware(&locomx_hw); comx_register_hardware(&locomx_hw);
return 0; return 0;
} }
#ifdef MODULE static void __exit comx_hw_locomx_exit(void)
void cleanup_module(void)
{ {
comx_unregister_hardware("locomx"); comx_unregister_hardware("locomx");
return;
} }
#endif
module_init(comx_hw_locomx_init);
module_exit(comx_hw_locomx_exit);
...@@ -944,21 +944,15 @@ static struct comx_hardware mixcomhw = { ...@@ -944,21 +944,15 @@ static struct comx_hardware mixcomhw = {
NULL NULL
}; };
/* Module management */ static int __init comx_hw_mixcom_init(void)
#ifdef MODULE
#define comx_hw_mixcom_init init_module
#endif
int __init comx_hw_mixcom_init(void)
{ {
return(comx_register_hardware(&mixcomhw)); return comx_register_hardware(&mixcomhw);
} }
#ifdef MODULE static void __exit comx_hw_mixcom_exit(void)
void
cleanup_module(void)
{ {
comx_unregister_hardware("mixcom"); comx_unregister_hardware("mixcom");
} }
#endif
module_init(comx_hw_mixcom_init);
module_exit(comx_hw_mixcom_exit);
...@@ -988,11 +988,7 @@ static struct comx_hardware fr_dlci = { ...@@ -988,11 +988,7 @@ static struct comx_hardware fr_dlci = {
.hw_dump = dlci_dump, .hw_dump = dlci_dump,
}; };
#ifdef MODULE static int __init comx_proto_fr_init(void)
#define comx_proto_fr_init init_module
#endif
int __init comx_proto_fr_init(void)
{ {
int ret; int ret;
...@@ -1005,12 +1001,12 @@ int __init comx_proto_fr_init(void) ...@@ -1005,12 +1001,12 @@ int __init comx_proto_fr_init(void)
return comx_register_protocol(&fr_slave_protocol); return comx_register_protocol(&fr_slave_protocol);
} }
#ifdef MODULE static void __exit comx_proto_fr_exit(void)
void cleanup_module(void)
{ {
comx_unregister_hardware(fr_dlci.name); comx_unregister_hardware(fr_dlci.name);
comx_unregister_protocol(fr_master_protocol.name); comx_unregister_protocol(fr_master_protocol.name);
comx_unregister_protocol(fr_slave_protocol.name); comx_unregister_protocol(fr_slave_protocol.name);
} }
#endif /* MODULE */
module_init(comx_proto_fr_init);
module_exit(comx_proto_fr_exit);
...@@ -523,7 +523,7 @@ static struct comx_protocol comx25_protocol = { ...@@ -523,7 +523,7 @@ static struct comx_protocol comx25_protocol = {
NULL NULL
}; };
int __init comx_proto_lapb_init(void) static int __init comx_proto_lapb_init(void)
{ {
int ret; int ret;
...@@ -539,9 +539,7 @@ static void __exit comx_proto_lapb_exit(void) ...@@ -539,9 +539,7 @@ static void __exit comx_proto_lapb_exit(void)
comx_unregister_protocol(comx25_protocol.name); comx_unregister_protocol(comx25_protocol.name);
} }
#ifdef MODULE
module_init(comx_proto_lapb_init); module_init(comx_proto_lapb_init);
#endif
module_exit(comx_proto_lapb_exit); module_exit(comx_proto_lapb_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -247,26 +247,24 @@ static struct comx_protocol hdlc_protocol = { ...@@ -247,26 +247,24 @@ static struct comx_protocol hdlc_protocol = {
NULL NULL
}; };
static int __init comx_proto_ppp_init(void)
#ifdef MODULE
#define comx_proto_ppp_init init_module
#endif
int __init comx_proto_ppp_init(void)
{ {
int ret; int ret;
if(0!=(ret=comx_register_protocol(&hdlc_protocol))) { ret = comx_register_protocol(&hdlc_protocol);
return ret; if (!ret) {
ret = comx_register_protocol(&syncppp_protocol);
if (ret)
comx_unregister_protocol(hdlc_protocol.name);
} }
return comx_register_protocol(&syncppp_protocol); return ret;
} }
#ifdef MODULE static void __exit comx_proto_ppp_exit(void)
void cleanup_module(void)
{ {
comx_unregister_protocol(syncppp_protocol.name); comx_unregister_protocol(syncppp_protocol.name);
comx_unregister_protocol(hdlc_protocol.name); comx_unregister_protocol(hdlc_protocol.name);
} }
#endif /* MODULE */
module_init(comx_proto_ppp_init);
module_exit(comx_proto_ppp_exit);
...@@ -81,15 +81,6 @@ MODULE_AUTHOR("Gergely Madarasz <gorgo@itc.hu>"); ...@@ -81,15 +81,6 @@ MODULE_AUTHOR("Gergely Madarasz <gorgo@itc.hu>");
MODULE_DESCRIPTION("Common code for the COMX synchronous serial adapters"); MODULE_DESCRIPTION("Common code for the COMX synchronous serial adapters");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
extern int comx_hw_comx_init(void);
extern int comx_hw_locomx_init(void);
extern int comx_hw_mixcom_init(void);
extern int comx_proto_hdlc_init(void);
extern int comx_proto_ppp_init(void);
extern int comx_proto_syncppp_init(void);
extern int comx_proto_lapb_init(void);
extern int comx_proto_fr_init(void);
static struct comx_hardware *comx_channels = NULL; static struct comx_hardware *comx_channels = NULL;
static struct comx_protocol *comx_lines = NULL; static struct comx_protocol *comx_lines = NULL;
...@@ -1078,11 +1069,7 @@ int comx_unregister_protocol(char *name) ...@@ -1078,11 +1069,7 @@ int comx_unregister_protocol(char *name)
return -1; return -1;
} }
#ifdef MODULE static int __init comx_init(void)
#define comx_init init_module
#endif
int __init comx_init(void)
{ {
struct proc_dir_entry *new_file; struct proc_dir_entry *new_file;
...@@ -1115,42 +1102,18 @@ int __init comx_init(void) ...@@ -1115,42 +1102,18 @@ int __init comx_init(void)
printk(KERN_INFO "COMX: driver version %s (C) 1995-1999 ITConsult-Pro Co. <info@itc.hu>\n", printk(KERN_INFO "COMX: driver version %s (C) 1995-1999 ITConsult-Pro Co. <info@itc.hu>\n",
VERSION); VERSION);
#ifndef MODULE
#ifdef CONFIG_COMX_HW_COMX
comx_hw_comx_init();
#endif
#ifdef CONFIG_COMX_HW_LOCOMX
comx_hw_locomx_init();
#endif
#ifdef CONFIG_COMX_HW_MIXCOM
comx_hw_mixcom_init();
#endif
#ifdef CONFIG_COMX_PROTO_HDLC
comx_proto_hdlc_init();
#endif
#ifdef CONFIG_COMX_PROTO_PPP
comx_proto_ppp_init();
#endif
#ifdef CONFIG_COMX_PROTO_LAPB
comx_proto_lapb_init();
#endif
#ifdef CONFIG_COMX_PROTO_FR
comx_proto_fr_init();
#endif
#endif
return 0; return 0;
} }
#ifdef MODULE static void __exit comx_exit(void)
void cleanup_module(void)
{ {
remove_proc_entry(FILENAME_HARDWARELIST, comx_root_dir); remove_proc_entry(FILENAME_HARDWARELIST, comx_root_dir);
remove_proc_entry(FILENAME_PROTOCOLLIST, comx_root_dir); remove_proc_entry(FILENAME_PROTOCOLLIST, comx_root_dir);
remove_proc_entry(comx_root_dir->name, &proc_root); remove_proc_entry(comx_root_dir->name, &proc_root);
} }
#endif
module_init(comx_init);
module_exit(comx_exit);
EXPORT_SYMBOL(comx_register_hardware); EXPORT_SYMBOL(comx_register_hardware);
EXPORT_SYMBOL(comx_unregister_hardware); EXPORT_SYMBOL(comx_unregister_hardware);
......
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