lkml.org 
[lkml]   [2002]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH][2.5] bitops for ALSA core/init.c
Jaroslav does this look ok?

Index: linux-2.5.49/sound/core/init.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.49/sound/core/init.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 init.c
--- linux-2.5.49/sound/core/init.c 23 Nov 2002 02:58:10 -0000 1.1.1.1
+++ linux-2.5.49/sound/core/init.c 25 Nov 2002 08:28:31 -0000
@@ -29,7 +29,7 @@
#include <sound/info.h>

int snd_cards_count = 0;
-static unsigned int snd_cards_lock = 0; /* locked for registering/using */
+static unsigned long snd_cards_lock = 0; /* locked for registering/using */
snd_card_t *snd_cards[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = NULL};
rwlock_t snd_card_rwlock = RW_LOCK_UNLOCKED;

@@ -62,12 +62,12 @@
if (idx < 0) {
int idx2;
for (idx2 = 0; idx2 < snd_ecards_limit; idx2++)
- if (!(snd_cards_lock & (1 << idx2))) {
+ if (!test_bit(idx2, &snd_cards_lock)) {
idx = idx2;
break;
}
} else if (idx < snd_ecards_limit) {
- if (snd_cards_lock & (1 << idx))
+ if (test_bit(idx, &snd_cards_lock))
idx = -1; /* invalid */
}
if (idx < 0 || idx >= snd_ecards_limit) {
@@ -76,7 +76,7 @@
snd_printk(KERN_ERR "card %i is out of range (0-%i)\n", idx, snd_ecards_limit-1);
goto __error;
}
- snd_cards_lock |= 1 << idx; /* lock it */
+ set_bit(idx, &snd_cards_lock); /* lock it */
write_unlock(&snd_card_rwlock);
card->number = idx;
card->module = module;
@@ -146,7 +146,7 @@
/* Not fatal error */
}
write_lock(&snd_card_rwlock);
- snd_cards_lock &= ~(1 << card->number);
+ clear_bit(card->number, &snd_cards_lock);
write_unlock(&snd_card_rwlock);
kfree(card);
return 0;
--
function.linuxpower.ca
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:31    [W:0.025 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site