diff options
author | Mark Asselstine <mark.asselstine@windriver.com> | 2008-04-19 21:10:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-19 21:10:46 -0400 |
commit | 36ef408061da9e012375547d69b27cc1f537b044 (patch) | |
tree | 9bf351fd880d79c1dd53590ba7494de003a94dff /drivers/atm/nicstar.c | |
parent | 344234de54891ed15bf8127e4640ff9238076d6c (diff) |
atm nicstar: Removal of debug code containing deprecated calls to cli()/sti()
Code within NS_DEBUG_SPINLOCKS contained deprecated cli()/sti()
function calls. NS_DEBUG_SPINLOCKS and the associated code seems to
be of little use these days so the strategy of removing this code
rather then updating it to use spinlocks has been taken.
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm/nicstar.c')
-rw-r--r-- | drivers/atm/nicstar.c | 117 |
1 files changed, 19 insertions, 98 deletions
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c index 0c205b000e8b..38c769f8d2b7 100644 --- a/drivers/atm/nicstar.c +++ b/drivers/atm/nicstar.c | |||
@@ -125,85 +125,6 @@ | |||
125 | #define ATM_SKB(s) (&(s)->atm) | 125 | #define ATM_SKB(s) (&(s)->atm) |
126 | #endif | 126 | #endif |
127 | 127 | ||
128 | /* Spinlock debugging stuff */ | ||
129 | #ifdef NS_DEBUG_SPINLOCKS /* See nicstar.h */ | ||
130 | #define ns_grab_int_lock(card,flags) \ | ||
131 | do { \ | ||
132 | unsigned long nsdsf, nsdsf2; \ | ||
133 | local_irq_save(flags); \ | ||
134 | save_flags(nsdsf); cli();\ | ||
135 | if (nsdsf & (1<<9)) printk ("nicstar.c: ints %sabled -> enabled.\n", \ | ||
136 | (flags)&(1<<9)?"en":"dis"); \ | ||
137 | if (spin_is_locked(&(card)->int_lock) && \ | ||
138 | (card)->cpu_int == smp_processor_id()) { \ | ||
139 | printk("nicstar.c: line %d (cpu %d) int_lock already locked at line %d (cpu %d)\n", \ | ||
140 | __LINE__, smp_processor_id(), (card)->has_int_lock, \ | ||
141 | (card)->cpu_int); \ | ||
142 | printk("nicstar.c: ints were %sabled.\n", ((flags)&(1<<9)?"en":"dis")); \ | ||
143 | } \ | ||
144 | if (spin_is_locked(&(card)->res_lock) && \ | ||
145 | (card)->cpu_res == smp_processor_id()) { \ | ||
146 | printk("nicstar.c: line %d (cpu %d) res_lock locked at line %d (cpu %d)(trying int)\n", \ | ||
147 | __LINE__, smp_processor_id(), (card)->has_res_lock, \ | ||
148 | (card)->cpu_res); \ | ||
149 | printk("nicstar.c: ints were %sabled.\n", ((flags)&(1<<9)?"en":"dis")); \ | ||
150 | } \ | ||
151 | spin_lock_irq(&(card)->int_lock); \ | ||
152 | (card)->has_int_lock = __LINE__; \ | ||
153 | (card)->cpu_int = smp_processor_id(); \ | ||
154 | restore_flags(nsdsf); } while (0) | ||
155 | #define ns_grab_res_lock(card,flags) \ | ||
156 | do { \ | ||
157 | unsigned long nsdsf, nsdsf2; \ | ||
158 | local_irq_save(flags); \ | ||
159 | save_flags(nsdsf); cli();\ | ||
160 | if (nsdsf & (1<<9)) printk ("nicstar.c: ints %sabled -> enabled.\n", \ | ||
161 | (flags)&(1<<9)?"en":"dis"); \ | ||
162 | if (spin_is_locked(&(card)->res_lock) && \ | ||
163 | (card)->cpu_res == smp_processor_id()) { \ | ||
164 | printk("nicstar.c: line %d (cpu %d) res_lock already locked at line %d (cpu %d)\n", \ | ||
165 | __LINE__, smp_processor_id(), (card)->has_res_lock, \ | ||
166 | (card)->cpu_res); \ | ||
167 | printk("nicstar.c: ints were %sabled.\n", ((flags)&(1<<9)?"en":"dis")); \ | ||
168 | } \ | ||
169 | spin_lock_irq(&(card)->res_lock); \ | ||
170 | (card)->has_res_lock = __LINE__; \ | ||
171 | (card)->cpu_res = smp_processor_id(); \ | ||
172 | restore_flags(nsdsf); } while (0) | ||
173 | #define ns_grab_scq_lock(card,scq,flags) \ | ||
174 | do { \ | ||
175 | unsigned long nsdsf, nsdsf2; \ | ||
176 | local_irq_save(flags); \ | ||
177 | save_flags(nsdsf); cli();\ | ||
178 | if (nsdsf & (1<<9)) printk ("nicstar.c: ints %sabled -> enabled.\n", \ | ||
179 | (flags)&(1<<9)?"en":"dis"); \ | ||
180 | if (spin_is_locked(&(scq)->lock) && \ | ||
181 | (scq)->cpu_lock == smp_processor_id()) { \ | ||
182 | printk("nicstar.c: line %d (cpu %d) this scq_lock already locked at line %d (cpu %d)\n", \ | ||
183 | __LINE__, smp_processor_id(), (scq)->has_lock, \ | ||
184 | (scq)->cpu_lock); \ | ||
185 | printk("nicstar.c: ints were %sabled.\n", ((flags)&(1<<9)?"en":"dis")); \ | ||
186 | } \ | ||
187 | if (spin_is_locked(&(card)->res_lock) && \ | ||
188 | (card)->cpu_res == smp_processor_id()) { \ | ||
189 | printk("nicstar.c: line %d (cpu %d) res_lock locked at line %d (cpu %d)(trying scq)\n", \ | ||
190 | __LINE__, smp_processor_id(), (card)->has_res_lock, \ | ||
191 | (card)->cpu_res); \ | ||
192 | printk("nicstar.c: ints were %sabled.\n", ((flags)&(1<<9)?"en":"dis")); \ | ||
193 | } \ | ||
194 | spin_lock_irq(&(scq)->lock); \ | ||
195 | (scq)->has_lock = __LINE__; \ | ||
196 | (scq)->cpu_lock = smp_processor_id(); \ | ||
197 | restore_flags(nsdsf); } while (0) | ||
198 | #else /* !NS_DEBUG_SPINLOCKS */ | ||
199 | #define ns_grab_int_lock(card,flags) \ | ||
200 | spin_lock_irqsave(&(card)->int_lock,(flags)) | ||
201 | #define ns_grab_res_lock(card,flags) \ | ||
202 | spin_lock_irqsave(&(card)->res_lock,(flags)) | ||
203 | #define ns_grab_scq_lock(card,scq,flags) \ | ||
204 | spin_lock_irqsave(&(scq)->lock,flags) | ||
205 | #endif /* NS_DEBUG_SPINLOCKS */ | ||
206 | |||
207 | 128 | ||
208 | /* Function declarations ******************************************************/ | 129 | /* Function declarations ******************************************************/ |
209 | 130 | ||
@@ -422,7 +343,7 @@ static u32 ns_read_sram(ns_dev *card, u32 sram_address) | |||
422 | sram_address <<= 2; | 343 | sram_address <<= 2; |
423 | sram_address &= 0x0007FFFC; /* address must be dword aligned */ | 344 | sram_address &= 0x0007FFFC; /* address must be dword aligned */ |
424 | sram_address |= 0x50000000; /* SRAM read command */ | 345 | sram_address |= 0x50000000; /* SRAM read command */ |
425 | ns_grab_res_lock(card, flags); | 346 | spin_lock_irqsave(&card->res_lock, flags); |
426 | while (CMD_BUSY(card)); | 347 | while (CMD_BUSY(card)); |
427 | writel(sram_address, card->membase + CMD); | 348 | writel(sram_address, card->membase + CMD); |
428 | while (CMD_BUSY(card)); | 349 | while (CMD_BUSY(card)); |
@@ -440,7 +361,7 @@ static void ns_write_sram(ns_dev *card, u32 sram_address, u32 *value, int count) | |||
440 | count--; /* count range now is 0..3 instead of 1..4 */ | 361 | count--; /* count range now is 0..3 instead of 1..4 */ |
441 | c = count; | 362 | c = count; |
442 | c <<= 2; /* to use increments of 4 */ | 363 | c <<= 2; /* to use increments of 4 */ |
443 | ns_grab_res_lock(card, flags); | 364 | spin_lock_irqsave(&card->res_lock, flags); |
444 | while (CMD_BUSY(card)); | 365 | while (CMD_BUSY(card)); |
445 | for (i = 0; i <= c; i += 4) | 366 | for (i = 0; i <= c; i += 4) |
446 | writel(*(value++), card->membase + i); | 367 | writel(*(value++), card->membase + i); |
@@ -1166,7 +1087,7 @@ static void push_rxbufs(ns_dev *card, struct sk_buff *skb) | |||
1166 | card->lbfqc += 2; | 1087 | card->lbfqc += 2; |
1167 | } | 1088 | } |
1168 | 1089 | ||
1169 | ns_grab_res_lock(card, flags); | 1090 | spin_lock_irqsave(&card->res_lock, flags); |
1170 | 1091 | ||
1171 | while (CMD_BUSY(card)); | 1092 | while (CMD_BUSY(card)); |
1172 | writel(addr2, card->membase + DR3); | 1093 | writel(addr2, card->membase + DR3); |
@@ -1206,7 +1127,7 @@ static irqreturn_t ns_irq_handler(int irq, void *dev_id) | |||
1206 | 1127 | ||
1207 | PRINTK("nicstar%d: NICStAR generated an interrupt\n", card->index); | 1128 | PRINTK("nicstar%d: NICStAR generated an interrupt\n", card->index); |
1208 | 1129 | ||
1209 | ns_grab_int_lock(card, flags); | 1130 | spin_lock_irqsave(&card->int_lock, flags); |
1210 | 1131 | ||
1211 | stat_r = readl(card->membase + STAT); | 1132 | stat_r = readl(card->membase + STAT); |
1212 | 1133 | ||
@@ -1585,7 +1506,7 @@ static void ns_close(struct atm_vcc *vcc) | |||
1585 | unsigned long flags; | 1506 | unsigned long flags; |
1586 | 1507 | ||
1587 | addr = NS_RCT + (vcc->vpi << card->vcibits | vcc->vci) * NS_RCT_ENTRY_SIZE; | 1508 | addr = NS_RCT + (vcc->vpi << card->vcibits | vcc->vci) * NS_RCT_ENTRY_SIZE; |
1588 | ns_grab_res_lock(card, flags); | 1509 | spin_lock_irqsave(&card->res_lock, flags); |
1589 | while(CMD_BUSY(card)); | 1510 | while(CMD_BUSY(card)); |
1590 | writel(NS_CMD_CLOSE_CONNECTION | addr << 2, card->membase + CMD); | 1511 | writel(NS_CMD_CLOSE_CONNECTION | addr << 2, card->membase + CMD); |
1591 | spin_unlock_irqrestore(&card->res_lock, flags); | 1512 | spin_unlock_irqrestore(&card->res_lock, flags); |
@@ -1607,7 +1528,7 @@ static void ns_close(struct atm_vcc *vcc) | |||
1607 | NS_SKB(iovb)->iovcnt); | 1528 | NS_SKB(iovb)->iovcnt); |
1608 | NS_SKB(iovb)->iovcnt = 0; | 1529 | NS_SKB(iovb)->iovcnt = 0; |
1609 | NS_SKB(iovb)->vcc = NULL; | 1530 | NS_SKB(iovb)->vcc = NULL; |
1610 | ns_grab_int_lock(card, flags); | 1531 | spin_lock_irqsave(&card->int_lock, flags); |
1611 | recycle_iov_buf(card, iovb); | 1532 | recycle_iov_buf(card, iovb); |
1612 | spin_unlock_irqrestore(&card->int_lock, flags); | 1533 | spin_unlock_irqrestore(&card->int_lock, flags); |
1613 | vc->rx_iov = NULL; | 1534 | vc->rx_iov = NULL; |
@@ -1629,7 +1550,7 @@ static void ns_close(struct atm_vcc *vcc) | |||
1629 | 1550 | ||
1630 | for (;;) | 1551 | for (;;) |
1631 | { | 1552 | { |
1632 | ns_grab_scq_lock(card, scq, flags); | 1553 | spin_lock_irqsave(&scq->lock, flags); |
1633 | scqep = scq->next; | 1554 | scqep = scq->next; |
1634 | if (scqep == scq->base) | 1555 | if (scqep == scq->base) |
1635 | scqep = scq->last; | 1556 | scqep = scq->last; |
@@ -1691,7 +1612,7 @@ static void ns_close(struct atm_vcc *vcc) | |||
1691 | unsigned long flags; | 1612 | unsigned long flags; |
1692 | scq_info *scq = card->scq0; | 1613 | scq_info *scq = card->scq0; |
1693 | 1614 | ||
1694 | ns_grab_scq_lock(card, scq, flags); | 1615 | spin_lock_irqsave(&scq->lock, flags); |
1695 | 1616 | ||
1696 | for(i = 0; i < scq->num_entries; i++) { | 1617 | for(i = 0; i < scq->num_entries; i++) { |
1697 | if(scq->skb[i] && ATM_SKB(scq->skb[i])->vcc == vcc) { | 1618 | if(scq->skb[i] && ATM_SKB(scq->skb[i])->vcc == vcc) { |
@@ -1892,7 +1813,7 @@ static int push_scqe(ns_dev *card, vc_map *vc, scq_info *scq, ns_scqe *tbd, | |||
1892 | u32 data; | 1813 | u32 data; |
1893 | int index; | 1814 | int index; |
1894 | 1815 | ||
1895 | ns_grab_scq_lock(card, scq, flags); | 1816 | spin_lock_irqsave(&scq->lock, flags); |
1896 | while (scq->tail == scq->next) | 1817 | while (scq->tail == scq->next) |
1897 | { | 1818 | { |
1898 | if (in_interrupt()) { | 1819 | if (in_interrupt()) { |
@@ -1904,7 +1825,7 @@ static int push_scqe(ns_dev *card, vc_map *vc, scq_info *scq, ns_scqe *tbd, | |||
1904 | scq->full = 1; | 1825 | scq->full = 1; |
1905 | spin_unlock_irqrestore(&scq->lock, flags); | 1826 | spin_unlock_irqrestore(&scq->lock, flags); |
1906 | interruptible_sleep_on_timeout(&scq->scqfull_waitq, SCQFULL_TIMEOUT); | 1827 | interruptible_sleep_on_timeout(&scq->scqfull_waitq, SCQFULL_TIMEOUT); |
1907 | ns_grab_scq_lock(card, scq, flags); | 1828 | spin_lock_irqsave(&scq->lock, flags); |
1908 | 1829 | ||
1909 | if (scq->full) { | 1830 | if (scq->full) { |
1910 | spin_unlock_irqrestore(&scq->lock, flags); | 1831 | spin_unlock_irqrestore(&scq->lock, flags); |
@@ -1953,7 +1874,7 @@ static int push_scqe(ns_dev *card, vc_map *vc, scq_info *scq, ns_scqe *tbd, | |||
1953 | if (has_run++) break; | 1874 | if (has_run++) break; |
1954 | spin_unlock_irqrestore(&scq->lock, flags); | 1875 | spin_unlock_irqrestore(&scq->lock, flags); |
1955 | interruptible_sleep_on_timeout(&scq->scqfull_waitq, SCQFULL_TIMEOUT); | 1876 | interruptible_sleep_on_timeout(&scq->scqfull_waitq, SCQFULL_TIMEOUT); |
1956 | ns_grab_scq_lock(card, scq, flags); | 1877 | spin_lock_irqsave(&scq->lock, flags); |
1957 | } | 1878 | } |
1958 | 1879 | ||
1959 | if (!scq->full) | 1880 | if (!scq->full) |
@@ -2090,7 +2011,7 @@ static void drain_scq(ns_dev *card, scq_info *scq, int pos) | |||
2090 | return; | 2011 | return; |
2091 | } | 2012 | } |
2092 | 2013 | ||
2093 | ns_grab_scq_lock(card, scq, flags); | 2014 | spin_lock_irqsave(&scq->lock, flags); |
2094 | i = (int) (scq->tail - scq->base); | 2015 | i = (int) (scq->tail - scq->base); |
2095 | if (++i == scq->num_entries) | 2016 | if (++i == scq->num_entries) |
2096 | i = 0; | 2017 | i = 0; |
@@ -2898,7 +2819,7 @@ static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg) | |||
2898 | { | 2819 | { |
2899 | struct sk_buff *hb; | 2820 | struct sk_buff *hb; |
2900 | 2821 | ||
2901 | ns_grab_int_lock(card, flags); | 2822 | spin_lock_irqsave(&card->int_lock, flags); |
2902 | hb = skb_dequeue(&card->hbpool.queue); | 2823 | hb = skb_dequeue(&card->hbpool.queue); |
2903 | card->hbpool.count--; | 2824 | card->hbpool.count--; |
2904 | spin_unlock_irqrestore(&card->int_lock, flags); | 2825 | spin_unlock_irqrestore(&card->int_lock, flags); |
@@ -2917,7 +2838,7 @@ static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg) | |||
2917 | if (hb == NULL) | 2838 | if (hb == NULL) |
2918 | return -ENOMEM; | 2839 | return -ENOMEM; |
2919 | NS_SKB_CB(hb)->buf_type = BUF_NONE; | 2840 | NS_SKB_CB(hb)->buf_type = BUF_NONE; |
2920 | ns_grab_int_lock(card, flags); | 2841 | spin_lock_irqsave(&card->int_lock, flags); |
2921 | skb_queue_tail(&card->hbpool.queue, hb); | 2842 | skb_queue_tail(&card->hbpool.queue, hb); |
2922 | card->hbpool.count++; | 2843 | card->hbpool.count++; |
2923 | spin_unlock_irqrestore(&card->int_lock, flags); | 2844 | spin_unlock_irqrestore(&card->int_lock, flags); |
@@ -2929,7 +2850,7 @@ static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg) | |||
2929 | { | 2850 | { |
2930 | struct sk_buff *iovb; | 2851 | struct sk_buff *iovb; |
2931 | 2852 | ||
2932 | ns_grab_int_lock(card, flags); | 2853 | spin_lock_irqsave(&card->int_lock, flags); |
2933 | iovb = skb_dequeue(&card->iovpool.queue); | 2854 | iovb = skb_dequeue(&card->iovpool.queue); |
2934 | card->iovpool.count--; | 2855 | card->iovpool.count--; |
2935 | spin_unlock_irqrestore(&card->int_lock, flags); | 2856 | spin_unlock_irqrestore(&card->int_lock, flags); |
@@ -2948,7 +2869,7 @@ static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg) | |||
2948 | if (iovb == NULL) | 2869 | if (iovb == NULL) |
2949 | return -ENOMEM; | 2870 | return -ENOMEM; |
2950 | NS_SKB_CB(iovb)->buf_type = BUF_NONE; | 2871 | NS_SKB_CB(iovb)->buf_type = BUF_NONE; |
2951 | ns_grab_int_lock(card, flags); | 2872 | spin_lock_irqsave(&card->int_lock, flags); |
2952 | skb_queue_tail(&card->iovpool.queue, iovb); | 2873 | skb_queue_tail(&card->iovpool.queue, iovb); |
2953 | card->iovpool.count++; | 2874 | card->iovpool.count++; |
2954 | spin_unlock_irqrestore(&card->int_lock, flags); | 2875 | spin_unlock_irqrestore(&card->int_lock, flags); |
@@ -2995,7 +2916,7 @@ static void ns_poll(unsigned long arg) | |||
2995 | /* Probably it isn't worth spinning */ | 2916 | /* Probably it isn't worth spinning */ |
2996 | continue; | 2917 | continue; |
2997 | } | 2918 | } |
2998 | ns_grab_int_lock(card, flags); | 2919 | spin_lock_irqsave(&card->int_lock, flags); |
2999 | 2920 | ||
3000 | stat_w = 0; | 2921 | stat_w = 0; |
3001 | stat_r = readl(card->membase + STAT); | 2922 | stat_r = readl(card->membase + STAT); |
@@ -3062,7 +2983,7 @@ static void ns_phy_put(struct atm_dev *dev, unsigned char value, | |||
3062 | unsigned long flags; | 2983 | unsigned long flags; |
3063 | 2984 | ||
3064 | card = dev->dev_data; | 2985 | card = dev->dev_data; |
3065 | ns_grab_res_lock(card, flags); | 2986 | spin_lock_irqsave(&card->res_lock, flags); |
3066 | while(CMD_BUSY(card)); | 2987 | while(CMD_BUSY(card)); |
3067 | writel((unsigned long) value, card->membase + DR0); | 2988 | writel((unsigned long) value, card->membase + DR0); |
3068 | writel(NS_CMD_WRITE_UTILITY | 0x00000200 | (addr & 0x000000FF), | 2989 | writel(NS_CMD_WRITE_UTILITY | 0x00000200 | (addr & 0x000000FF), |
@@ -3079,7 +3000,7 @@ static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr) | |||
3079 | unsigned long data; | 3000 | unsigned long data; |
3080 | 3001 | ||
3081 | card = dev->dev_data; | 3002 | card = dev->dev_data; |
3082 | ns_grab_res_lock(card, flags); | 3003 | spin_lock_irqsave(&card->res_lock, flags); |
3083 | while(CMD_BUSY(card)); | 3004 | while(CMD_BUSY(card)); |
3084 | writel(NS_CMD_READ_UTILITY | 0x00000200 | (addr & 0x000000FF), | 3005 | writel(NS_CMD_READ_UTILITY | 0x00000200 | (addr & 0x000000FF), |
3085 | card->membase + CMD); | 3006 | card->membase + CMD); |