summaryrefslogtreecommitdiff
path: root/sound/core/oss/pcm_plugin.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 10:18:00 +0100
committerJaroslav Kysela <perex@suse.cz>2006-01-03 12:16:33 +0100
commit47eaebfd31610d2a55fbaccd1e7c37690d42ce30 (patch)
treed86d90a3741e09cf660aef3dda96566ff68778eb /sound/core/oss/pcm_plugin.h
parent230b5c1a612ae903c560b55a15df287b0ff437ea (diff)
[ALSA] Use standard bitmap functions
Modules: ALSA<-OSS emulation Use standard bitmap functions instead of in-house ones. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/oss/pcm_plugin.h')
-rw-r--r--sound/core/oss/pcm_plugin.h78
1 files changed, 9 insertions, 69 deletions
diff --git a/sound/core/oss/pcm_plugin.h b/sound/core/oss/pcm_plugin.h
index 0f86ce47749..69a43172142 100644
--- a/sound/core/oss/pcm_plugin.h
+++ b/sound/core/oss/pcm_plugin.h
@@ -22,71 +22,11 @@
*
*/
-#ifndef ATTRIBUTE_UNUSED
-#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-#endif
-
-typedef unsigned int bitset_t;
-
-static inline size_t bitset_size(int nbits)
-{
- return (nbits + sizeof(bitset_t) * 8 - 1) / (sizeof(bitset_t) * 8);
-}
-
-static inline bitset_t *bitset_alloc(int nbits)
-{
- return kcalloc(bitset_size(nbits), sizeof(bitset_t), GFP_KERNEL);
-}
-
-static inline void bitset_set(bitset_t *bitmap, unsigned int pos)
-{
- size_t bits = sizeof(*bitmap) * 8;
- bitmap[pos / bits] |= 1 << (pos % bits);
-}
-
-static inline void bitset_reset(bitset_t *bitmap, unsigned int pos)
-{
- size_t bits = sizeof(*bitmap) * 8;
- bitmap[pos / bits] &= ~(1 << (pos % bits));
-}
-
-static inline int bitset_get(bitset_t *bitmap, unsigned int pos)
-{
- size_t bits = sizeof(*bitmap) * 8;
- return !!(bitmap[pos / bits] & (1 << (pos % bits)));
-}
-
-static inline void bitset_copy(bitset_t *dst, bitset_t *src, unsigned int nbits)
-{
- memcpy(dst, src, bitset_size(nbits) * sizeof(bitset_t));
-}
-
-static inline void bitset_and(bitset_t *dst, bitset_t *bs, unsigned int nbits)
-{
- bitset_t *end = dst + bitset_size(nbits);
- while (dst < end)
- *dst++ &= *bs++;
-}
-
-static inline void bitset_or(bitset_t *dst, bitset_t *bs, unsigned int nbits)
-{
- bitset_t *end = dst + bitset_size(nbits);
- while (dst < end)
- *dst++ |= *bs++;
-}
-
-static inline void bitset_zero(bitset_t *dst, unsigned int nbits)
-{
- bitset_t *end = dst + bitset_size(nbits);
- while (dst < end)
- *dst++ = 0;
-}
+#include <linux/bitmap.h>
-static inline void bitset_one(bitset_t *dst, unsigned int nbits)
+static inline unsigned long *bitmap_alloc(unsigned int nbits)
{
- bitset_t *end = dst + bitset_size(nbits);
- while (dst < end)
- *dst++ = ~(bitset_t)0;
+ return kmalloc(BITS_TO_LONGS(nbits), GFP_KERNEL);
}
#define snd_pcm_plug_t snd_pcm_substream_t
@@ -131,11 +71,11 @@ struct _snd_pcm_plugin {
snd_pcm_uframes_t frames,
snd_pcm_plugin_channel_t **channels);
int (*src_channels_mask)(snd_pcm_plugin_t *plugin,
- bitset_t *dst_vmask,
- bitset_t **src_vmask);
+ unsigned long *dst_vmask,
+ unsigned long **src_vmask);
int (*dst_channels_mask)(snd_pcm_plugin_t *plugin,
- bitset_t *src_vmask,
- bitset_t **dst_vmask);
+ unsigned long *src_vmask,
+ unsigned long **dst_vmask);
snd_pcm_sframes_t (*transfer)(snd_pcm_plugin_t *plugin,
const snd_pcm_plugin_channel_t *src_channels,
snd_pcm_plugin_channel_t *dst_channels,
@@ -151,8 +91,8 @@ struct _snd_pcm_plugin {
char *buf;
snd_pcm_uframes_t buf_frames;
snd_pcm_plugin_channel_t *buf_channels;
- bitset_t *src_vmask;
- bitset_t *dst_vmask;
+ unsigned long *src_vmask;
+ unsigned long *dst_vmask;
char extra_data[0];
};