diff options
author | David Kilroy <kilroyd@googlemail.com> | 2010-05-01 09:05:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-03 14:53:07 -0400 |
commit | bcad6e80f3fb0d6724c3814cf32258bbcf1d67db (patch) | |
tree | 13fc2edae79405b7ae393099486153eefa3091d1 /drivers/net/wireless/orinoco/main.c | |
parent | 593ef09c9e70c92c0d76c67a1c03a5d44d3aec82 (diff) |
orinoco: encapsulate driver locking
Local bus and USB drivers will need to do locking differently.
The original orinoco_usb patches had a boolean variable controlling
whether spin_lock_bh was used, or irq based locking. This version
provides wrappers for the lock functions and the drivers specify the
functions pointers needed.
This will introduce a performance penalty, but I'm not expecting it to
be noticable.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/main.c')
-rw-r--r-- | drivers/net/wireless/orinoco/main.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index 7acb6bc3ebff..36c4ba865c7c 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -281,13 +281,13 @@ int orinoco_stop(struct net_device *dev) | |||
281 | /* We mustn't use orinoco_lock() here, because we need to be | 281 | /* We mustn't use orinoco_lock() here, because we need to be |
282 | able to close the interface even if hw_unavailable is set | 282 | able to close the interface even if hw_unavailable is set |
283 | (e.g. as we're released after a PC Card removal) */ | 283 | (e.g. as we're released after a PC Card removal) */ |
284 | spin_lock_irq(&priv->lock); | 284 | orinoco_lock_irq(priv); |
285 | 285 | ||
286 | priv->open = 0; | 286 | priv->open = 0; |
287 | 287 | ||
288 | err = __orinoco_down(priv); | 288 | err = __orinoco_down(priv); |
289 | 289 | ||
290 | spin_unlock_irq(&priv->lock); | 290 | orinoco_unlock_irq(priv); |
291 | 291 | ||
292 | return err; | 292 | return err; |
293 | } | 293 | } |
@@ -1741,7 +1741,7 @@ void orinoco_reset(struct work_struct *work) | |||
1741 | } | 1741 | } |
1742 | 1742 | ||
1743 | /* This has to be called from user context */ | 1743 | /* This has to be called from user context */ |
1744 | spin_lock_irq(&priv->lock); | 1744 | orinoco_lock_irq(priv); |
1745 | 1745 | ||
1746 | priv->hw_unavailable--; | 1746 | priv->hw_unavailable--; |
1747 | 1747 | ||
@@ -1756,7 +1756,7 @@ void orinoco_reset(struct work_struct *work) | |||
1756 | dev->trans_start = jiffies; | 1756 | dev->trans_start = jiffies; |
1757 | } | 1757 | } |
1758 | 1758 | ||
1759 | spin_unlock_irq(&priv->lock); | 1759 | orinoco_unlock_irq(priv); |
1760 | 1760 | ||
1761 | return; | 1761 | return; |
1762 | disable: | 1762 | disable: |
@@ -2073,9 +2073,9 @@ int orinoco_init(struct orinoco_private *priv) | |||
2073 | 2073 | ||
2074 | /* Make the hardware available, as long as it hasn't been | 2074 | /* Make the hardware available, as long as it hasn't been |
2075 | * removed elsewhere (e.g. by PCMCIA hot unplug) */ | 2075 | * removed elsewhere (e.g. by PCMCIA hot unplug) */ |
2076 | spin_lock_irq(&priv->lock); | 2076 | orinoco_lock_irq(priv); |
2077 | priv->hw_unavailable--; | 2077 | priv->hw_unavailable--; |
2078 | spin_unlock_irq(&priv->lock); | 2078 | orinoco_unlock_irq(priv); |
2079 | 2079 | ||
2080 | dev_dbg(dev, "Ready\n"); | 2080 | dev_dbg(dev, "Ready\n"); |
2081 | 2081 | ||
@@ -2317,7 +2317,7 @@ int orinoco_up(struct orinoco_private *priv) | |||
2317 | unsigned long flags; | 2317 | unsigned long flags; |
2318 | int err; | 2318 | int err; |
2319 | 2319 | ||
2320 | spin_lock_irqsave(&priv->lock, flags); | 2320 | priv->hw.ops->lock_irqsave(&priv->lock, &flags); |
2321 | 2321 | ||
2322 | err = orinoco_reinit_firmware(priv); | 2322 | err = orinoco_reinit_firmware(priv); |
2323 | if (err) { | 2323 | if (err) { |
@@ -2337,7 +2337,7 @@ int orinoco_up(struct orinoco_private *priv) | |||
2337 | } | 2337 | } |
2338 | 2338 | ||
2339 | exit: | 2339 | exit: |
2340 | spin_unlock_irqrestore(&priv->lock, flags); | 2340 | priv->hw.ops->unlock_irqrestore(&priv->lock, &flags); |
2341 | 2341 | ||
2342 | return 0; | 2342 | return 0; |
2343 | } | 2343 | } |
@@ -2349,7 +2349,7 @@ void orinoco_down(struct orinoco_private *priv) | |||
2349 | unsigned long flags; | 2349 | unsigned long flags; |
2350 | int err; | 2350 | int err; |
2351 | 2351 | ||
2352 | spin_lock_irqsave(&priv->lock, flags); | 2352 | priv->hw.ops->lock_irqsave(&priv->lock, &flags); |
2353 | err = __orinoco_down(priv); | 2353 | err = __orinoco_down(priv); |
2354 | if (err) | 2354 | if (err) |
2355 | printk(KERN_WARNING "%s: Error %d downing interface\n", | 2355 | printk(KERN_WARNING "%s: Error %d downing interface\n", |
@@ -2357,7 +2357,7 @@ void orinoco_down(struct orinoco_private *priv) | |||
2357 | 2357 | ||
2358 | netif_device_detach(dev); | 2358 | netif_device_detach(dev); |
2359 | priv->hw_unavailable++; | 2359 | priv->hw_unavailable++; |
2360 | spin_unlock_irqrestore(&priv->lock, flags); | 2360 | priv->hw.ops->unlock_irqrestore(&priv->lock, &flags); |
2361 | } | 2361 | } |
2362 | EXPORT_SYMBOL(orinoco_down); | 2362 | EXPORT_SYMBOL(orinoco_down); |
2363 | 2363 | ||