Commit 9e3083c1 authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

[ATM]: Convert cli() to spinlock in ZATM driver.

parent ba79a0ce
...@@ -27,6 +27,7 @@ struct uPD98402_priv { ...@@ -27,6 +27,7 @@ struct uPD98402_priv {
struct k_sonet_stats sonet_stats;/* link diagnostics */ struct k_sonet_stats sonet_stats;/* link diagnostics */
unsigned char framing; /* SONET/SDH framing */ unsigned char framing; /* SONET/SDH framing */
int loop_mode; /* loopback mode */ int loop_mode; /* loopback mode */
spinlock_t lock;
}; };
...@@ -71,14 +72,13 @@ static int set_framing(struct atm_dev *dev,unsigned char framing) ...@@ -71,14 +72,13 @@ static int set_framing(struct atm_dev *dev,unsigned char framing)
default: default:
return -EINVAL; return -EINVAL;
} }
save_flags(flags); spin_lock_irqsave(&PRIV(dev)->lock, flags);
cli();
PUT(set[0],C11T); PUT(set[0],C11T);
PUT(set[1],C12T); PUT(set[1],C12T);
PUT(set[2],C13T); PUT(set[2],C13T);
PUT((GET(MDR) & ~uPD98402_MDR_SS_MASK) | (set[3] << PUT((GET(MDR) & ~uPD98402_MDR_SS_MASK) | (set[3] <<
uPD98402_MDR_SS_SHIFT),MDR); uPD98402_MDR_SS_SHIFT),MDR);
restore_flags(flags); spin_unlock_irqrestore(&PRIV(dev)->lock, flags);
return 0; return 0;
} }
...@@ -88,12 +88,11 @@ static int get_sense(struct atm_dev *dev,u8 *arg) ...@@ -88,12 +88,11 @@ static int get_sense(struct atm_dev *dev,u8 *arg)
unsigned long flags; unsigned long flags;
unsigned char s[3]; unsigned char s[3];
save_flags(flags); spin_lock_irqsave(&PRIV(dev)->lock, flags);
cli();
s[0] = GET(C11R); s[0] = GET(C11R);
s[1] = GET(C12R); s[1] = GET(C12R);
s[2] = GET(C13R); s[2] = GET(C13R);
restore_flags(flags); spin_unlock_irqrestore(&PRIV(dev)->lock, flags);
return (put_user(s[0], arg) || put_user(s[1], arg+1) || return (put_user(s[0], arg) || put_user(s[1], arg+1) ||
put_user(s[2], arg+2) || put_user(0xff, arg+3) || put_user(s[2], arg+2) || put_user(0xff, arg+3) ||
put_user(0xff, arg+4) || put_user(0xff, arg+5)) ? -EFAULT : 0; put_user(0xff, arg+4) || put_user(0xff, arg+5)) ? -EFAULT : 0;
...@@ -214,6 +213,7 @@ static int uPD98402_start(struct atm_dev *dev) ...@@ -214,6 +213,7 @@ static int uPD98402_start(struct atm_dev *dev)
DPRINTK("phy_start\n"); DPRINTK("phy_start\n");
if (!(PRIV(dev) = kmalloc(sizeof(struct uPD98402_priv),GFP_KERNEL))) if (!(PRIV(dev) = kmalloc(sizeof(struct uPD98402_priv),GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
spin_lock_init(&PRIV(dev)->lock);
memset(&PRIV(dev)->sonet_stats,0,sizeof(struct k_sonet_stats)); memset(&PRIV(dev)->sonet_stats,0,sizeof(struct k_sonet_stats));
(void) GET(PCR); /* clear performance events */ (void) GET(PCR); /* clear performance events */
PUT(uPD98402_PFM_FJ,PCMR); /* ignore frequency adj */ PUT(uPD98402_PFM_FJ,PCMR); /* ignore frequency adj */
......
This diff is collapsed.
...@@ -85,6 +85,7 @@ struct zatm_dev { ...@@ -85,6 +85,7 @@ struct zatm_dev {
unsigned char irq; /* IRQ */ unsigned char irq; /* IRQ */
unsigned int base; /* IO base address */ unsigned int base; /* IO base address */
struct pci_dev *pci_dev; /* PCI stuff */ struct pci_dev *pci_dev; /* PCI stuff */
spinlock_t lock;
}; };
......
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