Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mark Asselstine and committed by
David S. Miller
36ef4080 344234de

+19 -110
+19 -98
drivers/atm/nicstar.c
··· 125 125 #define ATM_SKB(s) (&(s)->atm) 126 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 129 /* Function declarations ******************************************************/ 209 130 ··· 343 422 sram_address <<= 2; 344 423 sram_address &= 0x0007FFFC; /* address must be dword aligned */ 345 424 sram_address |= 0x50000000; /* SRAM read command */ 346 - ns_grab_res_lock(card, flags); 425 + spin_lock_irqsave(&card->res_lock, flags); 347 426 while (CMD_BUSY(card)); 348 427 writel(sram_address, card->membase + CMD); 349 428 while (CMD_BUSY(card)); ··· 361 440 count--; /* count range now is 0..3 instead of 1..4 */ 362 441 c = count; 363 442 c <<= 2; /* to use increments of 4 */ 364 - ns_grab_res_lock(card, flags); 443 + spin_lock_irqsave(&card->res_lock, flags); 365 444 while (CMD_BUSY(card)); 366 445 for (i = 0; i <= c; i += 4) 367 446 writel(*(value++), card->membase + i); ··· 1087 1166 card->lbfqc += 2; 1088 1167 } 1089 1168 1090 - ns_grab_res_lock(card, flags); 1169 + spin_lock_irqsave(&card->res_lock, flags); 1091 1170 1092 1171 while (CMD_BUSY(card)); 1093 1172 writel(addr2, card->membase + DR3); ··· 1127 1206 1128 1207 PRINTK("nicstar%d: NICStAR generated an interrupt\n", card->index); 1129 1208 1130 - ns_grab_int_lock(card, flags); 1209 + spin_lock_irqsave(&card->int_lock, flags); 1131 1210 1132 1211 stat_r = readl(card->membase + STAT); 1133 1212 ··· 1506 1585 unsigned long flags; 1507 1586 1508 1587 addr = NS_RCT + (vcc->vpi << card->vcibits | vcc->vci) * NS_RCT_ENTRY_SIZE; 1509 - ns_grab_res_lock(card, flags); 1588 + spin_lock_irqsave(&card->res_lock, flags); 1510 1589 while(CMD_BUSY(card)); 1511 1590 writel(NS_CMD_CLOSE_CONNECTION | addr << 2, card->membase + CMD); 1512 1591 spin_unlock_irqrestore(&card->res_lock, flags); ··· 1528 1607 NS_SKB(iovb)->iovcnt); 1529 1608 NS_SKB(iovb)->iovcnt = 0; 1530 1609 NS_SKB(iovb)->vcc = NULL; 1531 - ns_grab_int_lock(card, flags); 1610 + spin_lock_irqsave(&card->int_lock, flags); 1532 1611 recycle_iov_buf(card, iovb); 1533 1612 spin_unlock_irqrestore(&card->int_lock, flags); 1534 1613 vc->rx_iov = NULL; ··· 1550 1629 1551 1630 for (;;) 1552 1631 { 1553 - ns_grab_scq_lock(card, scq, flags); 1632 + spin_lock_irqsave(&scq->lock, flags); 1554 1633 scqep = scq->next; 1555 1634 if (scqep == scq->base) 1556 1635 scqep = scq->last; ··· 1612 1691 unsigned long flags; 1613 1692 scq_info *scq = card->scq0; 1614 1693 1615 - ns_grab_scq_lock(card, scq, flags); 1694 + spin_lock_irqsave(&scq->lock, flags); 1616 1695 1617 1696 for(i = 0; i < scq->num_entries; i++) { 1618 1697 if(scq->skb[i] && ATM_SKB(scq->skb[i])->vcc == vcc) { ··· 1813 1892 u32 data; 1814 1893 int index; 1815 1894 1816 - ns_grab_scq_lock(card, scq, flags); 1895 + spin_lock_irqsave(&scq->lock, flags); 1817 1896 while (scq->tail == scq->next) 1818 1897 { 1819 1898 if (in_interrupt()) { ··· 1825 1904 scq->full = 1; 1826 1905 spin_unlock_irqrestore(&scq->lock, flags); 1827 1906 interruptible_sleep_on_timeout(&scq->scqfull_waitq, SCQFULL_TIMEOUT); 1828 - ns_grab_scq_lock(card, scq, flags); 1907 + spin_lock_irqsave(&scq->lock, flags); 1829 1908 1830 1909 if (scq->full) { 1831 1910 spin_unlock_irqrestore(&scq->lock, flags); ··· 1874 1953 if (has_run++) break; 1875 1954 spin_unlock_irqrestore(&scq->lock, flags); 1876 1955 interruptible_sleep_on_timeout(&scq->scqfull_waitq, SCQFULL_TIMEOUT); 1877 - ns_grab_scq_lock(card, scq, flags); 1956 + spin_lock_irqsave(&scq->lock, flags); 1878 1957 } 1879 1958 1880 1959 if (!scq->full) ··· 2011 2090 return; 2012 2091 } 2013 2092 2014 - ns_grab_scq_lock(card, scq, flags); 2093 + spin_lock_irqsave(&scq->lock, flags); 2015 2094 i = (int) (scq->tail - scq->base); 2016 2095 if (++i == scq->num_entries) 2017 2096 i = 0; ··· 2819 2898 { 2820 2899 struct sk_buff *hb; 2821 2900 2822 - ns_grab_int_lock(card, flags); 2901 + spin_lock_irqsave(&card->int_lock, flags); 2823 2902 hb = skb_dequeue(&card->hbpool.queue); 2824 2903 card->hbpool.count--; 2825 2904 spin_unlock_irqrestore(&card->int_lock, flags); ··· 2838 2917 if (hb == NULL) 2839 2918 return -ENOMEM; 2840 2919 NS_SKB_CB(hb)->buf_type = BUF_NONE; 2841 - ns_grab_int_lock(card, flags); 2920 + spin_lock_irqsave(&card->int_lock, flags); 2842 2921 skb_queue_tail(&card->hbpool.queue, hb); 2843 2922 card->hbpool.count++; 2844 2923 spin_unlock_irqrestore(&card->int_lock, flags); ··· 2850 2929 { 2851 2930 struct sk_buff *iovb; 2852 2931 2853 - ns_grab_int_lock(card, flags); 2932 + spin_lock_irqsave(&card->int_lock, flags); 2854 2933 iovb = skb_dequeue(&card->iovpool.queue); 2855 2934 card->iovpool.count--; 2856 2935 spin_unlock_irqrestore(&card->int_lock, flags); ··· 2869 2948 if (iovb == NULL) 2870 2949 return -ENOMEM; 2871 2950 NS_SKB_CB(iovb)->buf_type = BUF_NONE; 2872 - ns_grab_int_lock(card, flags); 2951 + spin_lock_irqsave(&card->int_lock, flags); 2873 2952 skb_queue_tail(&card->iovpool.queue, iovb); 2874 2953 card->iovpool.count++; 2875 2954 spin_unlock_irqrestore(&card->int_lock, flags); ··· 2916 2995 /* Probably it isn't worth spinning */ 2917 2996 continue; 2918 2997 } 2919 - ns_grab_int_lock(card, flags); 2998 + spin_lock_irqsave(&card->int_lock, flags); 2920 2999 2921 3000 stat_w = 0; 2922 3001 stat_r = readl(card->membase + STAT); ··· 2983 3062 unsigned long flags; 2984 3063 2985 3064 card = dev->dev_data; 2986 - ns_grab_res_lock(card, flags); 3065 + spin_lock_irqsave(&card->res_lock, flags); 2987 3066 while(CMD_BUSY(card)); 2988 3067 writel((unsigned long) value, card->membase + DR0); 2989 3068 writel(NS_CMD_WRITE_UTILITY | 0x00000200 | (addr & 0x000000FF), ··· 3000 3079 unsigned long data; 3001 3080 3002 3081 card = dev->dev_data; 3003 - ns_grab_res_lock(card, flags); 3082 + spin_lock_irqsave(&card->res_lock, flags); 3004 3083 while(CMD_BUSY(card)); 3005 3084 writel(NS_CMD_READ_UTILITY | 0x00000200 | (addr & 0x000000FF), 3006 3085 card->membase + CMD);
-12
drivers/atm/nicstar.h
··· 28 28 29 29 /* Options ********************************************************************/ 30 30 31 - #undef NS_DEBUG_SPINLOCKS 32 - 33 31 #define NS_MAX_CARDS 4 /* Maximum number of NICStAR based cards 34 32 controlled by the device driver. Must 35 33 be <= 5 */ ··· 719 721 wait_queue_head_t scqfull_waitq; 720 722 volatile char full; /* SCQ full indicator */ 721 723 spinlock_t lock; /* SCQ spinlock */ 722 - #ifdef NS_DEBUG_SPINLOCKS 723 - volatile long has_lock; 724 - volatile int cpu_lock; 725 - #endif /* NS_DEBUG_SPINLOCKS */ 726 724 } scq_info; 727 725 728 726 ··· 804 810 unsigned intcnt; /* Interrupt counter */ 805 811 spinlock_t int_lock; /* Interrupt lock */ 806 812 spinlock_t res_lock; /* Card resource lock */ 807 - #ifdef NS_DEBUG_SPINLOCKS 808 - volatile long has_int_lock; 809 - volatile int cpu_int; 810 - volatile long has_res_lock; 811 - volatile int cpu_res; 812 - #endif /* NS_DEBUG_SPINLOCKS */ 813 813 } ns_dev; 814 814 815 815