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 @@
# Makefile for the Linux network (ATM) device drivers.
#
EXTRA_CFLAGS := -g
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_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
ifeq ($(CONFIG_ATM_NICSTAR_USE_SUNI),y)
obj-$(CONFIG_ATM_NICSTAR) += suni.o
endif
ifeq ($(CONFIG_ATM_NICSTAR_USE_IDT77105),y)
obj-$(CONFIG_ATM_NICSTAR) += idt77105.o
endif
ifeq ($(CONFIG_ATM_IDT77252_USE_SUNI),y)
obj-$(CONFIG_ATM_IDT77252) += suni.o
endif
obj-$(CONFIG_ATM_HORIZON) += horizon.o
obj-$(CONFIG_ATM_AMBASSADOR) += ambassador.o
obj-$(CONFIG_ATM_TCP) += atmtcp.o
obj-$(CONFIG_ATM_IA) += iphase.o suni.o
obj-$(CONFIG_ATM_FIRESTREAM) += firestream.o
obj-$(CONFIG_ATM_LANAI) += lanai.o
ifeq ($(CONFIG_ATM_FORE200E_PCA),y)
FORE200E_FW_OBJS += fore200e_pca_fw.o
ifeq ($(strip $(CONFIG_ATM_FORE200E_PCA_FW)),"")
CONFIG_ATM_FORE200E_PCA_DEFAULT_FW := y
endif
fore_200e-objs += fore200e_pca_fw.o
# guess the target endianess to choose the right PCA-200E firmware image
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 ../../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 $(src)/../../include/asm/byteorder.h | grep ' __LITTLE_ENDIAN '`"; then echo pca200e.bin; else echo pca200e_ecd.bin2; fi)
endif
endif
ifeq ($(CONFIG_ATM_FORE200E_SBA),y)
FORE200E_FW_OBJS += fore200e_sba_fw.o
ifeq ($(strip $(CONFIG_ATM_FORE200E_SBA_FW)),"")
CONFIG_ATM_FORE200E_SBA_DEFAULT_FW := y
endif
fore_200e-objs += fore200e_sba_fw.o
ifeq ($(CONFIG_ATM_FORE200E_SBA_DEFAULT_FW),y)
CONFIG_ATM_FORE200E_SBA_FW := sba200e_ecd.bin2
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
# FORE Systems 200E-series firmware magic
......
......@@ -2576,7 +2576,6 @@ static void __init amb_check_args (void) {
/********** module stuff **********/
#ifdef MODULE
MODULE_AUTHOR(maintainer_string);
MODULE_DESCRIPTION(description_string);
MODULE_LICENSE("GPL");
......@@ -2597,7 +2596,7 @@ MODULE_PARM_DESC(pci_lat, "PCI latency in bus cycles");
/********** module entry **********/
int init_module (void) {
static int __init amb_module_init (void) {
int devs;
PRINTD (DBG_FLOW|DBG_INIT, "init_module");
......@@ -2631,7 +2630,7 @@ int init_module (void) {
/********** module exit **********/
void cleanup_module (void) {
static void __exit amb_module_exit (void) {
amb_dev * dev;
PRINTD (DBG_FLOW|DBG_INIT, "cleanup_module");
......@@ -2659,38 +2658,5 @@ void cleanup_module (void) {
return;
}
#else
/********** 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
module_init(amb_module_init);
module_exit(amb_module_exit);
......@@ -96,11 +96,9 @@ extern const struct fore200e_bus fore200e_bus[];
static struct fore200e* fore200e_boards = NULL;
#ifdef MODULE
MODULE_AUTHOR("Christophe Lizzi - credits to Uwe Dannowski and Heikki Vatiainen");
MODULE_DESCRIPTION("FORE Systems 200E-series ATM driver - version " FORE200E_VERSION);
MODULE_SUPPORTED_DEVICE("PCA-200E, SBA-200E");
#endif
static const int fore200e_rx_buf_nbr[ BUFFER_SCHEME_NBR ][ BUFFER_MAGN_NBR ] = {
......@@ -2583,9 +2581,8 @@ fore200e_init(struct fore200e* fore200e)
return 0;
}
int __init
fore200e_detect(void)
static int __init
fore200e_module_init(void)
{
const struct fore200e_bus* bus;
struct fore200e* fore200e;
......@@ -2618,23 +2615,24 @@ fore200e_detect(void)
}
}
return link;
if (link)
return 0;
return -ENODEV;
}
#ifdef MODULE
static void
fore200e_cleanup(struct fore200e** head)
static void __exit
fore200e_module_cleanup(void)
{
struct fore200e* fore200e = *head;
while (fore200e_boards) {
struct fore200e* fore200e = fore200e_boards;
fore200e_shutdown(fore200e);
*head = fore200e->next;
fore200e_boards = fore200e->next;
kfree(fore200e);
}
DPRINTK(1, "module being removed\n");
}
#endif
static int
......@@ -2907,27 +2905,8 @@ fore200e_proc_read(struct atm_dev *dev,loff_t* pos,char* page)
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_exit(fore200e_module_cleanup);
#endif
static const struct atmdev_ops fore200e_ops =
......
......@@ -2927,7 +2927,6 @@ static void __init hrz_check_args (void) {
return;
}
#ifdef MODULE
MODULE_AUTHOR(maintainer_string);
MODULE_DESCRIPTION(description_string);
MODULE_LICENSE("GPL");
......@@ -2944,7 +2943,7 @@ MODULE_PARM_DESC(pci_lat, "PCI latency in bus cycles");
/********** module entry **********/
int init_module (void) {
static int __init hrz_module_init (void) {
int devs;
// sanity check - cast is needed since printk does not support %Zu
......@@ -2977,7 +2976,7 @@ int init_module (void) {
/********** module exit **********/
void cleanup_module (void) {
static void __exit hrz_module_exit (void) {
hrz_dev * dev;
PRINTD (DBG_FLOW, "cleanup_module");
......@@ -3000,40 +2999,5 @@ void cleanup_module (void) {
return;
}
#else
/********** 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
module_init(hrz_module_init);
module_exit(hrz_module_exit);
......@@ -40,9 +40,6 @@
*******************************************************************************/
#ifdef IA_MODULE
#define MODULE
#endif
#include <linux/version.h>
#include <linux/module.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;
static u32 IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER
|IF_IADBG_ABR | IF_IADBG_EVENT*/ 0;
#ifdef MODULE
MODULE_PARM(IA_TX_BUF, "i");
MODULE_PARM(IA_TX_BUF_SZ, "i");
MODULE_PARM(IA_RX_BUF, "i");
MODULE_PARM(IA_RX_BUF_SZ, "i");
MODULE_PARM(IADebugFlag, "i");
#endif
MODULE_LICENSE("GPL");
......@@ -1162,10 +1157,7 @@ static int rx_pkt(struct atm_dev *dev)
goto out_free_desc;
}
#if LINUX_VERSION_CODE >= 0x20312
if (!(skb = atm_alloc_charge(vcc, len, GFP_ATOMIC))) {
#else
if (atm_charge(vcc, atm_pdu2truesize(len))) {
/* lets allocate an skb for now */
skb = alloc_skb(len, GFP_ATOMIC);
if (!skb)
......@@ -1178,7 +1170,6 @@ static int rx_pkt(struct atm_dev *dev)
}
else {
IF_EVENT(printk("IA: Rx over the rx_quota %ld\n", vcc->rx_quota);)
#endif
if (vcc->vci < 32)
printk("Drop control packets\n");
goto out_free_desc;
......@@ -1323,11 +1314,7 @@ static void rx_dle_intr(struct atm_dev *dev)
{
atomic_inc(&vcc->stats->rx_err);
dev_kfree_skb_any(skb);
#if LINUX_VERSION_CODE >= 0x20312
atm_return(vcc, atm_guess_pdu2truesize(len));
#else
atm_return(vcc, atm_pdu2truesize(len));
#endif
goto INCR_DLE;
}
// get real pkt length pwang_test
......@@ -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)",
length, skb->len);)
dev_kfree_skb_any(skb);
#if LINUX_VERSION_CODE >= 0x20312
atm_return(vcc, atm_guess_pdu2truesize(len));
#else
atm_return(vcc, atm_pdu2truesize(len));
#endif
goto INCR_DLE;
}
skb_trim(skb, length);
......@@ -2168,13 +2151,8 @@ static int tx_init(struct atm_dev *dev)
writew(0xaa00, iadev->seg_reg+ABRUBR_ARB);
iadev->close_pending = 0;
#if LINUX_VERSION_CODE >= 0x20303
init_waitqueue_head(&iadev->close_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);
ia_init_rtn_q(&iadev->tx_return_q);
......@@ -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)
#else
__initfunc(static int ia_init(struct atm_dev *dev))
#endif
{
IADEV *iadev;
unsigned long real_base, base;
......@@ -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);
}
#if LINUX_VERSION_CODE >= 0x20312
static int __init ia_start(struct atm_dev *dev)
#else
__initfunc(static int ia_start(struct atm_dev *dev))
#endif
{
IADEV *iadev;
int error = 1;
......@@ -2559,7 +2529,7 @@ __initfunc(static int ia_start(struct atm_dev *dev))
SUNI_RSOP_CIE_LOSE - 0x04
*/
ia_phy_put(dev, ia_phy_get(dev,0x10) | 0x04, 0x10);
#ifndef MODULE
#if 0
error = dev->phy->start(dev);
if (error) {
free_irq(iadev->irq, dev);
......@@ -2709,7 +2679,7 @@ static int ia_open(struct atm_vcc *vcc, short vpi, int vci)
set_bit(ATM_VF_READY,&vcc->flags);
#ifndef MODULE
#if 0
{
static u8 first = 1;
if (first) {
......@@ -3167,11 +3137,7 @@ static const struct atmdev_ops ops = {
};
#if LINUX_VERSION_CODE >= 0x20312
int __init ia_detect(void)
#else
__initfunc(int ia_detect(void))
#endif
static int __init ia_detect(void)
{
struct atm_dev *dev;
IADEV *iadev;
......@@ -3228,10 +3194,7 @@ __initfunc(int ia_detect(void))
return index;
}
#ifdef MODULE
int init_module(void)
static int __init ia_module_init(void)
{
IF_EVENT(printk(">ia init_module\n");)
if (!ia_detect()) {
......@@ -3245,7 +3208,7 @@ int init_module(void)
}
void cleanup_module(void)
static void __exit ia_module_exit(void)
{
struct atm_dev *dev;
IADEV *iadev;
......@@ -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)
return count;
}
#ifdef MODULE
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)
static int __init lanai_module_init(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");
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
* gone, so there isn't much to do
......@@ -2910,8 +2899,9 @@ void cleanup_module(void)
DPRINTK("cleanup_module()\n");
}
module_init(lanai_module_init);
module_exit(lanai_module_exit);
MODULE_AUTHOR("Mitchell Blank Jr <mitch@sfgoth.com>");
MODULE_DESCRIPTION("Efficient Networks Speedstream 3010 driver");
MODULE_LICENSE("GPL");
#endif /* MODULE */
......@@ -276,15 +276,13 @@ MODULE_LICENSE("GPL");
/* Functions*******************************************************************/
#ifdef MODULE
int __init init_module(void)
static int __init nicstar_module_init(void)
{
int i;
unsigned error = 0; /* Initialized to remove compile warning */
struct pci_dev *pcidev;
XPRINTK("nicstar: init_module() called.\n");
XPRINTK("nicstar: nicstar_module_init() called.\n");
if(!pci_present())
{
printk("nicstar: no PCI subsystem found.\n");
......@@ -323,7 +321,7 @@ int __init init_module(void)
#ifdef PHY_LOOPBACK
printk("nicstar: using PHY loopback.\n");
#endif /* PHY_LOOPBACK */
XPRINTK("nicstar: init_module() returned.\n");
XPRINTK("nicstar: nicstar_module_init() returned.\n");
init_timer(&ns_timer);
ns_timer.expires = jiffies + NS_POLL_PERIOD;
......@@ -335,7 +333,7 @@ int __init init_module(void)
void cleanup_module(void)
static void __exit nicstar_module_exit(void)
{
int i, j;
unsigned short pci_command;
......@@ -419,60 +417,6 @@ void cleanup_module(void)
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)
{
unsigned long flags;
......@@ -3156,3 +3100,6 @@ static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr)
spin_unlock_irqrestore(&card->res_lock, flags);
return (unsigned char) data;
}
module_init(nicstar_module_init);
module_exit(nicstar_module_exit);
......@@ -1806,8 +1806,7 @@ static const struct atmdev_ops ops = {
.change_qos = zatm_change_qos,
};
int __init zatm_detect(void)
static int __init zatm_module_init(void)
{
struct atm_dev *dev;
struct zatm_dev *zatm_dev;
......@@ -1841,36 +1840,18 @@ int __init zatm_detect(void)
zatm_dev),GFP_KERNEL);
if (!zatm_dev) {
printk(KERN_EMERG "zatm.c: memory shortage\n");
return devs;
goto out;
}
}
}
out:
kfree(zatm_dev);
return devs;
}
#ifdef MODULE
MODULE_LICENSE("GPL");
int init_module(void)
{
if (!zatm_detect()) {
printk(KERN_ERR DEV_LABEL ": no adapter found\n");
return -ENXIO;
}
/* XXX: currently the driver is not unloadable.. */
MOD_INC_USE_COUNT;
return 0;
}
MODULE_LICENSE("GPL");
void cleanup_module(void)
{
/*
* Well, there's no way to get rid of the driver yet, so we don't
* have to clean up, right ? :-)
*/
}
#endif
module_init(zatm_module_init);
......@@ -217,14 +217,6 @@ int __init device_init(void)
for (i = 0; i < MAX_BLKDEV; i++)
INIT_LIST_HEAD(&gendisks[i].list);
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);
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