staging: slicoss: clean the spinlock code in slic_entry_open

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>
This commit is contained in:
Devendra Naga 2012-09-05 15:33:48 +05:30 committed by Greg Kroah-Hartman
parent 92adcc8057
commit 7132996527
1 changed files with 5 additions and 15 deletions

View File

@ -3132,7 +3132,6 @@ static int slic_entry_open(struct net_device *dev)
{ {
struct adapter *adapter = netdev_priv(dev); struct adapter *adapter = netdev_priv(dev);
struct sliccard *card = adapter->card; struct sliccard *card = adapter->card;
u32 locked = 0;
int status; int status;
ASSERT(adapter); ASSERT(adapter);
@ -3142,7 +3141,6 @@ static int slic_entry_open(struct net_device *dev)
spin_lock_irqsave(&slic_global.driver_lock.lock, spin_lock_irqsave(&slic_global.driver_lock.lock,
slic_global.driver_lock.flags); slic_global.driver_lock.flags);
locked = 1;
if (!adapter->activated) { if (!adapter->activated) {
card->adapters_activated++; card->adapters_activated++;
slic_global.num_slic_ports_active++; slic_global.num_slic_ports_active++;
@ -3156,23 +3154,15 @@ static int slic_entry_open(struct net_device *dev)
slic_global.num_slic_ports_active--; slic_global.num_slic_ports_active--;
adapter->activated = 0; adapter->activated = 0;
} }
if (locked) { goto spin_unlock;
spin_unlock_irqrestore(&slic_global.driver_lock.lock,
slic_global.driver_lock.flags);
locked = 0;
}
return status;
} }
if (!card->master) if (!card->master)
card->master = adapter; card->master = adapter;
if (locked) { spin_unlock:
spin_unlock_irqrestore(&slic_global.driver_lock.lock, spin_unlock_irqrestore(&slic_global.driver_lock.lock,
slic_global.driver_lock.flags); slic_global.driver_lock.flags);
locked = 0; return status;
}
return 0;
} }
static void slic_card_cleanup(struct sliccard *card) static void slic_card_cleanup(struct sliccard *card)