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

atm: nicstar: Replace spin_is_locked() with spin_trylock()

ns_poll() used spin_is_locked() + spin_lock() to get achieve the same
thing as a spin_trylock(), so simplify it by using that instead. This is
also a step towards possibly removing spin_is_locked().

Signed-off-by: Lance Roy <ldr709@gmail.com>
Cc: Chas Williams <3chas3@gmail.com>
Cc: <linux-atm-general@lists.sourceforge.net>
Cc: <netdev@vger.kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Lance Roy and committed by
David S. Miller
9a694c1d 9798594c

+1 -2
+1 -2
drivers/atm/nicstar.c
··· 2689 2689 PRINTK("nicstar: Entering ns_poll().\n"); 2690 2690 for (i = 0; i < num_cards; i++) { 2691 2691 card = cards[i]; 2692 - if (spin_is_locked(&card->int_lock)) { 2692 + if (!spin_trylock_irqsave(&card->int_lock, flags)) { 2693 2693 /* Probably it isn't worth spinning */ 2694 2694 continue; 2695 2695 } 2696 - spin_lock_irqsave(&card->int_lock, flags); 2697 2696 2698 2697 stat_w = 0; 2699 2698 stat_r = readl(card->membase + STAT);