Commit 09f5156c authored by Chas Williams's avatar Chas Williams Committed by Stephen Hemminger

[ATM]: Clean up the code making use of sti/cli (from vinay-rc@naturesoft.net)

parent f75865ce
...@@ -310,10 +310,11 @@ static u32 __initdata ucode_data[] = { ...@@ -310,10 +310,11 @@ static u32 __initdata ucode_data[] = {
0xdeadbeef 0xdeadbeef
}; };
static void do_housekeeping (unsigned long arg);
/********** globals **********/ /********** globals **********/
static amb_dev * amb_devs = NULL; static amb_dev * amb_devs = NULL;
static struct timer_list housekeeping; static struct timer_list housekeeping = TIMER_INITIALIZER(do_housekeeping, 0, 1);
static unsigned short debug = 0; static unsigned short debug = 0;
static unsigned int cmds = 8; static unsigned int cmds = 8;
...@@ -937,63 +938,6 @@ static irqreturn_t interrupt_handler(int irq, void *dev_id, ...@@ -937,63 +938,6 @@ static irqreturn_t interrupt_handler(int irq, void *dev_id,
return IRQ_HANDLED; return IRQ_HANDLED;
} }
/********** don't panic... yeah, right **********/
#ifdef DEBUG_AMBASSADOR
static void dont_panic (amb_dev * dev) {
amb_cq * cq = &dev->cq;
volatile amb_cq_ptrs * ptrs = &cq->ptrs;
amb_txq * txq;
amb_rxq * rxq;
command * cmd;
tx_in * tx;
tx_simple * tx_descr;
unsigned char pool;
rx_in * rx;
unsigned long flags;
save_flags (flags);
cli();
PRINTK (KERN_INFO, "don't panic - putting adapter into reset");
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)
cmd->request = cpu_to_be32 (SRB_COMPLETE);
PRINTK (KERN_INFO, "completing all TXs");
txq = &dev->txq;
tx = txq->in.ptr;
while (txq->pending--) {
if (tx == txq->in.start)
tx = txq->in.limit;
--tx;
tx_descr = bus_to_virt (be32_to_cpu (tx->tx_descr_addr));
amb_kfree_skb (tx_descr->skb);
kfree (tx_descr);
}
PRINTK (KERN_INFO, "freeing all RX buffers");
for (pool = 0; pool < NUM_RX_POOLS; ++pool) {
rxq = &dev->rxq[pool];
rx = rxq->in.ptr;
while (rxq->pending--) {
if (rx == rxq->in.start)
rx = rxq->in.limit;
--rx;
dev_kfree_skb_any (bus_to_virt (rx->handle));
}
}
PRINTK (KERN_INFO, "don't panic over - close all VCs and rmmod");
set_bit (dead, &dev->flags);
restore_flags (flags);
return;
}
#endif
/********** make rate (not quite as much fun as Horizon) **********/ /********** make rate (not quite as much fun as Horizon) **********/
static unsigned int make_rate (unsigned int rate, rounding r, static unsigned int make_rate (unsigned int rate, rounding r,
...@@ -1420,32 +1364,6 @@ static void amb_close (struct atm_vcc * atm_vcc) { ...@@ -1420,32 +1364,6 @@ static void amb_close (struct atm_vcc * atm_vcc) {
return; return;
} }
/********** DebugIoctl **********/
#if 0
static int amb_ioctl (struct atm_dev * dev, unsigned int cmd, void * arg) {
unsigned short newdebug;
if (cmd == AMB_SETDEBUG) {
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (copy_from_user (&newdebug, arg, sizeof(newdebug))) {
// moan
return -EFAULT;
} else {
debug = newdebug;
return 0;
}
} else if (cmd == AMB_DONTPANIC) {
if (!capable(CAP_NET_ADMIN))
return -EPERM;
dont_panic (dev);
} else {
// moan
return -ENOIOCTLCMD;
}
}
#endif
/********** Set socket options for a VC **********/ /********** Set socket options for a VC **********/
// int amb_getsockopt (struct atm_vcc * atm_vcc, int level, int optname, void * optval, int optlen); // int amb_getsockopt (struct atm_vcc * atm_vcc, int level, int optname, void * optval, int optlen);
...@@ -1524,33 +1442,6 @@ static int amb_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) { ...@@ -1524,33 +1442,6 @@ static int amb_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) {
tx.tx_descr_length = cpu_to_be16 (sizeof(tx_frag)+sizeof(tx_frag_end)); tx.tx_descr_length = cpu_to_be16 (sizeof(tx_frag)+sizeof(tx_frag_end));
tx.tx_descr_addr = cpu_to_be32 (virt_to_bus (&tx_descr->tx_frag)); tx.tx_descr_addr = cpu_to_be32 (virt_to_bus (&tx_descr->tx_frag));
#ifdef DEBUG_AMBASSADOR
/* wey-hey! */
if (vc == 1023) {
unsigned int i;
unsigned short d = 0;
char * s = skb->data;
switch (*s++) {
case 'D': {
for (i = 0; i < 4; ++i) {
d = (d<<4) | ((*s <= '9') ? (*s - '0') : (*s - 'a' + 10));
++s;
}
PRINTK (KERN_INFO, "debug bitmap is now %hx", debug = d);
break;
}
case 'R': {
if (*s++ == 'e' && *s++ == 's' && *s++ == 'e' && *s++ == 't')
dont_panic (dev);
break;
}
default: {
break;
}
}
}
#endif
while (tx_give (dev, &tx)) while (tx_give (dev, &tx))
schedule(); schedule();
return 0; return 0;
...@@ -1671,13 +1562,6 @@ static const struct atmdev_ops amb_ops = { ...@@ -1671,13 +1562,6 @@ static const struct atmdev_ops amb_ops = {
}; };
/********** housekeeping **********/ /********** housekeeping **********/
static inline void set_timer (struct timer_list * timer, unsigned long delay) {
timer->expires = jiffies + delay;
add_timer (timer);
return;
}
static void do_housekeeping (unsigned long arg) { static void do_housekeeping (unsigned long arg) {
amb_dev * dev = amb_devs; amb_dev * dev = amb_devs;
// data is set to zero at module unload // data is set to zero at module unload
...@@ -1693,7 +1577,7 @@ static void do_housekeeping (unsigned long arg) { ...@@ -1693,7 +1577,7 @@ static void do_housekeeping (unsigned long arg) {
dev = dev->prev; dev = dev->prev;
} }
set_timer (&housekeeping, 10*HZ); mod_timer(&housekeeping, jiffies + 10*HZ);
} }
return; return;
...@@ -2579,11 +2463,7 @@ static int __init amb_module_init (void) { ...@@ -2579,11 +2463,7 @@ static int __init amb_module_init (void) {
devs = amb_probe(); devs = amb_probe();
if (devs) { if (devs) {
init_timer (&housekeeping); mod_timer (&housekeeping, jiffies);
housekeeping.function = do_housekeeping;
// paranoia
housekeeping.data = 1;
set_timer (&housekeeping, 0);
} else { } else {
PRINTK (KERN_INFO, "no (usable) adapters found"); PRINTK (KERN_INFO, "no (usable) adapters found");
} }
......
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