summaryrefslogtreecommitdiffstats
path: root/drivers/atm
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
commit6d403070f28cd44860fdb3a53be5da0275c65cf4 (patch)
tree0d0e7fe7b5fb7568d19e11d7d862b77a866ce081 /drivers/atm
parentecf1bf5f6c2e668d03b0a9fb026db7aa41e292e1 (diff)
Merge with 2.4.0-test1-ac21 + pile of MIPS cleanups to make merging
possible. Chainsawed RM200 kernel to compile again. Jazz machine status unknown.
Diffstat (limited to 'drivers/atm')
-rw-r--r--drivers/atm/Config.in2
-rw-r--r--drivers/atm/Makefile2
-rw-r--r--drivers/atm/ambassador.c92
-rw-r--r--drivers/atm/atmtcp.c10
-rw-r--r--drivers/atm/eni.c15
-rw-r--r--drivers/atm/fore200e.c23
-rw-r--r--drivers/atm/idt77105.c2
-rw-r--r--drivers/atm/iphase.c51
-rw-r--r--drivers/atm/nicstar.c5
-rw-r--r--drivers/atm/zatm.c2
10 files changed, 93 insertions, 111 deletions
diff --git a/drivers/atm/Config.in b/drivers/atm/Config.in
index c603f71af..b04a354bc 100644
--- a/drivers/atm/Config.in
+++ b/drivers/atm/Config.in
@@ -59,7 +59,7 @@ if [ "$CONFIG_PCI" = "y" -o "$CONFIG_SBUS" = "y" ]; then
if [ "$CONFIG_ATM_FORE200E_PCA" = "y" ]; then
bool ' Use default PCA-200E firmware (normally enabled)' CONFIG_ATM_FORE200E_PCA_DEFAULT_FW
if [ "$CONFIG_ATM_FORE200E_PCA_DEFAULT_FW" = "n" ]; then
- string ' Pathname of user-supplied binary firmware' CONFIG_ATM_FORE200E_PCA_FW
+ string ' Pathname of user-supplied binary firmware' CONFIG_ATM_FORE200E_PCA_FW ""
fi
fi
fi
diff --git a/drivers/atm/Makefile b/drivers/atm/Makefile
index 330d5d1c3..b41bc415a 100644
--- a/drivers/atm/Makefile
+++ b/drivers/atm/Makefile
@@ -45,7 +45,7 @@ else
NEED_SUNI_MX = suni.o
endif
ifeq ($(CONFIG_ATM_NICSTAR_USE_IDT77105),y)
- NEED_SUNI_MX = idt77105.o
+ NEED_IDT77105_MX = idt77105.o
endif
endif
endif
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index 47530fa6f..4fc415ea8 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -290,10 +290,12 @@ static inline void __init show_version (void) {
/********** microcode **********/
#ifdef AMB_NEW_MICROCODE
-#define UCODE(x) "atmsar12" "." #x
+#define UCODE(x) UCODE1(atmsar12.,x)
#else
-#define UCODE(x) "atmsar11" "." #x
+#define UCODE(x) UCODE1(atmsar11.,x)
#endif
+#define UCODE2(x) #x
+#define UCODE1(x,y) UCODE2(x ## y)
static const u32 __initdata ucode_start =
#include UCODE(start)
@@ -326,45 +328,43 @@ static const unsigned long onegigmask = -1 << 30;
/********** access to adapter **********/
-static inline void wr_plain (const amb_dev * dev, const u32 * addr, u32 data) {
- PRINTD (DBG_FLOW|DBG_REGS, "wr: %p <- %08x", addr, data);
+static inline void wr_plain (const amb_dev * dev, size_t addr, u32 data) {
+ PRINTD (DBG_FLOW|DBG_REGS, "wr: %08x <- %08x", addr, data);
#ifdef AMB_MMIO
- dev->membase[addr - (u32 *) 0] = data;
+ dev->membase[addr / sizeof(u32)] = data;
#else
- outl (data, dev->iobase + (addr - (u32 *) 0) * sizeof(u32));
+ outl (data, dev->iobase + addr);
#endif
}
-static inline u32 rd_plain (const amb_dev * dev, const u32 * addr) {
+static inline u32 rd_plain (const amb_dev * dev, size_t addr) {
#ifdef AMB_MMIO
- u32 data = dev->membase[addr - (u32 *) 0];
+ u32 data = dev->membase[addr / sizeof(u32)];
#else
- u32 data = inl (dev->iobase + (addr - (u32 *) 0) * sizeof(u32));
+ u32 data = inl (dev->iobase + addr);
#endif
- PRINTD (DBG_FLOW|DBG_REGS, "rd: %p -> %08x", addr, data);
+ PRINTD (DBG_FLOW|DBG_REGS, "rd: %08x -> %08x", addr, data);
return data;
}
-static const amb_mem * const mem = 0;
-
-static inline void wr_mem (const amb_dev * dev, const u32 * addr, u32 data) {
+static inline void wr_mem (const amb_dev * dev, size_t addr, u32 data) {
u32 be = cpu_to_be32 (data);
- PRINTD (DBG_FLOW|DBG_REGS, "wr: %p <- %08x b[%08x]", addr, data, be);
+ PRINTD (DBG_FLOW|DBG_REGS, "wr: %08x <- %08x b[%08x]", addr, data, be);
#ifdef AMB_MMIO
- dev->membase[addr - (u32 *) 0] = be;
+ dev->membase[addr / sizeof(u32)] = be;
#else
- outl (be, dev->iobase + (addr - (u32 *) 0) * sizeof(u32));
+ outl (be, dev->iobase + addr);
#endif
}
-static inline u32 rd_mem (const amb_dev * dev, const u32 * addr) {
+static inline u32 rd_mem (const amb_dev * dev, size_t addr) {
#ifdef AMB_MMIO
- u32 be = dev->membase[addr - (u32 *) 0];
+ u32 be = dev->membase[addr / sizeof(u32)];
#else
- u32 be = inl (dev->iobase + (addr - (u32 *) 0) * sizeof(u32));
+ u32 be = inl (dev->iobase + addr);
#endif
u32 data = be32_to_cpu (be);
- PRINTD (DBG_FLOW|DBG_REGS, "rd: %p -> %08x b[%08x]", addr, data, be);
+ PRINTD (DBG_FLOW|DBG_REGS, "rd: %08x -> %08x b[%08x]", addr, data, be);
return data;
}
@@ -600,7 +600,7 @@ static int command_do (amb_dev * dev, command * cmd) {
ptrs->in = NEXTQ (ptrs->in, ptrs->start, ptrs->limit);
// mail the command
- wr_mem (dev, &mem->mb.adapter.cmd_address, virt_to_bus (ptrs->in));
+ wr_mem (dev, offsetof(amb_mem, mb.adapter.cmd_address), virt_to_bus (ptrs->in));
// prepare to wait for cq->pending milliseconds
// effectively one centisecond on i386
@@ -667,8 +667,8 @@ static inline int tx_give (amb_dev * dev, tx_in * tx) {
txq->pending++;
txq->in.ptr = NEXTQ (txq->in.ptr, txq->in.start, txq->in.limit);
// hand over the TX and ring the bell
- wr_mem (dev, &mem->mb.adapter.tx_address, virt_to_bus (txq->in.ptr));
- wr_mem (dev, &mem->doorbell, TX_FRAME);
+ wr_mem (dev, offsetof(amb_mem, mb.adapter.tx_address), virt_to_bus (txq->in.ptr));
+ wr_mem (dev, offsetof(amb_mem, doorbell), TX_FRAME);
if (txq->pending > txq->high)
txq->high = txq->pending;
@@ -724,7 +724,7 @@ static inline int rx_give (amb_dev * dev, rx_in * rx, unsigned char pool) {
rxq->pending++;
rxq->in.ptr = NEXTQ (rxq->in.ptr, rxq->in.start, rxq->in.limit);
// hand over the RX buffer
- wr_mem (dev, &mem->mb.adapter.rx_address[pool], virt_to_bus (rxq->in.ptr));
+ wr_mem (dev, offsetof(amb_mem, mb.adapter.rx_address[pool]), virt_to_bus (rxq->in.ptr));
spin_unlock_irqrestore (&rxq->lock, flags);
return 0;
@@ -855,16 +855,16 @@ static void fill_rx_pools (amb_dev * dev) {
/********** enable host interrupts **********/
static inline void interrupts_on (amb_dev * dev) {
- wr_plain (dev, &mem->interrupt_control,
- rd_plain (dev, &mem->interrupt_control)
+ wr_plain (dev, offsetof(amb_mem, interrupt_control),
+ rd_plain (dev, offsetof(amb_mem, interrupt_control))
| AMB_INTERRUPT_BITS);
}
/********** disable host interrupts **********/
static inline void interrupts_off (amb_dev * dev) {
- wr_plain (dev, &mem->interrupt_control,
- rd_plain (dev, &mem->interrupt_control)
+ wr_plain (dev, offsetof(amb_mem, interrupt_control),
+ rd_plain (dev, offsetof(amb_mem, interrupt_control))
&~ AMB_INTERRUPT_BITS);
}
@@ -900,7 +900,7 @@ static void interrupt_handler (int irq, void * dev_id, struct pt_regs * pt_regs)
}
{
- u32 interrupt = rd_plain (dev, &mem->interrupt);
+ u32 interrupt = rd_plain (dev, offsetof(amb_mem, interrupt));
// for us or someone else sharing the same interrupt
if (!interrupt) {
@@ -910,7 +910,7 @@ static void interrupt_handler (int irq, void * dev_id, struct pt_regs * pt_regs)
// definitely for us
PRINTD (DBG_IRQ, "FYI: interrupt was %08x", interrupt);
- wr_plain (dev, &mem->interrupt, -1);
+ wr_plain (dev, offsetof(amb_mem, interrupt), -1);
}
{
@@ -959,8 +959,8 @@ static void dont_panic (amb_dev * dev) {
cli();
PRINTK (KERN_INFO, "don't panic - putting adapter into reset");
- wr_plain (dev, &mem->reset_control,
- rd_plain (dev, &mem->reset_control) | AMB_RESET_BITS);
+ wr_plain (dev, offsetof(amb_mem, reset_control),
+ rd_plain (dev, offsetof(amb_mem, reset_control)) | AMB_RESET_BITS);
PRINTK (KERN_INFO, "marking all commands complete");
for (cmd = ptrs->start; cmd < ptrs->limit; ++cmd)
@@ -1985,7 +1985,7 @@ static int __init do_loader_command (volatile loader_block * lb,
lb->valid = cpu_to_be32 (DMA_VALID);
// dump_registers (dev);
// dump_loader_block (lb);
- wr_mem (dev, &mem->doorbell, virt_to_bus (lb) & ~onegigmask);
+ wr_mem (dev, offsetof(amb_mem, doorbell), virt_to_bus (lb) & ~onegigmask);
timeout = command_timeouts[cmd] * HZ/100;
@@ -2002,7 +2002,7 @@ static int __init do_loader_command (volatile loader_block * lb,
if (cmd == adapter_start) {
// wait for start command to acknowledge...
timeout = HZ/10;
- while (rd_plain (dev, &mem->doorbell))
+ while (rd_plain (dev, offsetof(amb_mem, doorbell)))
if (timeout) {
timeout = schedule_timeout (timeout);
} else {
@@ -2095,21 +2095,21 @@ static int amb_reset (amb_dev * dev, int diags) {
PRINTD (DBG_FLOW|DBG_LOAD, "amb_reset");
- word = rd_plain (dev, &mem->reset_control);
+ word = rd_plain (dev, offsetof(amb_mem, reset_control));
// put card into reset state
- wr_plain (dev, &mem->reset_control, word | AMB_RESET_BITS);
+ wr_plain (dev, offsetof(amb_mem, reset_control), word | AMB_RESET_BITS);
// wait a short while
udelay (10);
#if 1
// put card into known good state
- wr_plain (dev, &mem->interrupt_control, AMB_DOORBELL_BITS);
+ wr_plain (dev, offsetof(amb_mem, interrupt_control), AMB_DOORBELL_BITS);
// clear all interrupts just in case
- wr_plain (dev, &mem->interrupt, -1);
+ wr_plain (dev, offsetof(amb_mem, interrupt), -1);
#endif
// clear self-test done flag
- wr_plain (dev, &mem->mb.loader.ready, 0);
+ wr_plain (dev, offsetof(amb_mem, mb.loader.ready), 0);
// take card out of reset state
- wr_plain (dev, &mem->reset_control, word &~ AMB_RESET_BITS);
+ wr_plain (dev, offsetof(amb_mem, reset_control), word &~ AMB_RESET_BITS);
if (diags) {
unsigned long timeout;
@@ -2119,7 +2119,7 @@ static int amb_reset (amb_dev * dev, int diags) {
timeout = schedule_timeout (timeout);
// half second time-out
timeout = HZ/2;
- while (!rd_plain (dev, &mem->mb.loader.ready))
+ while (!rd_plain (dev, offsetof(amb_mem, mb.loader.ready)))
if (timeout) {
timeout = schedule_timeout (timeout);
} else {
@@ -2129,7 +2129,7 @@ static int amb_reset (amb_dev * dev, int diags) {
// get results of self-test
// XXX double check byte-order
- word = rd_mem (dev, &mem->mb.loader.result);
+ word = rd_mem (dev, offsetof(amb_mem, mb.loader.result));
if (word & SELF_TEST_FAILURE) {
void sf (const char * msg) {
PRINTK (KERN_ERR, "self-test failed: %s", msg);
@@ -2235,7 +2235,7 @@ static int __init amb_talk (amb_dev * dev) {
#endif
// pass the structure
- wr_mem (dev, &mem->doorbell, virt_to_bus (&a));
+ wr_mem (dev, offsetof(amb_mem, doorbell), virt_to_bus (&a));
// 2.2 second wait (must not touch doorbell during 2 second DMA test)
timeout = HZ*22/10;
@@ -2243,7 +2243,7 @@ static int __init amb_talk (amb_dev * dev) {
timeout = schedule_timeout (timeout);
// give the adapter another half second?
timeout = HZ/2;
- while (rd_plain (dev, &mem->doorbell))
+ while (rd_plain (dev, offsetof(amb_mem, doorbell)))
if (timeout) {
timeout = schedule_timeout (timeout);
} else {
@@ -2318,10 +2318,10 @@ static int __init amb_init (amb_dev * dev) {
u32 mapreg;
blb = virt_to_bus (&lb);
// the kernel stack had better not ever cross a 1Gb boundary!
- mapreg = rd_plain (dev, &mem->stuff[10]);
+ mapreg = rd_plain (dev, offsetof(amb_mem, stuff[10]));
mapreg &= ~onegigmask;
mapreg |= blb & onegigmask;
- wr_plain (dev, &mem->stuff[10], mapreg);
+ wr_plain (dev, offsetof(amb_mem, stuff[10]), mapreg);
return;
}
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index 64c25420e..5e96bf9c9 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -330,14 +330,20 @@ static int atmtcp_create(int itf,int persist,struct atm_dev **result)
struct atmtcp_dev_data *dev_data;
struct atm_dev *dev;
+ MOD_INC_USE_COUNT;
+
dev_data = kmalloc(sizeof(*dev_data),GFP_KERNEL);
- if (!dev_data) return -ENOMEM;
+ if (!dev_data) {
+ MOD_DEC_USE_COUNT;
+ return -ENOMEM;
+ }
+
dev = atm_dev_register(DEV_LABEL,&atmtcp_v_dev_ops,itf,NULL);
if (!dev) {
kfree(dev_data);
+ MOD_DEC_USE_COUNT;
return itf == -1 ? -ENOMEM : -EBUSY;
}
- MOD_INC_USE_COUNT;
dev->ci_range.vpi_bits = MAX_VPI_BITS;
dev->ci_range.vci_bits = MAX_VCI_BITS;
PRIV(dev) = dev_data;
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index c4d525470..5a2ba1521 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1711,7 +1711,7 @@ static int __devinit eni_do_init(struct atm_dev *dev)
dev->link_rate = ATM_OC3_PCR;
eni_dev = ENI_DEV(dev);
pci_dev = eni_dev->pci_dev;
- real_base = pci_dev->resource[0].start;
+ real_base = pci_resource_start(pci_dev, 0);
eni_dev->irq = pci_dev->irq;
error = pci_read_config_byte(pci_dev,PCI_REVISION_ID,&revision);
if (error) {
@@ -2246,8 +2246,16 @@ static int __devinit eni_init_one(struct pci_dev *pci_dev,
int error = -ENOMEM;
DPRINTK("eni_init_one\n");
+
+ MOD_INC_USE_COUNT; /* @@@ we don't support unloading yet */
+
+ if (pci_enable_device(pci_dev)) {
+ error = -EIO;
+ goto out0;
+ }
+
eni_dev = (struct eni_dev *) kmalloc(sizeof(struct eni_dev),GFP_KERNEL);
- if (!eni_dev) return -ENOMEM;
+ if (!eni_dev) goto out0;
if (!cpu_zeroes) {
cpu_zeroes = pci_alloc_consistent(pci_dev,ENI_ZEROES_SIZE,
&zeroes);
@@ -2265,7 +2273,6 @@ static int __devinit eni_init_one(struct pci_dev *pci_dev,
if (error) goto out3;
eni_dev->more = eni_boards;
eni_boards = dev;
- MOD_INC_USE_COUNT; /* @@@ we don't support unloading yet */
return 0;
out3:
atm_dev_deregister(dev);
@@ -2274,6 +2281,8 @@ out2:
cpu_zeroes = NULL;
out1:
kfree(eni_dev);
+out0:
+ MOD_DEC_USE_COUNT; /* @@@ we don't support unloading yet */
return error;
}
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 6bee2f68d..82b2cc510 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -1409,6 +1409,8 @@ fore200e_open(struct atm_vcc *vcc, short vpi, int vci)
struct fore200e* fore200e = FORE200E_DEV(vcc->dev);
struct fore200e_vcc* fore200e_vcc;
+ MOD_INC_USE_COUNT;
+
/* find a free VPI/VCI */
fore200e_walk_vccs(vcc, &vpi, &vci);
@@ -1416,8 +1418,10 @@ fore200e_open(struct atm_vcc *vcc, short vpi, int vci)
vcc->vci = vci;
/* ressource checking only? */
- if (vci == ATM_VCI_UNSPEC || vpi == ATM_VPI_UNSPEC)
+ if (vci == ATM_VCI_UNSPEC || vpi == ATM_VPI_UNSPEC) {
+ MOD_DEC_USE_COUNT;
return 0;
+ }
set_bit(ATM_VF_ADDR, &vcc->flags);
vcc->itf = vcc->dev->number;
@@ -1435,6 +1439,7 @@ fore200e_open(struct atm_vcc *vcc, short vpi, int vci)
down(&fore200e->rate_sf);
if (fore200e->available_cell_rate < vcc->qos.txtp.max_pcr) {
up(&fore200e->rate_sf);
+ MOD_DEC_USE_COUNT;
return -EAGAIN;
}
/* reserving the pseudo-CBR bandwidth at this point grants us
@@ -1451,6 +1456,7 @@ fore200e_open(struct atm_vcc *vcc, short vpi, int vci)
down(&fore200e->rate_sf);
fore200e->available_cell_rate += vcc->qos.txtp.max_pcr;
up(&fore200e->rate_sf);
+ MOD_DEC_USE_COUNT;
return -ENOMEM;
}
@@ -1461,13 +1467,10 @@ fore200e_open(struct atm_vcc *vcc, short vpi, int vci)
down(&fore200e->rate_sf);
fore200e->available_cell_rate += vcc->qos.txtp.max_pcr;
up(&fore200e->rate_sf);
+ MOD_DEC_USE_COUNT;
return -EBUSY;
}
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif
-
/* compute rate control parameters */
if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) {
@@ -2598,6 +2601,10 @@ fore200e_detect(void)
printk(FORE200E "FORE Systems 200E-series driver - version " FORE200E_VERSION "\n");
+#if 0 /* XXX uncomment this to forbid module unloading */
+ MOD_INC_USE_COUNT;
+#endif
+
/* for each configured bus interface */
for (link = 0, bus = fore200e_bus; bus->model_name; bus++) {
@@ -2624,10 +2631,8 @@ fore200e_detect(void)
}
#if 0 /* XXX uncomment this to forbid module unloading */
-#ifdef MODULE
- if (link > 0)
- MOD_INC_USE_COUNT;
-#endif
+ if (link <= 0)
+ MOD_DEC_USE_COUNT;
#endif
return link;
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 31503ed1e..48ba84369 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -334,9 +334,7 @@ static const struct atmphy_ops idt77105_ops = {
int __init idt77105_init(struct atm_dev *dev)
{
-#ifdef MODULE
MOD_INC_USE_COUNT;
-#endif /* MODULE */
dev->phy = &idt77105_ops;
return 0;
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 4882bfe19..c92345f00 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2278,7 +2278,7 @@ __initfunc(static int ia_init(struct atm_dev *dev))
#endif
{
IADEV *iadev;
- unsigned int real_base, base;
+ unsigned long real_base, base;
unsigned short command;
unsigned char revision;
int error, i;
@@ -2292,12 +2292,10 @@ __initfunc(static int ia_init(struct atm_dev *dev))
dev->ci_range.vci_bits = NR_VCI_LD;
iadev = INPH_IA_DEV(dev);
+ real_base = pci_resource_start (iadev->pci, 0);
+ iadev->irq = iadev->pci->irq;
if ((error = pci_read_config_word(iadev->pci, PCI_COMMAND,&command))
- || (error = pci_read_config_dword(iadev->pci,
- PCI_BASE_ADDRESS_0,&real_base))
- || (error = pci_read_config_byte(iadev->pci,
- PCI_INTERRUPT_LINE,&iadev->irq))
|| (error = pci_read_config_byte(iadev->pci,
PCI_REVISION_ID,&revision)))
{
@@ -2310,26 +2308,8 @@ __initfunc(static int ia_init(struct atm_dev *dev))
/* find mapping size of board */
- /* write all 1's into the base address register.
- read the register whic returns us 0's in the don't care bits.
- size is calculated as ~(don't cre bits) + 1 */
-
- if (pci_write_config_dword(iadev->pci,
- PCI_BASE_ADDRESS_0, 0xffffffff)!=PCIBIOS_SUCCESSFUL)
- {
- printk(DEV_LABEL "(itf %d): init error 0x%x\n",dev->number,
- error);
- return -EINVAL;
- }
- if(pci_read_config_dword(iadev->pci, PCI_BASE_ADDRESS_0,
- &(iadev->pci_map_size)) !=PCIBIOS_SUCCESSFUL)
- {
- printk(DEV_LABEL "(itf %d): init error 0x%x\n",dev->number,
- error);
- return -EINVAL;
- }
- iadev->pci_map_size &= PCI_BASE_ADDRESS_MEM_MASK;
- iadev->pci_map_size = ~iadev->pci_map_size + 1;
+ iadev->pci_map_size = pci_resource_len(iadev->pci, 0);
+
if (iadev->pci_map_size == 0x100000){
iadev->num_vc = 4096;
dev->ci_range.vci_bits = NR_VCI_4K_LD;
@@ -2344,25 +2324,10 @@ __initfunc(static int ia_init(struct atm_dev *dev))
return -EINVAL;
}
IF_INIT(printk (DEV_LABEL "map size: %i\n", iadev->pci_map_size);)
- if(pci_write_config_dword(iadev->pci, PCI_BASE_ADDRESS_0,
- real_base)!=PCIBIOS_SUCCESSFUL)
- {
- printk(DEV_LABEL "(itf %d): init error 0x%x\n",dev->number,
- error);
- return -EINVAL;
- }
- /* strip flags (last 4 bits ) ---> mask with 0xfffffff0 */
- real_base &= MEM_VALID;
- /* enabling the responses in memory space */
- command |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
- if ((error = pci_write_config_word(iadev->pci,
- PCI_COMMAND, command)))
- {
- printk(DEV_LABEL "(itf %d): can't enable memory (0x%x)\n",
- dev->number,error);
- return -EIO;
- }
+ /* enable bus mastering */
+ pci_set_master(iadev->pci);
+
/*
* Delay at least 1us before doing any mem accesses (how 'bout 10?)
*/
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 20d7c0766..dd39f4ccf 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -472,7 +472,7 @@ static int ns_init_card(int i, struct pci_dev *pcidev)
card->index = i;
card->atmdev = NULL;
card->pcidev = pcidev;
- card->membase = pcidev->resource[1].start;
+ card->membase = pci_resource_start(pcidev, 1);
#ifdef __powerpc__
/* Compensate for different memory map between host CPU and PCI bus.
Shouldn't we use a macro for this? */
@@ -893,10 +893,9 @@ static int ns_init_card(int i, struct pci_dev *pcidev)
#ifdef CONFIG_ATM_NICSTAR_USE_SUNI
if (card->max_pcr == ATM_OC3_PCR) {
suni_init(card->atmdev);
-#ifdef MODULE
+
MOD_INC_USE_COUNT;
/* Can't remove the nicstar driver or the suni driver would oops */
-#endif /* MODULE */
}
#endif /* CONFIG_ATM_NICSTAR_USE_SUNI */
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 576f51aad..a2b9ff169 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -1385,7 +1385,7 @@ static int __init zatm_init(struct atm_dev *dev)
DPRINTK(">zatm_init\n");
zatm_dev = ZATM_DEV(dev);
pci_dev = zatm_dev->pci_dev;
- zatm_dev->base = pci_dev->resource[0].start;
+ zatm_dev->base = pci_resource_start(pci_dev, 0);
zatm_dev->irq = pci_dev->irq;
if ((error = pci_read_config_word(pci_dev,PCI_COMMAND,&command)) ||
(error = pci_read_config_byte(pci_dev,PCI_REVISION_ID,&revision))) {