2018-10-04 07:48:13

by Lance Roy

[permalink] [raw]
Subject: [PATCH] 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 <[email protected]>
Cc: Chas Williams <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
---
drivers/atm/nicstar.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index cbec9adc01c7..ae4aa02e4dc6 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -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);
--
2.19.0



2018-10-05 21:34:20

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] atm: nicstar: Replace spin_is_locked() with spin_trylock()

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

> 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 <[email protected]>

Applied to net-next.

2018-10-06 17:00:18

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH] atm: nicstar: Replace spin_is_locked() with spin_trylock()

On Fri, Oct 05, 2018 at 02:32:36PM -0700, David Miller wrote:
> From: Lance Roy <[email protected]>
> Date: Thu, 4 Oct 2018 00:46:57 -0700
>
> > 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 <[email protected]>
>
> Applied to net-next.

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

Thanx, Paul