This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / sound / core / pcm.c
index 7f1bf94..559c66c 100644 (file)
@@ -126,12 +126,12 @@ static int snd_pcm_control_ioctl(snd_card_t * card,
 #define FORMAT(v) [SNDRV_PCM_FORMAT_##v] = #v
 #define SUBFORMAT(v) [SNDRV_PCM_SUBFORMAT_##v] = #v 
 
-char *snd_pcm_stream_names[] = {
+static char *snd_pcm_stream_names[] = {
        STREAM(PLAYBACK),
        STREAM(CAPTURE),
 };
 
-char *snd_pcm_state_names[] = {
+static char *snd_pcm_state_names[] = {
        STATE(OPEN),
        STATE(SETUP),
        STATE(PREPARED),
@@ -142,7 +142,7 @@ char *snd_pcm_state_names[] = {
        STATE(SUSPENDED),
 };
 
-char *snd_pcm_access_names[] = {
+static char *snd_pcm_access_names[] = {
        ACCESS(MMAP_INTERLEAVED), 
        ACCESS(MMAP_NONINTERLEAVED),
        ACCESS(MMAP_COMPLEX),
@@ -150,7 +150,7 @@ char *snd_pcm_access_names[] = {
        ACCESS(RW_NONINTERLEAVED),
 };
 
-char *snd_pcm_format_names[] = {
+static char *snd_pcm_format_names[] = {
        FORMAT(S8),
        FORMAT(U8),
        FORMAT(S16_LE),
@@ -191,54 +191,54 @@ char *snd_pcm_format_names[] = {
        FORMAT(U18_3BE),
 };
 
-char *snd_pcm_subformat_names[] = {
+static char *snd_pcm_subformat_names[] = {
        SUBFORMAT(STD), 
 };
 
-char *snd_pcm_tstamp_mode_names[] = {
+static char *snd_pcm_tstamp_mode_names[] = {
        TSTAMP(NONE),
        TSTAMP(MMAP),
 };
 
-const char *snd_pcm_stream_name(snd_pcm_stream_t stream)
+static const char *snd_pcm_stream_name(snd_pcm_stream_t stream)
 {
-       snd_assert(stream <= SNDRV_PCM_STREAM_LAST, return 0);
+       snd_assert(stream <= SNDRV_PCM_STREAM_LAST, return NULL);
        return snd_pcm_stream_names[stream];
 }
 
-const char *snd_pcm_access_name(snd_pcm_access_t access)
+static const char *snd_pcm_access_name(snd_pcm_access_t access)
 {
-       snd_assert(access <= SNDRV_PCM_ACCESS_LAST, return 0);
+       snd_assert(access <= SNDRV_PCM_ACCESS_LAST, return NULL);
        return snd_pcm_access_names[access];
 }
 
 const char *snd_pcm_format_name(snd_pcm_format_t format)
 {
-       snd_assert(format <= SNDRV_PCM_FORMAT_LAST, return 0);
+       snd_assert(format <= SNDRV_PCM_FORMAT_LAST, return NULL);
        return snd_pcm_format_names[format];
 }
 
-const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)
+static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)
 {
-       snd_assert(subformat <= SNDRV_PCM_SUBFORMAT_LAST, return 0);
+       snd_assert(subformat <= SNDRV_PCM_SUBFORMAT_LAST, return NULL);
        return snd_pcm_subformat_names[subformat];
 }
 
-const char *snd_pcm_tstamp_mode_name(snd_pcm_tstamp_t mode)
+static const char *snd_pcm_tstamp_mode_name(snd_pcm_tstamp_t mode)
 {
-       snd_assert(mode <= SNDRV_PCM_TSTAMP_LAST, return 0);
+       snd_assert(mode <= SNDRV_PCM_TSTAMP_LAST, return NULL);
        return snd_pcm_tstamp_mode_names[mode];
 }
 
-const char *snd_pcm_state_name(snd_pcm_state_t state)
+static const char *snd_pcm_state_name(snd_pcm_state_t state)
 {
-       snd_assert(state <= SNDRV_PCM_STATE_LAST, return 0);
+       snd_assert(state <= SNDRV_PCM_STATE_LAST, return NULL);
        return snd_pcm_state_names[state];
 }
 
 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
 #include <linux/soundcard.h>
-const char *snd_pcm_oss_format_name(int format)
+static const char *snd_pcm_oss_format_name(int format)
 {
        switch (format) {
        case AFMT_MU_LAW:
@@ -267,7 +267,7 @@ const char *snd_pcm_oss_format_name(int format)
 }
 #endif
 
-
+#ifdef CONFIG_PROC_FS
 static void snd_pcm_proc_info_read(snd_pcm_substream_t *substream, snd_info_buffer_t *buffer)
 {
        snd_pcm_info_t info;
@@ -391,6 +391,7 @@ static void snd_pcm_substream_proc_status_read(snd_info_entry_t *entry, snd_info
        snd_iprintf(buffer, "hw_ptr      : %ld\n", runtime->status->hw_ptr);
        snd_iprintf(buffer, "appl_ptr    : %ld\n", runtime->control->appl_ptr);
 }
+#endif
 
 #ifdef CONFIG_SND_DEBUG
 static void snd_pcm_xrun_debug_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
@@ -585,7 +586,7 @@ int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count)
        }
        prev = NULL;
        for (idx = 0, prev = NULL; idx < substream_count; idx++) {
-               substream = snd_magic_kcalloc(snd_pcm_substream_t, 0, GFP_KERNEL);
+               substream = kcalloc(1, sizeof(*substream), GFP_KERNEL);
                if (substream == NULL)
                        return -ENOMEM;
                substream->pcm = pcm;
@@ -600,7 +601,7 @@ int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count)
                        prev->next = substream;
                err = snd_pcm_substream_proc_init(substream);
                if (err < 0) {
-                       snd_magic_kfree(substream);
+                       kfree(substream);
                        return err;
                }
                substream->group = &substream->self_group;
@@ -645,7 +646,7 @@ int snd_pcm_new(snd_card_t * card, char *id, int device,
        snd_assert(rpcm != NULL, return -EINVAL);
        *rpcm = NULL;
        snd_assert(card != NULL, return -ENXIO);
-       pcm = snd_magic_kcalloc(snd_pcm_t, 0, GFP_KERNEL);
+       pcm = kcalloc(1, sizeof(*pcm), GFP_KERNEL);
        if (pcm == NULL)
                return -ENOMEM;
        pcm->card = card;
@@ -681,7 +682,7 @@ static void snd_pcm_free_stream(snd_pcm_str_t * pstr)
        while (substream) {
                substream_next = substream->next;
                snd_pcm_substream_proc_done(substream);
-               snd_magic_kfree(substream);
+               kfree(substream);
                substream = substream_next;
        }
        snd_pcm_stream_proc_done(pstr);
@@ -702,13 +703,13 @@ static int snd_pcm_free(snd_pcm_t *pcm)
        snd_pcm_lib_preallocate_free_for_all(pcm);
        snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]);
        snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_CAPTURE]);
-       snd_magic_kfree(pcm);
+       kfree(pcm);
        return 0;
 }
 
 static int snd_pcm_dev_free(snd_device_t *device)
 {
-       snd_pcm_t *pcm = snd_magic_cast(snd_pcm_t, device->device_data, return -ENXIO);
+       snd_pcm_t *pcm = device->device_data;
        return snd_pcm_free(pcm);
 }
 
@@ -783,7 +784,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream,
        if (substream == NULL)
                return -EAGAIN;
 
-       runtime = snd_kcalloc(sizeof(snd_pcm_runtime_t), GFP_KERNEL);
+       runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL);
        if (runtime == NULL)
                return -ENOMEM;
 
@@ -829,8 +830,7 @@ void snd_pcm_release_substream(snd_pcm_substream_t *substream)
                runtime->private_free(runtime);
        snd_free_pages((void*)runtime->status, PAGE_ALIGN(sizeof(snd_pcm_mmap_status_t)));
        snd_free_pages((void*)runtime->control, PAGE_ALIGN(sizeof(snd_pcm_mmap_control_t)));
-       if (runtime->hw_constraints.rules)
-               kfree(runtime->hw_constraints.rules);
+       kfree(runtime->hw_constraints.rules);
        kfree(runtime);
        substream->runtime = NULL;
        substream->pstr->substream_opened--;
@@ -843,7 +843,7 @@ static int snd_pcm_dev_register(snd_device_t *device)
        snd_pcm_substream_t *substream;
        struct list_head *list;
        char str[16];
-       snd_pcm_t *pcm = snd_magic_cast(snd_pcm_t, device->device_data, return -ENXIO);
+       snd_pcm_t *pcm = device->device_data;
 
        snd_assert(pcm != NULL && device != NULL, return -ENXIO);
        down(&register_mutex);
@@ -888,7 +888,7 @@ static int snd_pcm_dev_register(snd_device_t *device)
 
 static int snd_pcm_dev_disconnect(snd_device_t *device)
 {
-       snd_pcm_t *pcm = snd_magic_cast(snd_pcm_t, device->device_data, return -ENXIO);
+       snd_pcm_t *pcm = device->device_data;
        struct list_head *list;
        snd_pcm_substream_t *substream;
        int idx, cidx;
@@ -914,7 +914,7 @@ static int snd_pcm_dev_unregister(snd_device_t *device)
        int idx, cidx, devtype;
        snd_pcm_substream_t *substream;
        struct list_head *list;
-       snd_pcm_t *pcm = snd_magic_cast(snd_pcm_t, device->device_data, return -ENXIO);
+       snd_pcm_t *pcm = device->device_data;
 
        snd_assert(pcm != NULL, return -ENXIO);
        down(&register_mutex);
@@ -1034,7 +1034,6 @@ EXPORT_SYMBOL(snd_pcm_notify);
 EXPORT_SYMBOL(snd_pcm_open_substream);
 EXPORT_SYMBOL(snd_pcm_release_substream);
 EXPORT_SYMBOL(snd_pcm_format_name);
-EXPORT_SYMBOL(snd_pcm_subformat_name);
   /* pcm_native.c */
 EXPORT_SYMBOL(snd_pcm_link_rwlock);
 EXPORT_SYMBOL(snd_pcm_start);
@@ -1045,11 +1044,10 @@ EXPORT_SYMBOL(snd_pcm_suspend_all);
 EXPORT_SYMBOL(snd_pcm_kernel_playback_ioctl);
 EXPORT_SYMBOL(snd_pcm_kernel_capture_ioctl);
 EXPORT_SYMBOL(snd_pcm_kernel_ioctl);
-EXPORT_SYMBOL(snd_pcm_open);
-EXPORT_SYMBOL(snd_pcm_release);
-EXPORT_SYMBOL(snd_pcm_playback_poll);
-EXPORT_SYMBOL(snd_pcm_capture_poll);
 EXPORT_SYMBOL(snd_pcm_mmap_data);
+#if SNDRV_PCM_INFO_MMAP_IOMEM
+EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem);
+#endif
  /* pcm_misc.c */
 EXPORT_SYMBOL(snd_pcm_format_signed);
 EXPORT_SYMBOL(snd_pcm_format_unsigned);
@@ -1058,7 +1056,6 @@ EXPORT_SYMBOL(snd_pcm_format_little_endian);
 EXPORT_SYMBOL(snd_pcm_format_big_endian);
 EXPORT_SYMBOL(snd_pcm_format_width);
 EXPORT_SYMBOL(snd_pcm_format_physical_width);
-EXPORT_SYMBOL(snd_pcm_format_size);
 EXPORT_SYMBOL(snd_pcm_format_silence_64);
 EXPORT_SYMBOL(snd_pcm_format_set_silence);
 EXPORT_SYMBOL(snd_pcm_build_linear_format);