static struct sixpack *sp_get(struct tty_struct *tty)
{
- unsigned long flags;
struct sixpack *sp;
- read_lock_irqsave(&disc_data_lock, flags);
+ read_lock(&disc_data_lock);
sp = tty->disc_data;
if (sp)
atomic_inc(&sp->refcnt);
- read_unlock_irqrestore(&disc_data_lock, flags);
+ read_unlock(&disc_data_lock);
return sp;
}
*/
static void sixpack_close(struct tty_struct *tty)
{
- unsigned long flags;
struct sixpack *sp;
- write_lock_irqsave(&disc_data_lock, flags);
+ write_lock(&disc_data_lock);
sp = tty->disc_data;
tty->disc_data = NULL;
- write_unlock_irqrestore(&disc_data_lock, flags);
+ write_unlock(&disc_data_lock);
if (!sp)
return;
/* Send one completely decapsulated AX.25 packet to the AX.25 layer. */
static void ax_bump(struct mkiss *ax)
{
- unsigned long flags;
struct sk_buff *skb;
int count;
- spin_lock_irqsave(&ax->buflock, flags);
+ spin_lock_bh(&ax->buflock);
if (ax->rbuff[0] > 0x0f) {
if (ax->rbuff[0] & 0x80) {
if (check_crc_16(ax->rbuff, ax->rcount) < 0) {
ax->dev->stats.rx_errors++;
- spin_unlock_irqrestore(&ax->buflock, flags);
+ spin_unlock_bh(&ax->buflock);
return;
}
} else if (ax->rbuff[0] & 0x20) {
if (check_crc_flex(ax->rbuff, ax->rcount) < 0) {
ax->dev->stats.rx_errors++;
- spin_unlock_irqrestore(&ax->buflock, flags);
+ spin_unlock_bh(&ax->buflock);
return;
}
if (ax->crcmode != CRC_MODE_FLEX && ax->crcauto) {
printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
ax->dev->name);
ax->dev->stats.rx_dropped++;
- spin_unlock_irqrestore(&ax->buflock, flags);
+ spin_unlock_bh(&ax->buflock);
return;
}
netif_rx(skb);
ax->dev->stats.rx_packets++;
ax->dev->stats.rx_bytes += count;
- spin_unlock_irqrestore(&ax->buflock, flags);
+ spin_unlock_bh(&ax->buflock);
}
static void kiss_unesc(struct mkiss *ax, unsigned char s)
{
- unsigned long flags;
-
switch (s) {
case END:
/* drop keeptest bit = VSV */
break;
}
- spin_lock_irqsave(&ax->buflock, flags);
+ spin_lock_bh(&ax->buflock);
if (!test_bit(AXF_ERROR, &ax->flags)) {
if (ax->rcount < ax->buffsize) {
ax->rbuff[ax->rcount++] = s;
- spin_unlock_irqrestore(&ax->buflock, flags);
+ spin_unlock_bh(&ax->buflock);
return;
}
ax->dev->stats.rx_over_errors++;
set_bit(AXF_ERROR, &ax->flags);
}
- spin_unlock_irqrestore(&ax->buflock, flags);
+ spin_unlock_bh(&ax->buflock);
}
static int ax_set_mac_address(struct net_device *dev, void *addr)
{
struct net_device *dev = ax->dev;
unsigned char *xbuff, *rbuff, *oxbuff, *orbuff;
- unsigned long flags;
int len;
len = dev->mtu * 2;
return;
}
- spin_lock_irqsave(&ax->buflock, flags);
+ spin_lock_bh(&ax->buflock);
oxbuff = ax->xbuff;
ax->xbuff = xbuff;
ax->mtu = dev->mtu + 73;
ax->buffsize = len;
- spin_unlock_irqrestore(&ax->buflock, flags);
+ spin_unlock_bh(&ax->buflock);
kfree(oxbuff);
kfree(orbuff);
static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
{
struct mkiss *ax = netdev_priv(dev);
- unsigned long flags;
unsigned char *p;
int actual, count;
p = icp;
- spin_lock_irqsave(&ax->buflock, flags);
+ spin_lock_bh(&ax->buflock);
if ((*p & 0x0f) != 0) {
/* Configuration Command (kissparms(1).
* Protocol spec says: never append CRC.
ax->crcauto = (cmd ? 0 : 1);
printk(KERN_INFO "mkiss: %s: crc mode %s %d\n", ax->dev->name, (len) ? "set to" : "is", cmd);
}
- spin_unlock_irqrestore(&ax->buflock, flags);
+ spin_unlock_bh(&ax->buflock);
netif_start_queue(dev);
return;
count = kiss_esc(p, (unsigned char *)ax->xbuff, len);
}
}
- spin_unlock_irqrestore(&ax->buflock, flags);
+ spin_unlock_bh(&ax->buflock);
set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags);
actual = ax->tty->ops->write(ax->tty, ax->xbuff, count);
static struct mkiss *mkiss_get(struct tty_struct *tty)
{
- unsigned long flags;
struct mkiss *ax;
- read_lock_irqsave(&disc_data_lock, flags);
+ read_lock(&disc_data_lock);
ax = tty->disc_data;
if (ax)
atomic_inc(&ax->refcnt);
- read_unlock_irqrestore(&disc_data_lock, flags);
+ read_unlock(&disc_data_lock);
return ax;
}
static void mkiss_close(struct tty_struct *tty)
{
- unsigned long flags;
struct mkiss *ax;
- write_lock_irqsave(&disc_data_lock, flags);
+ write_lock(&disc_data_lock);
ax = tty->disc_data;
tty->disc_data = NULL;
- write_unlock_irqrestore(&disc_data_lock, flags);
+ write_unlock(&disc_data_lock);
if (!ax)
return;
static struct asyncppp *ap_get(struct tty_struct *tty)
{
- unsigned long flags;
struct asyncppp *ap;
- read_lock_irqsave(&disc_data_lock, flags);
+ read_lock(&disc_data_lock);
ap = tty->disc_data;
if (ap != NULL)
atomic_inc(&ap->refcnt);
- read_unlock_irqrestore(&disc_data_lock, flags);
-
+ read_unlock(&disc_data_lock);
return ap;
}
static void
ppp_asynctty_close(struct tty_struct *tty)
{
- unsigned long flags;
struct asyncppp *ap;
- write_lock_irqsave(&disc_data_lock, flags);
+ write_lock_irq(&disc_data_lock);
ap = tty->disc_data;
tty->disc_data = NULL;
- write_unlock_irqrestore(&disc_data_lock, flags);
+ write_unlock_irq(&disc_data_lock);
if (!ap)
return;
static struct syncppp *sp_get(struct tty_struct *tty)
{
- unsigned long flags;
struct syncppp *ap;
- read_lock_irqsave(&disc_data_lock, flags);
+ read_lock(&disc_data_lock);
ap = tty->disc_data;
if (ap != NULL)
atomic_inc(&ap->refcnt);
- read_unlock_irqrestore(&disc_data_lock, flags);
-
+ read_unlock(&disc_data_lock);
return ap;
}
static void
ppp_sync_close(struct tty_struct *tty)
{
- unsigned long flags;
struct syncppp *ap;
- write_lock_irqsave(&disc_data_lock, flags);
+ write_lock_irq(&disc_data_lock);
ap = tty->disc_data;
tty->disc_data = NULL;
- write_unlock_irqrestore(&disc_data_lock, flags);
+ write_unlock_irq(&disc_data_lock);
if (!ap)
return;
unsigned char *orbuff = strip_info->rx_buff;
unsigned char *osbuff = strip_info->sx_buff;
unsigned char *otbuff = strip_info->tx_buff;
- unsigned long flags;
if (new_mtu > MAX_SEND_MTU) {
printk(KERN_ERR
return -EINVAL;
}
- spin_lock_irqsave(&strip_lock, flags);
+ spin_lock_bh(&strip_lock);
if (!allocate_buffers(strip_info, new_mtu)) {
printk(KERN_ERR "%s: unable to grow strip buffers, MTU change cancelled.\n",
strip_info->dev->name);
- spin_unlock_irqrestore(&strip_lock, flags);
+ spin_unlock_bh(&strip_lock);
return -ENOMEM;
}
}
}
strip_info->tx_head = strip_info->tx_buff;
- spin_unlock_irqrestore(&strip_lock, flags);
+ spin_unlock_bh(&strip_lock);
printk(KERN_NOTICE "%s: strip MTU changed fom %d to %d.\n",
strip_info->dev->name, old_mtu, strip_info->mtu);
const MetricomNodeTable * table,
const char *title)
{
- unsigned long flags;
+ /* We wrap this in a do/while loop, so if the table changes */
+ /* while we're reading it, we just go around and try again. */
struct timeval t;
- /*
- * We wrap this in a do/while loop, so if the table changes
- * while we're reading it, we just go around and try again.
- */
do {
int i;
t = table->timestamp;
for (i = 0; i < table->num_nodes; i++) {
MetricomNode node;
- spin_lock_irqsave(&strip_lock, flags);
+ spin_lock_bh(&strip_lock);
node = table->node[i];
- spin_unlock_irqrestore(&strip_lock, flags);
+ spin_unlock_bh(&strip_lock);
seq_printf(seq, " %s\n", node.c);
}
} while (table->timestamp.tv_sec != t.tv_sec
static int strip_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct strip *strip_info = netdev_priv(dev);
- unsigned long flags;
if (!netif_running(dev)) {
printk(KERN_ERR "%s: xmit call when iface is down\n",
strip_info->dev->name, sx_pps_count / 8);
}
- spin_lock_irqsave(&strip_lock, flags);
+ spin_lock_bh(&strip_lock);
strip_send(strip_info, skb);
- spin_unlock_irqrestore(&strip_lock, flags);
+ spin_unlock_bh(&strip_lock);
if (skb)
dev_kfree_skb(skb);
{
struct strip *strip_info = tty->disc_data;
const unsigned char *end = cp + count;
- unsigned long flags;
if (!strip_info || strip_info->magic != STRIP_MAGIC
|| !netif_running(strip_info->dev))
return;
- spin_lock_irqsave(&strip_lock, flags);
+ spin_lock_bh(&strip_lock);
#if 0
{
struct timeval tv;
}
cp++;
}
- spin_unlock_irqrestore(&strip_lock, flags);
+ spin_unlock_bh(&strip_lock);
}
static void strip_free(struct strip *strip_info)
{
- unsigned long flags;
-
- spin_lock_irqsave(&strip_lock, flags);
+ spin_lock_bh(&strip_lock);
list_del_rcu(&strip_info->list);
- spin_unlock_irqrestore(&strip_lock, flags);
+ spin_unlock_bh(&strip_lock);
strip_info->magic = 0;
static struct strip *strip_alloc(void)
{
struct list_head *n;
- unsigned long flags;
struct net_device *dev;
struct strip *strip_info;
strip_info->idle_timer.function = strip_IdleTask;
- spin_lock_irqsave(&strip_lock, flags);
+ spin_lock_bh(&strip_lock);
rescan:
/*
* Search the list to find where to put our new entry
sprintf(dev->name, "st%ld", dev->base_addr);
list_add_tail_rcu(&strip_info->list, &strip_list);
- spin_unlock_irqrestore(&strip_lock, flags);
+ spin_unlock_bh(&strip_lock);
return strip_info;
}