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/hermes.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/hermes.c')
-rw-r--r-- | drivers/net/wireless/orinoco/hermes.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/net/wireless/orinoco/hermes.c b/drivers/net/wireless/orinoco/hermes.c index a7df5240779c..845693fb25f3 100644 --- a/drivers/net/wireless/orinoco/hermes.c +++ b/drivers/net/wireless/orinoco/hermes.c | |||
@@ -529,6 +529,28 @@ static int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, | |||
529 | return err; | 529 | return err; |
530 | } | 530 | } |
531 | 531 | ||
532 | static void hermes_lock_irqsave(spinlock_t *lock, | ||
533 | unsigned long *flags) __acquires(lock) | ||
534 | { | ||
535 | spin_lock_irqsave(lock, *flags); | ||
536 | } | ||
537 | |||
538 | static void hermes_unlock_irqrestore(spinlock_t *lock, | ||
539 | unsigned long *flags) __releases(lock) | ||
540 | { | ||
541 | spin_unlock_irqrestore(lock, *flags); | ||
542 | } | ||
543 | |||
544 | static void hermes_lock_irq(spinlock_t *lock) __acquires(lock) | ||
545 | { | ||
546 | spin_lock_irq(lock); | ||
547 | } | ||
548 | |||
549 | static void hermes_unlock_irq(spinlock_t *lock) __releases(lock) | ||
550 | { | ||
551 | spin_unlock_irq(lock); | ||
552 | } | ||
553 | |||
532 | /* Hermes operations for local buses */ | 554 | /* Hermes operations for local buses */ |
533 | static const struct hermes_ops hermes_ops_local = { | 555 | static const struct hermes_ops hermes_ops_local = { |
534 | .init = hermes_init, | 556 | .init = hermes_init, |
@@ -538,5 +560,9 @@ static const struct hermes_ops hermes_ops_local = { | |||
538 | .read_ltv = hermes_read_ltv, | 560 | .read_ltv = hermes_read_ltv, |
539 | .write_ltv = hermes_write_ltv, | 561 | .write_ltv = hermes_write_ltv, |
540 | .bap_pread = hermes_bap_pread, | 562 | .bap_pread = hermes_bap_pread, |
541 | .bap_pwrite = hermes_bap_pwrite | 563 | .bap_pwrite = hermes_bap_pwrite, |
564 | .lock_irqsave = hermes_lock_irqsave, | ||
565 | .unlock_irqrestore = hermes_unlock_irqrestore, | ||
566 | .lock_irq = hermes_lock_irq, | ||
567 | .unlock_irq = hermes_unlock_irq, | ||
542 | }; | 568 | }; |