Commit f1556f64 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Patrick Mochel

[PATCH] initcalls for ATM

Switch over ATM code to initcalls and reorder the makefile so
that link order inside atm is the same.  I've also cleaned up
the makefile a bit while at it.

I didn't fix the existing compilation problems in the drivers (cli &
friends) and the broken le/be firmware selection for the fore200e cards
(kbuild breakage) though.
parent 716041cc
...@@ -2,62 +2,51 @@ ...@@ -2,62 +2,51 @@
# Makefile for the Linux network (ATM) device drivers. # Makefile for the Linux network (ATM) device drivers.
# #
EXTRA_CFLAGS := -g
export-objs := uPD98402.o suni.o idt77105.o export-objs := uPD98402.o suni.o idt77105.o
fore_200e-objs := fore200e.o
host-progs := fore200e_mkfirm
obj-y := atmdev_init.o
obj-$(CONFIG_ATM_ENI) += eni.o suni.o
obj-$(CONFIG_ATM_ZATM) += zatm.o uPD98402.o obj-$(CONFIG_ATM_ZATM) += zatm.o uPD98402.o
obj-$(CONFIG_ATM_NICSTAR) += nicstar.o obj-$(CONFIG_ATM_NICSTAR) += nicstar.o
obj-$(CONFIG_ATM_AMBASSADOR) += ambassador.o
obj-$(CONFIG_ATM_HORIZON) += horizon.o
obj-$(CONFIG_ATM_IA) += iphase.o suni.o
obj-$(CONFIG_ATM_FORE200E) += fore_200e.o
obj-$(CONFIG_ATM_ENI) += eni.o suni.o
obj-$(CONFIG_ATM_IDT77252) += idt77252.o obj-$(CONFIG_ATM_IDT77252) += idt77252.o
ifeq ($(CONFIG_ATM_NICSTAR_USE_SUNI),y) ifeq ($(CONFIG_ATM_NICSTAR_USE_SUNI),y)
obj-$(CONFIG_ATM_NICSTAR) += suni.o obj-$(CONFIG_ATM_NICSTAR) += suni.o
endif endif
ifeq ($(CONFIG_ATM_NICSTAR_USE_IDT77105),y) ifeq ($(CONFIG_ATM_NICSTAR_USE_IDT77105),y)
obj-$(CONFIG_ATM_NICSTAR) += idt77105.o obj-$(CONFIG_ATM_NICSTAR) += idt77105.o
endif endif
ifeq ($(CONFIG_ATM_IDT77252_USE_SUNI),y) ifeq ($(CONFIG_ATM_IDT77252_USE_SUNI),y)
obj-$(CONFIG_ATM_IDT77252) += suni.o obj-$(CONFIG_ATM_IDT77252) += suni.o
endif endif
obj-$(CONFIG_ATM_HORIZON) += horizon.o
obj-$(CONFIG_ATM_AMBASSADOR) += ambassador.o
obj-$(CONFIG_ATM_TCP) += atmtcp.o obj-$(CONFIG_ATM_TCP) += atmtcp.o
obj-$(CONFIG_ATM_IA) += iphase.o suni.o
obj-$(CONFIG_ATM_FIRESTREAM) += firestream.o obj-$(CONFIG_ATM_FIRESTREAM) += firestream.o
obj-$(CONFIG_ATM_LANAI) += lanai.o obj-$(CONFIG_ATM_LANAI) += lanai.o
ifeq ($(CONFIG_ATM_FORE200E_PCA),y) ifeq ($(CONFIG_ATM_FORE200E_PCA),y)
FORE200E_FW_OBJS += fore200e_pca_fw.o fore_200e-objs += fore200e_pca_fw.o
ifeq ($(strip $(CONFIG_ATM_FORE200E_PCA_FW)),"") # guess the target endianess to choose the right PCA-200E firmware image
CONFIG_ATM_FORE200E_PCA_DEFAULT_FW := y
endif
ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y) ifeq ($(CONFIG_ATM_FORE200E_PCA_DEFAULT_FW),y)
# guess the target endianess to choose the right PCA-200E firmware image CONFIG_ATM_FORE200E_PCA_FW = $(shell if test -n "`$(CC) -E -dM $(src)/../../include/asm/byteorder.h | grep ' __LITTLE_ENDIAN '`"; then echo pca200e.bin; else echo pca200e_ecd.bin2; fi)
CONFIG_ATM_FORE200E_PCA_FW := $(shell if test -n "`$(CC) -E -dM ../../include/asm/byteorder.h | grep ' __LITTLE_ENDIAN '`"; then echo pca200e.bin; else echo pca200e_ecd.bin2; fi)
endif endif
endif endif
ifeq ($(CONFIG_ATM_FORE200E_SBA),y) ifeq ($(CONFIG_ATM_FORE200E_SBA),y)
FORE200E_FW_OBJS += fore200e_sba_fw.o fore_200e-objs += fore200e_sba_fw.o
ifeq ($(strip $(CONFIG_ATM_FORE200E_SBA_FW)),"")
CONFIG_ATM_FORE200E_SBA_DEFAULT_FW := y
endif
ifeq ($(CONFIG_ATM_FORE200E_SBA_DEFAULT_FW),y) ifeq ($(CONFIG_ATM_FORE200E_SBA_DEFAULT_FW),y)
CONFIG_ATM_FORE200E_SBA_FW := sba200e_ecd.bin2 CONFIG_ATM_FORE200E_SBA_FW := sba200e_ecd.bin2
endif endif
endif endif
obj-$(CONFIG_ATM_FORE200E) += fore_200e.o
fore_200e-objs := fore200e.o $(FORE200E_FW_OBJS)
host-progs := fore200e_mkfirm
EXTRA_CFLAGS := -g
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
# FORE Systems 200E-series firmware magic # FORE Systems 200E-series firmware magic
......
...@@ -2576,7 +2576,6 @@ static void __init amb_check_args (void) { ...@@ -2576,7 +2576,6 @@ static void __init amb_check_args (void) {
/********** module stuff **********/ /********** module stuff **********/
#ifdef MODULE
MODULE_AUTHOR(maintainer_string); MODULE_AUTHOR(maintainer_string);
MODULE_DESCRIPTION(description_string); MODULE_DESCRIPTION(description_string);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -2597,7 +2596,7 @@ MODULE_PARM_DESC(pci_lat, "PCI latency in bus cycles"); ...@@ -2597,7 +2596,7 @@ MODULE_PARM_DESC(pci_lat, "PCI latency in bus cycles");
/********** module entry **********/ /********** module entry **********/
int init_module (void) { static int __init amb_module_init (void) {
int devs; int devs;
PRINTD (DBG_FLOW|DBG_INIT, "init_module"); PRINTD (DBG_FLOW|DBG_INIT, "init_module");
...@@ -2631,7 +2630,7 @@ int init_module (void) { ...@@ -2631,7 +2630,7 @@ int init_module (void) {
/********** module exit **********/ /********** module exit **********/
void cleanup_module (void) { static void __exit amb_module_exit (void) {
amb_dev * dev; amb_dev * dev;
PRINTD (DBG_FLOW|DBG_INIT, "cleanup_module"); PRINTD (DBG_FLOW|DBG_INIT, "cleanup_module");
...@@ -2659,38 +2658,5 @@ void cleanup_module (void) { ...@@ -2659,38 +2658,5 @@ void cleanup_module (void) {
return; return;
} }
#else module_init(amb_module_init);
module_exit(amb_module_exit);
/********** monolithic entry **********/
int __init amb_detect (void) {
int devs;
// sanity check - cast needed as printk does not support %Zu
if (sizeof(amb_mem) != 4*16 + 4*12) {
PRINTK (KERN_ERR, "Fix amb_mem (is %lu words).",
(unsigned long) sizeof(amb_mem));
return 0;
}
show_version();
amb_check_args();
// get the juice
devs = amb_probe();
if (devs) {
init_timer (&housekeeping);
housekeeping.function = do_housekeeping;
// paranoia
housekeeping.data = 1;
set_timer (&housekeeping, 0);
} else {
PRINTK (KERN_INFO, "no (usable) adapters found");
}
return devs;
}
#endif
...@@ -96,11 +96,9 @@ extern const struct fore200e_bus fore200e_bus[]; ...@@ -96,11 +96,9 @@ extern const struct fore200e_bus fore200e_bus[];
static struct fore200e* fore200e_boards = NULL; static struct fore200e* fore200e_boards = NULL;
#ifdef MODULE
MODULE_AUTHOR("Christophe Lizzi - credits to Uwe Dannowski and Heikki Vatiainen"); MODULE_AUTHOR("Christophe Lizzi - credits to Uwe Dannowski and Heikki Vatiainen");
MODULE_DESCRIPTION("FORE Systems 200E-series ATM driver - version " FORE200E_VERSION); MODULE_DESCRIPTION("FORE Systems 200E-series ATM driver - version " FORE200E_VERSION);
MODULE_SUPPORTED_DEVICE("PCA-200E, SBA-200E"); MODULE_SUPPORTED_DEVICE("PCA-200E, SBA-200E");
#endif
static const int fore200e_rx_buf_nbr[ BUFFER_SCHEME_NBR ][ BUFFER_MAGN_NBR ] = { static const int fore200e_rx_buf_nbr[ BUFFER_SCHEME_NBR ][ BUFFER_MAGN_NBR ] = {
...@@ -2583,9 +2581,8 @@ fore200e_init(struct fore200e* fore200e) ...@@ -2583,9 +2581,8 @@ fore200e_init(struct fore200e* fore200e)
return 0; return 0;
} }
static int __init
int __init fore200e_module_init(void)
fore200e_detect(void)
{ {
const struct fore200e_bus* bus; const struct fore200e_bus* bus;
struct fore200e* fore200e; struct fore200e* fore200e;
...@@ -2618,23 +2615,24 @@ fore200e_detect(void) ...@@ -2618,23 +2615,24 @@ fore200e_detect(void)
} }
} }
return link; if (link)
return 0;
return -ENODEV;
} }
#ifdef MODULE static void __exit
static void fore200e_module_cleanup(void)
fore200e_cleanup(struct fore200e** head)
{ {
struct fore200e* fore200e = *head; while (fore200e_boards) {
struct fore200e* fore200e = fore200e_boards;
fore200e_shutdown(fore200e); fore200e_shutdown(fore200e);
fore200e_boards = fore200e->next;
*head = fore200e->next;
kfree(fore200e); kfree(fore200e);
}
DPRINTK(1, "module being removed\n");
} }
#endif
static int static int
...@@ -2907,27 +2905,8 @@ fore200e_proc_read(struct atm_dev *dev,loff_t* pos,char* page) ...@@ -2907,27 +2905,8 @@ fore200e_proc_read(struct atm_dev *dev,loff_t* pos,char* page)
return 0; return 0;
} }
#ifdef MODULE
static int __init
fore200e_module_init(void)
{
DPRINTK(1, "module loaded\n");
return fore200e_detect() == 0;
}
static void __exit
fore200e_module_cleanup(void)
{
while (fore200e_boards) {
fore200e_cleanup(&fore200e_boards);
}
DPRINTK(1, "module being removed\n");
}
module_init(fore200e_module_init); module_init(fore200e_module_init);
module_exit(fore200e_module_cleanup); module_exit(fore200e_module_cleanup);
#endif
static const struct atmdev_ops fore200e_ops = static const struct atmdev_ops fore200e_ops =
......
...@@ -2927,7 +2927,6 @@ static void __init hrz_check_args (void) { ...@@ -2927,7 +2927,6 @@ static void __init hrz_check_args (void) {
return; return;
} }
#ifdef MODULE
MODULE_AUTHOR(maintainer_string); MODULE_AUTHOR(maintainer_string);
MODULE_DESCRIPTION(description_string); MODULE_DESCRIPTION(description_string);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -2944,7 +2943,7 @@ MODULE_PARM_DESC(pci_lat, "PCI latency in bus cycles"); ...@@ -2944,7 +2943,7 @@ MODULE_PARM_DESC(pci_lat, "PCI latency in bus cycles");
/********** module entry **********/ /********** module entry **********/
int init_module (void) { static int __init hrz_module_init (void) {
int devs; int devs;
// sanity check - cast is needed since printk does not support %Zu // sanity check - cast is needed since printk does not support %Zu
...@@ -2977,7 +2976,7 @@ int init_module (void) { ...@@ -2977,7 +2976,7 @@ int init_module (void) {
/********** module exit **********/ /********** module exit **********/
void cleanup_module (void) { static void __exit hrz_module_exit (void) {
hrz_dev * dev; hrz_dev * dev;
PRINTD (DBG_FLOW, "cleanup_module"); PRINTD (DBG_FLOW, "cleanup_module");
...@@ -3000,40 +2999,5 @@ void cleanup_module (void) { ...@@ -3000,40 +2999,5 @@ void cleanup_module (void) {
return; return;
} }
#else module_init(hrz_module_init);
module_exit(hrz_module_exit);
/********** monolithic entry **********/
int __init hrz_detect (void) {
int devs;
// sanity check - cast is needed since printk does not support %Zu
if (sizeof(struct MEMMAP) != 128*1024/4) {
PRINTK (KERN_ERR, "Fix struct MEMMAP (is %lu fakewords).",
(unsigned long) sizeof(struct MEMMAP));
return 0;
}
show_version();
// what about command line arguments?
// check arguments
hrz_check_args();
// get the juice
devs = hrz_probe();
if (devs) {
init_timer (&housekeeping);
housekeeping.function = do_housekeeping;
// paranoia
housekeeping.data = 1;
set_timer (&housekeeping, 0);
} else {
PRINTK (KERN_ERR, "no (usable) adapters found");
}
return devs;
}
#endif
...@@ -40,9 +40,6 @@ ...@@ -40,9 +40,6 @@
*******************************************************************************/ *******************************************************************************/
#ifdef IA_MODULE
#define MODULE
#endif
#include <linux/version.h> #include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -88,13 +85,11 @@ static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ; ...@@ -88,13 +85,11 @@ static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ;
static u32 IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER static u32 IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER
|IF_IADBG_ABR | IF_IADBG_EVENT*/ 0; |IF_IADBG_ABR | IF_IADBG_EVENT*/ 0;
#ifdef MODULE
MODULE_PARM(IA_TX_BUF, "i"); MODULE_PARM(IA_TX_BUF, "i");
MODULE_PARM(IA_TX_BUF_SZ, "i"); MODULE_PARM(IA_TX_BUF_SZ, "i");
MODULE_PARM(IA_RX_BUF, "i"); MODULE_PARM(IA_RX_BUF, "i");
MODULE_PARM(IA_RX_BUF_SZ, "i"); MODULE_PARM(IA_RX_BUF_SZ, "i");
MODULE_PARM(IADebugFlag, "i"); MODULE_PARM(IADebugFlag, "i");
#endif
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -1162,10 +1157,7 @@ static int rx_pkt(struct atm_dev *dev) ...@@ -1162,10 +1157,7 @@ static int rx_pkt(struct atm_dev *dev)
goto out_free_desc; goto out_free_desc;
} }
#if LINUX_VERSION_CODE >= 0x20312
if (!(skb = atm_alloc_charge(vcc, len, GFP_ATOMIC))) { if (!(skb = atm_alloc_charge(vcc, len, GFP_ATOMIC))) {
#else
if (atm_charge(vcc, atm_pdu2truesize(len))) {
/* lets allocate an skb for now */ /* lets allocate an skb for now */
skb = alloc_skb(len, GFP_ATOMIC); skb = alloc_skb(len, GFP_ATOMIC);
if (!skb) if (!skb)
...@@ -1178,7 +1170,6 @@ static int rx_pkt(struct atm_dev *dev) ...@@ -1178,7 +1170,6 @@ static int rx_pkt(struct atm_dev *dev)
} }
else { else {
IF_EVENT(printk("IA: Rx over the rx_quota %ld\n", vcc->rx_quota);) IF_EVENT(printk("IA: Rx over the rx_quota %ld\n", vcc->rx_quota);)
#endif
if (vcc->vci < 32) if (vcc->vci < 32)
printk("Drop control packets\n"); printk("Drop control packets\n");
goto out_free_desc; goto out_free_desc;
...@@ -1323,11 +1314,7 @@ static void rx_dle_intr(struct atm_dev *dev) ...@@ -1323,11 +1314,7 @@ static void rx_dle_intr(struct atm_dev *dev)
{ {
atomic_inc(&vcc->stats->rx_err); atomic_inc(&vcc->stats->rx_err);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
#if LINUX_VERSION_CODE >= 0x20312
atm_return(vcc, atm_guess_pdu2truesize(len)); atm_return(vcc, atm_guess_pdu2truesize(len));
#else
atm_return(vcc, atm_pdu2truesize(len));
#endif
goto INCR_DLE; goto INCR_DLE;
} }
// get real pkt length pwang_test // get real pkt length pwang_test
...@@ -1341,11 +1328,7 @@ static void rx_dle_intr(struct atm_dev *dev) ...@@ -1341,11 +1328,7 @@ static void rx_dle_intr(struct atm_dev *dev)
IF_ERR(printk("rx_dle_intr: Bad AAL5 trailer %d (skb len %d)", IF_ERR(printk("rx_dle_intr: Bad AAL5 trailer %d (skb len %d)",
length, skb->len);) length, skb->len);)
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
#if LINUX_VERSION_CODE >= 0x20312
atm_return(vcc, atm_guess_pdu2truesize(len)); atm_return(vcc, atm_guess_pdu2truesize(len));
#else
atm_return(vcc, atm_pdu2truesize(len));
#endif
goto INCR_DLE; goto INCR_DLE;
} }
skb_trim(skb, length); skb_trim(skb, length);
...@@ -2168,13 +2151,8 @@ static int tx_init(struct atm_dev *dev) ...@@ -2168,13 +2151,8 @@ static int tx_init(struct atm_dev *dev)
writew(0xaa00, iadev->seg_reg+ABRUBR_ARB); writew(0xaa00, iadev->seg_reg+ABRUBR_ARB);
iadev->close_pending = 0; iadev->close_pending = 0;
#if LINUX_VERSION_CODE >= 0x20303
init_waitqueue_head(&iadev->close_wait); init_waitqueue_head(&iadev->close_wait);
init_waitqueue_head(&iadev->timeout_wait); init_waitqueue_head(&iadev->timeout_wait);
#else
iadev->close_wait = NULL;
iadev->timeout_wait = NULL;
#endif
skb_queue_head_init(&iadev->tx_dma_q); skb_queue_head_init(&iadev->tx_dma_q);
ia_init_rtn_q(&iadev->tx_return_q); ia_init_rtn_q(&iadev->tx_return_q);
...@@ -2286,11 +2264,7 @@ static int reset_sar(struct atm_dev *dev) ...@@ -2286,11 +2264,7 @@ static int reset_sar(struct atm_dev *dev)
} }
#if LINUX_VERSION_CODE >= 0x20312
static int __init ia_init(struct atm_dev *dev) static int __init ia_init(struct atm_dev *dev)
#else
__initfunc(static int ia_init(struct atm_dev *dev))
#endif
{ {
IADEV *iadev; IADEV *iadev;
unsigned long real_base, base; unsigned long real_base, base;
...@@ -2459,11 +2433,7 @@ static unsigned char ia_phy_get(struct atm_dev *dev, unsigned long addr) ...@@ -2459,11 +2433,7 @@ static unsigned char ia_phy_get(struct atm_dev *dev, unsigned long addr)
return readl(INPH_IA_DEV(dev)->phy+addr); return readl(INPH_IA_DEV(dev)->phy+addr);
} }
#if LINUX_VERSION_CODE >= 0x20312
static int __init ia_start(struct atm_dev *dev) static int __init ia_start(struct atm_dev *dev)
#else
__initfunc(static int ia_start(struct atm_dev *dev))
#endif
{ {
IADEV *iadev; IADEV *iadev;
int error = 1; int error = 1;
...@@ -2559,7 +2529,7 @@ __initfunc(static int ia_start(struct atm_dev *dev)) ...@@ -2559,7 +2529,7 @@ __initfunc(static int ia_start(struct atm_dev *dev))
SUNI_RSOP_CIE_LOSE - 0x04 SUNI_RSOP_CIE_LOSE - 0x04
*/ */
ia_phy_put(dev, ia_phy_get(dev,0x10) | 0x04, 0x10); ia_phy_put(dev, ia_phy_get(dev,0x10) | 0x04, 0x10);
#ifndef MODULE #if 0
error = dev->phy->start(dev); error = dev->phy->start(dev);
if (error) { if (error) {
free_irq(iadev->irq, dev); free_irq(iadev->irq, dev);
...@@ -2709,7 +2679,7 @@ static int ia_open(struct atm_vcc *vcc, short vpi, int vci) ...@@ -2709,7 +2679,7 @@ static int ia_open(struct atm_vcc *vcc, short vpi, int vci)
set_bit(ATM_VF_READY,&vcc->flags); set_bit(ATM_VF_READY,&vcc->flags);
#ifndef MODULE #if 0
{ {
static u8 first = 1; static u8 first = 1;
if (first) { if (first) {
...@@ -3167,11 +3137,7 @@ static const struct atmdev_ops ops = { ...@@ -3167,11 +3137,7 @@ static const struct atmdev_ops ops = {
}; };
#if LINUX_VERSION_CODE >= 0x20312 static int __init ia_detect(void)
int __init ia_detect(void)
#else
__initfunc(int ia_detect(void))
#endif
{ {
struct atm_dev *dev; struct atm_dev *dev;
IADEV *iadev; IADEV *iadev;
...@@ -3228,10 +3194,7 @@ __initfunc(int ia_detect(void)) ...@@ -3228,10 +3194,7 @@ __initfunc(int ia_detect(void))
return index; return index;
} }
static int __init ia_module_init(void)
#ifdef MODULE
int init_module(void)
{ {
IF_EVENT(printk(">ia init_module\n");) IF_EVENT(printk(">ia init_module\n");)
if (!ia_detect()) { if (!ia_detect()) {
...@@ -3245,7 +3208,7 @@ int init_module(void) ...@@ -3245,7 +3208,7 @@ int init_module(void)
} }
void cleanup_module(void) static void __exit ia_module_exit(void)
{ {
struct atm_dev *dev; struct atm_dev *dev;
IADEV *iadev; IADEV *iadev;
...@@ -3297,5 +3260,5 @@ void cleanup_module(void) ...@@ -3297,5 +3260,5 @@ void cleanup_module(void)
} }
} }
#endif module_init(ia_module_init);
module_exit(ia_module_exit);
...@@ -2882,27 +2882,16 @@ static int __init lanai_detect_1(unsigned int vendor, unsigned int device) ...@@ -2882,27 +2882,16 @@ static int __init lanai_detect_1(unsigned int vendor, unsigned int device)
return count; return count;
} }
#ifdef MODULE static int __init lanai_module_init(void)
static
#endif
int __init lanai_detect(void)
{
return lanai_detect_1(PCI_VENDOR_ID_EF, PCI_VENDOR_ID_EF_ATM_LANAI2) +
lanai_detect_1(PCI_VENDOR_ID_EF, PCI_VENDOR_ID_EF_ATM_LANAIHB);
}
#ifdef MODULE
int init_module(void)
{ {
if (lanai_detect() == 0) { if (lanai_detect_1(PCI_VENDOR_ID_EF, PCI_VENDOR_ID_EF_ATM_LANAI2) +
lanai_detect_1(PCI_VENDOR_ID_EF, PCI_VENDOR_ID_EF_ATM_LANAIHB))
return 0;
printk(KERN_ERR DEV_LABEL ": no adaptor found\n"); printk(KERN_ERR DEV_LABEL ": no adaptor found\n");
return -ENODEV; return -ENODEV;
}
return 0;
} }
void cleanup_module(void) static void __exit lanai_module_exit(void)
{ {
/* We'll only get called when all the interfaces are already /* We'll only get called when all the interfaces are already
* gone, so there isn't much to do * gone, so there isn't much to do
...@@ -2910,8 +2899,9 @@ void cleanup_module(void) ...@@ -2910,8 +2899,9 @@ void cleanup_module(void)
DPRINTK("cleanup_module()\n"); DPRINTK("cleanup_module()\n");
} }
module_init(lanai_module_init);
module_exit(lanai_module_exit);
MODULE_AUTHOR("Mitchell Blank Jr <mitch@sfgoth.com>"); MODULE_AUTHOR("Mitchell Blank Jr <mitch@sfgoth.com>");
MODULE_DESCRIPTION("Efficient Networks Speedstream 3010 driver"); MODULE_DESCRIPTION("Efficient Networks Speedstream 3010 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#endif /* MODULE */
...@@ -276,15 +276,13 @@ MODULE_LICENSE("GPL"); ...@@ -276,15 +276,13 @@ MODULE_LICENSE("GPL");
/* Functions*******************************************************************/ /* Functions*******************************************************************/
#ifdef MODULE static int __init nicstar_module_init(void)
int __init init_module(void)
{ {
int i; int i;
unsigned error = 0; /* Initialized to remove compile warning */ unsigned error = 0; /* Initialized to remove compile warning */
struct pci_dev *pcidev; struct pci_dev *pcidev;
XPRINTK("nicstar: init_module() called.\n"); XPRINTK("nicstar: nicstar_module_init() called.\n");
if(!pci_present()) if(!pci_present())
{ {
printk("nicstar: no PCI subsystem found.\n"); printk("nicstar: no PCI subsystem found.\n");
...@@ -323,7 +321,7 @@ int __init init_module(void) ...@@ -323,7 +321,7 @@ int __init init_module(void)
#ifdef PHY_LOOPBACK #ifdef PHY_LOOPBACK
printk("nicstar: using PHY loopback.\n"); printk("nicstar: using PHY loopback.\n");
#endif /* PHY_LOOPBACK */ #endif /* PHY_LOOPBACK */
XPRINTK("nicstar: init_module() returned.\n"); XPRINTK("nicstar: nicstar_module_init() returned.\n");
init_timer(&ns_timer); init_timer(&ns_timer);
ns_timer.expires = jiffies + NS_POLL_PERIOD; ns_timer.expires = jiffies + NS_POLL_PERIOD;
...@@ -335,7 +333,7 @@ int __init init_module(void) ...@@ -335,7 +333,7 @@ int __init init_module(void)
void cleanup_module(void) static void __exit nicstar_module_exit(void)
{ {
int i, j; int i, j;
unsigned short pci_command; unsigned short pci_command;
...@@ -419,60 +417,6 @@ void cleanup_module(void) ...@@ -419,60 +417,6 @@ void cleanup_module(void)
XPRINTK("nicstar: cleanup_module() returned.\n"); XPRINTK("nicstar: cleanup_module() returned.\n");
} }
#else
int __init nicstar_detect(void)
{
int i;
unsigned error = 0; /* Initialized to remove compile warning */
struct pci_dev *pcidev;
if(!pci_present())
{
printk("nicstar: no PCI subsystem found.\n");
return -EIO;
}
for(i = 0; i < NS_MAX_CARDS; i++)
cards[i] = NULL;
pcidev = NULL;
for(i = 0; i < NS_MAX_CARDS; i++)
{
if ((pcidev = pci_find_device(PCI_VENDOR_ID_IDT,
PCI_DEVICE_ID_IDT_IDT77201,
pcidev)) == NULL)
break;
error = ns_init_card(i, pcidev);
if (error)
cards[i--] = NULL; /* Try to find another card but don't increment index */
}
if (i == 0 && error)
return -EIO;
TXPRINTK("nicstar: TX debug enabled.\n");
RXPRINTK("nicstar: RX debug enabled.\n");
PRINTK("nicstar: General debug enabled.\n");
#ifdef PHY_LOOPBACK
printk("nicstar: using PHY loopback.\n");
#endif /* PHY_LOOPBACK */
XPRINTK("nicstar: init_module() returned.\n");
init_timer(&ns_timer);
ns_timer.expires = jiffies + NS_POLL_PERIOD;
ns_timer.data = 0UL;
ns_timer.function = ns_poll;
add_timer(&ns_timer);
return i;
}
#endif /* MODULE */
static u32 ns_read_sram(ns_dev *card, u32 sram_address) static u32 ns_read_sram(ns_dev *card, u32 sram_address)
{ {
unsigned long flags; unsigned long flags;
...@@ -3156,3 +3100,6 @@ static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr) ...@@ -3156,3 +3100,6 @@ static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr)
spin_unlock_irqrestore(&card->res_lock, flags); spin_unlock_irqrestore(&card->res_lock, flags);
return (unsigned char) data; return (unsigned char) data;
} }
module_init(nicstar_module_init);
module_exit(nicstar_module_exit);
...@@ -1806,8 +1806,7 @@ static const struct atmdev_ops ops = { ...@@ -1806,8 +1806,7 @@ static const struct atmdev_ops ops = {
.change_qos = zatm_change_qos, .change_qos = zatm_change_qos,
}; };
static int __init zatm_module_init(void)
int __init zatm_detect(void)
{ {
struct atm_dev *dev; struct atm_dev *dev;
struct zatm_dev *zatm_dev; struct zatm_dev *zatm_dev;
...@@ -1841,36 +1840,18 @@ int __init zatm_detect(void) ...@@ -1841,36 +1840,18 @@ int __init zatm_detect(void)
zatm_dev),GFP_KERNEL); zatm_dev),GFP_KERNEL);
if (!zatm_dev) { if (!zatm_dev) {
printk(KERN_EMERG "zatm.c: memory shortage\n"); printk(KERN_EMERG "zatm.c: memory shortage\n");
return devs; goto out;
} }
} }
} }
out:
kfree(zatm_dev); kfree(zatm_dev);
return devs;
}
#ifdef MODULE /* XXX: currently the driver is not unloadable.. */
MODULE_LICENSE("GPL");
int init_module(void)
{
if (!zatm_detect()) {
printk(KERN_ERR DEV_LABEL ": no adapter found\n");
return -ENXIO;
}
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
return 0; return 0;
} }
MODULE_LICENSE("GPL");
void cleanup_module(void) module_init(zatm_module_init);
{
/*
* Well, there's no way to get rid of the driver yet, so we don't
* have to clean up, right ? :-)
*/
}
#endif
...@@ -217,14 +217,6 @@ int __init device_init(void) ...@@ -217,14 +217,6 @@ int __init device_init(void)
for (i = 0; i < MAX_BLKDEV; i++) for (i = 0; i < MAX_BLKDEV; i++)
INIT_LIST_HEAD(&gendisks[i].list); INIT_LIST_HEAD(&gendisks[i].list);
blk_dev_init(); blk_dev_init();
#ifdef CONFIG_FC4_SOC
/* This has to be done before scsi_dev_init */
soc_probe();
#endif
#ifdef CONFIG_ATM
(void) atmdev_init();
#endif
devclass_register(&disk_devclass); devclass_register(&disk_devclass);
return 0; return 0;
} }
......
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