[ALSA] Tiny clean up of PCM codes
authorTakashi Iwai <tiwai@suse.de>
Mon, 27 Mar 2006 14:22:45 +0000 (16:22 +0200)
committerJaroslav Kysela <perex@suse.cz>
Fri, 31 Mar 2006 15:58:58 +0000 (17:58 +0200)
- Make snd_pcm_prepare() static
- Clean up snd_pcm_kernel_*_ioctl() functions, reduce exports

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/pcm.h
sound/core/oss/pcm_oss.c
sound/core/pcm.c
sound/core/pcm_native.c

index 15b885660bf05687b753350b967e566c7634de1d..7cf6a30c15263d24eda67bde9c2c7cf7728f91ae 100644 (file)
@@ -460,7 +460,6 @@ int snd_pcm_info_user(struct snd_pcm_substream *substream,
                      struct snd_pcm_info __user *info);
 int snd_pcm_status(struct snd_pcm_substream *substream,
                   struct snd_pcm_status *status);
-int snd_pcm_prepare(struct snd_pcm_substream *substream);
 int snd_pcm_start(struct snd_pcm_substream *substream);
 int snd_pcm_stop(struct snd_pcm_substream *substream, int status);
 int snd_pcm_drain_done(struct snd_pcm_substream *substream);
@@ -468,8 +467,6 @@ int snd_pcm_drain_done(struct snd_pcm_substream *substream);
 int snd_pcm_suspend(struct snd_pcm_substream *substream);
 int snd_pcm_suspend_all(struct snd_pcm *pcm);
 #endif
-int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
-int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
 int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
 int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct snd_pcm_substream **rsubstream);
 void snd_pcm_release_substream(struct snd_pcm_substream *substream);
index f8302b703a30e8b0d3aebc06d84c8e79c5ef62e6..54be0bba6bd230c15a9ca74323e2d9465ae93a36 100644 (file)
@@ -959,12 +959,12 @@ static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file)
 
        substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
        if (substream != NULL) {
-               snd_pcm_kernel_playback_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
+               snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
                substream->runtime->oss.prepare = 1;
        }
        substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
        if (substream != NULL) {
-               snd_pcm_kernel_capture_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
+               snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
                substream->runtime->oss.prepare = 1;
        }
        return 0;
@@ -979,7 +979,7 @@ static int snd_pcm_oss_post(struct snd_pcm_oss_file *pcm_oss_file)
        if (substream != NULL) {
                if ((err = snd_pcm_oss_make_ready(substream)) < 0)
                        return err;
-               snd_pcm_kernel_playback_ioctl(substream, SNDRV_PCM_IOCTL_START, NULL);
+               snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_START, NULL);
        }
        /* note: all errors from the start action are ignored */
        /* OSS apps do not know, how to handle them */
@@ -1108,7 +1108,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
              __direct:
                saved_f_flags = substream->ffile->f_flags;
                substream->ffile->f_flags &= ~O_NONBLOCK;
-               err = snd_pcm_kernel_playback_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
+               err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
                substream->ffile->f_flags = saved_f_flags;
                if (err < 0)
                        return err;
@@ -1120,7 +1120,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
                if ((err = snd_pcm_oss_make_ready(substream)) < 0)
                        return err;
                runtime = substream->runtime;
-               err = snd_pcm_kernel_capture_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
+               err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
                if (err < 0)
                        return err;
                runtime->oss.buffer_used = 0;
@@ -1437,7 +1437,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr
                        cmd = SNDRV_PCM_IOCTL_DROP;
                        runtime->oss.prepare = 1;
                }
-               err = snd_pcm_kernel_playback_ioctl(psubstream, cmd, NULL);
+               err = snd_pcm_kernel_ioctl(psubstream, cmd, NULL);
                if (err < 0)
                        return err;
        }
@@ -1458,7 +1458,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr
                        cmd = SNDRV_PCM_IOCTL_DROP;
                        runtime->oss.prepare = 1;
                }
-               err = snd_pcm_kernel_capture_ioctl(csubstream, cmd, NULL);
+               err = snd_pcm_kernel_ioctl(csubstream, cmd, NULL);
                if (err < 0)
                        return err;
        }
@@ -1495,7 +1495,7 @@ static int snd_pcm_oss_get_odelay(struct snd_pcm_oss_file *pcm_oss_file)
        runtime = substream->runtime;
        if (runtime->oss.params || runtime->oss.prepare)
                return 0;
-       err = snd_pcm_kernel_playback_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay);
+       err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay);
        if (err == -EPIPE)
                delay = 0;      /* hack for broken OSS applications */
        else if (err < 0)
index 3da6a38c2d0fd6391da878e8bb6921f0e0b90274..1e9878fed37fb496b35b5919974c5de6022ec867 100644 (file)
@@ -1111,8 +1111,6 @@ EXPORT_SYMBOL(snd_pcm_link_rwlock);
 EXPORT_SYMBOL(snd_pcm_suspend);
 EXPORT_SYMBOL(snd_pcm_suspend_all);
 #endif
-EXPORT_SYMBOL(snd_pcm_kernel_playback_ioctl);
-EXPORT_SYMBOL(snd_pcm_kernel_capture_ioctl);
 EXPORT_SYMBOL(snd_pcm_kernel_ioctl);
 EXPORT_SYMBOL(snd_pcm_mmap_data);
 #if SNDRV_PCM_INFO_MMAP_IOMEM
index 7010eb271cc70851ccc43b68e4dad204373c9b61..13efe39e4cc6892773d3230a95939237e839c4f6 100644 (file)
@@ -1313,7 +1313,7 @@ static struct action_ops snd_pcm_action_prepare = {
  *
  * Prepare the PCM substream to be triggerable.
  */
-int snd_pcm_prepare(struct snd_pcm_substream *substream)
+static int snd_pcm_prepare(struct snd_pcm_substream *substream)
 {
        int res;
        struct snd_card *card = substream->pcm->card;
@@ -2736,41 +2736,28 @@ static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd,
        return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg);
 }
 
-int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream,
-                                 unsigned int cmd, void *arg)
-{
-       mm_segment_t fs;
-       int result;
-       
-       fs = snd_enter_user();
-       result = snd_pcm_playback_ioctl1(substream, cmd, (void __user *)arg);
-       snd_leave_user(fs);
-       return result;
-}
-
-int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream,
-                                unsigned int cmd, void *arg)
+int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
+                        unsigned int cmd, void *arg)
 {
        mm_segment_t fs;
        int result;
        
        fs = snd_enter_user();
-       result = snd_pcm_capture_ioctl1(substream, cmd, (void __user *)arg);
-       snd_leave_user(fs);
-       return result;
-}
-
-int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
-                        unsigned int cmd, void *arg)
-{
        switch (substream->stream) {
        case SNDRV_PCM_STREAM_PLAYBACK:
-               return snd_pcm_kernel_playback_ioctl(substream, cmd, arg);
+               result = snd_pcm_playback_ioctl1(substream,
+                                                cmd, (void __user *)arg);
+               break;
        case SNDRV_PCM_STREAM_CAPTURE:
-               return snd_pcm_kernel_capture_ioctl(substream, cmd, arg);
+               result = snd_pcm_capture_ioctl1(substream,
+                                               cmd, (void __user *)arg);
+               break;
        default:
-               return -EINVAL;
+               result = -EINVAL;
+               break;
        }
+       snd_leave_user(fs);
+       return result;
 }
 
 static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count,