Skip to content

Commit

Permalink
staging: slicoss: clean the spinlock code in slic_entry_open
Browse files Browse the repository at this point in the history
the locked variable is used for checking whether the function
acquired lock, then unlock. actually with out this we
can achieve the same lock and unlock senario, remove the locked
variable and also cleanup the code around.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Devendra Naga authored and Greg Kroah-Hartman committed Sep 5, 2012
1 parent 92adcc8 commit 7132996
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions drivers/staging/slicoss/slicoss.c
Original file line number Diff line number Diff line change
Expand Up @@ -3132,7 +3132,6 @@ static int slic_entry_open(struct net_device *dev)
{
struct adapter *adapter = netdev_priv(dev);
struct sliccard *card = adapter->card;
u32 locked = 0;
int status;

ASSERT(adapter);
Expand All @@ -3142,7 +3141,6 @@ static int slic_entry_open(struct net_device *dev)

spin_lock_irqsave(&slic_global.driver_lock.lock,
slic_global.driver_lock.flags);
locked = 1;
if (!adapter->activated) {
card->adapters_activated++;
slic_global.num_slic_ports_active++;
Expand All @@ -3156,23 +3154,15 @@ static int slic_entry_open(struct net_device *dev)
slic_global.num_slic_ports_active--;
adapter->activated = 0;
}
if (locked) {
spin_unlock_irqrestore(&slic_global.driver_lock.lock,
slic_global.driver_lock.flags);
locked = 0;
}
return status;
goto spin_unlock;
}
if (!card->master)
card->master = adapter;

if (locked) {
spin_unlock_irqrestore(&slic_global.driver_lock.lock,
slic_global.driver_lock.flags);
locked = 0;
}

return 0;
spin_unlock:
spin_unlock_irqrestore(&slic_global.driver_lock.lock,
slic_global.driver_lock.flags);
return status;
}

static void slic_card_cleanup(struct sliccard *card)
Expand Down

0 comments on commit 7132996

Please sign in to comment.