Skip to contentSkip to conversation

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

PATCH Applied Lance Roy 3 participants 3 messages Oct 4, 2018 – Oct 6, 2018

Subsystems (3)
lore
Share & tools
lore

Lance Roy

author
#0 lore raw

PATCH 1/1 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().

---
 drivers/atm/nicstar.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/atm/nicstar.c +1 -2
index cbec9adc01c7..ae4aa02e4dc6 100644
@@ -2689,11 +2689,10 @@ static void ns_poll(struct timer_list *unused)
 	PRINTK("nicstar: Entering ns_poll().\n");
 	for (i = 0; i < num_cards; i++) {
 		card = cards[i];
-		if (spin_is_locked(&card->int_lock)) {
+		if (!spin_trylock_irqsave(&card->int_lock, flags)) {
 			/* Probably it isn't worth spinning */
 			continue;
 		}
-		spin_lock_irqsave(&card->int_lock, flags);
 
 		stat_w = 0;
 		stat_r = readl(card->membase + STAT);
Signature · 1 line
2.19.0
maintainer Applied
#1 lore raw

From: Lance Roy <[email protected]>
Date: Thu, 4 Oct 2018 00:46:57 -0700

Quoted 5 lines

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().

Applied to net-next.

#2 lore raw
Quoted 10 lines · David Miller

From: Lance Roy <[email protected]>
Date: Thu, 4 Oct 2018 00:46:57 -0700

Quoted 5 lines

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().

Applied to net-next.

Thank you, Dave! I have dropped this one from my tree.

Thanx, Paul