diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-03-27 09:22:45 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-31 10:58:58 -0500 |
commit | bf1bbb5a49eec51c30d341606885507b501b37e8 (patch) | |
tree | 934916bcb3f5b1bb755450a6abb4c9242b5f60b9 /sound/core | |
parent | 82756b2785c5f08204e7f3dab64e12d4533bfe89 (diff) |
[ALSA] Tiny clean up of PCM codes
- Make snd_pcm_prepare() static
- Clean up snd_pcm_kernel_*_ioctl() functions, reduce exports
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/oss/pcm_oss.c | 16 | ||||
-rw-r--r-- | sound/core/pcm.c | 2 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 39 |
3 files changed, 21 insertions, 36 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index f8302b703a30..54be0bba6bd2 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -959,12 +959,12 @@ static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file) | |||
959 | 959 | ||
960 | substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; | 960 | substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; |
961 | if (substream != NULL) { | 961 | if (substream != NULL) { |
962 | snd_pcm_kernel_playback_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); | 962 | snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); |
963 | substream->runtime->oss.prepare = 1; | 963 | substream->runtime->oss.prepare = 1; |
964 | } | 964 | } |
965 | substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; | 965 | substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; |
966 | if (substream != NULL) { | 966 | if (substream != NULL) { |
967 | snd_pcm_kernel_capture_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); | 967 | snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); |
968 | substream->runtime->oss.prepare = 1; | 968 | substream->runtime->oss.prepare = 1; |
969 | } | 969 | } |
970 | return 0; | 970 | return 0; |
@@ -979,7 +979,7 @@ static int snd_pcm_oss_post(struct snd_pcm_oss_file *pcm_oss_file) | |||
979 | if (substream != NULL) { | 979 | if (substream != NULL) { |
980 | if ((err = snd_pcm_oss_make_ready(substream)) < 0) | 980 | if ((err = snd_pcm_oss_make_ready(substream)) < 0) |
981 | return err; | 981 | return err; |
982 | snd_pcm_kernel_playback_ioctl(substream, SNDRV_PCM_IOCTL_START, NULL); | 982 | snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_START, NULL); |
983 | } | 983 | } |
984 | /* note: all errors from the start action are ignored */ | 984 | /* note: all errors from the start action are ignored */ |
985 | /* OSS apps do not know, how to handle them */ | 985 | /* 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) | |||
1108 | __direct: | 1108 | __direct: |
1109 | saved_f_flags = substream->ffile->f_flags; | 1109 | saved_f_flags = substream->ffile->f_flags; |
1110 | substream->ffile->f_flags &= ~O_NONBLOCK; | 1110 | substream->ffile->f_flags &= ~O_NONBLOCK; |
1111 | err = snd_pcm_kernel_playback_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); | 1111 | err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL); |
1112 | substream->ffile->f_flags = saved_f_flags; | 1112 | substream->ffile->f_flags = saved_f_flags; |
1113 | if (err < 0) | 1113 | if (err < 0) |
1114 | return err; | 1114 | return err; |
@@ -1120,7 +1120,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file) | |||
1120 | if ((err = snd_pcm_oss_make_ready(substream)) < 0) | 1120 | if ((err = snd_pcm_oss_make_ready(substream)) < 0) |
1121 | return err; | 1121 | return err; |
1122 | runtime = substream->runtime; | 1122 | runtime = substream->runtime; |
1123 | err = snd_pcm_kernel_capture_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); | 1123 | err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); |
1124 | if (err < 0) | 1124 | if (err < 0) |
1125 | return err; | 1125 | return err; |
1126 | runtime->oss.buffer_used = 0; | 1126 | 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 | |||
1437 | cmd = SNDRV_PCM_IOCTL_DROP; | 1437 | cmd = SNDRV_PCM_IOCTL_DROP; |
1438 | runtime->oss.prepare = 1; | 1438 | runtime->oss.prepare = 1; |
1439 | } | 1439 | } |
1440 | err = snd_pcm_kernel_playback_ioctl(psubstream, cmd, NULL); | 1440 | err = snd_pcm_kernel_ioctl(psubstream, cmd, NULL); |
1441 | if (err < 0) | 1441 | if (err < 0) |
1442 | return err; | 1442 | return err; |
1443 | } | 1443 | } |
@@ -1458,7 +1458,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr | |||
1458 | cmd = SNDRV_PCM_IOCTL_DROP; | 1458 | cmd = SNDRV_PCM_IOCTL_DROP; |
1459 | runtime->oss.prepare = 1; | 1459 | runtime->oss.prepare = 1; |
1460 | } | 1460 | } |
1461 | err = snd_pcm_kernel_capture_ioctl(csubstream, cmd, NULL); | 1461 | err = snd_pcm_kernel_ioctl(csubstream, cmd, NULL); |
1462 | if (err < 0) | 1462 | if (err < 0) |
1463 | return err; | 1463 | return err; |
1464 | } | 1464 | } |
@@ -1495,7 +1495,7 @@ static int snd_pcm_oss_get_odelay(struct snd_pcm_oss_file *pcm_oss_file) | |||
1495 | runtime = substream->runtime; | 1495 | runtime = substream->runtime; |
1496 | if (runtime->oss.params || runtime->oss.prepare) | 1496 | if (runtime->oss.params || runtime->oss.prepare) |
1497 | return 0; | 1497 | return 0; |
1498 | err = snd_pcm_kernel_playback_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); | 1498 | err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); |
1499 | if (err == -EPIPE) | 1499 | if (err == -EPIPE) |
1500 | delay = 0; /* hack for broken OSS applications */ | 1500 | delay = 0; /* hack for broken OSS applications */ |
1501 | else if (err < 0) | 1501 | else if (err < 0) |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 3da6a38c2d0f..1e9878fed37f 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -1111,8 +1111,6 @@ EXPORT_SYMBOL(snd_pcm_link_rwlock); | |||
1111 | EXPORT_SYMBOL(snd_pcm_suspend); | 1111 | EXPORT_SYMBOL(snd_pcm_suspend); |
1112 | EXPORT_SYMBOL(snd_pcm_suspend_all); | 1112 | EXPORT_SYMBOL(snd_pcm_suspend_all); |
1113 | #endif | 1113 | #endif |
1114 | EXPORT_SYMBOL(snd_pcm_kernel_playback_ioctl); | ||
1115 | EXPORT_SYMBOL(snd_pcm_kernel_capture_ioctl); | ||
1116 | EXPORT_SYMBOL(snd_pcm_kernel_ioctl); | 1114 | EXPORT_SYMBOL(snd_pcm_kernel_ioctl); |
1117 | EXPORT_SYMBOL(snd_pcm_mmap_data); | 1115 | EXPORT_SYMBOL(snd_pcm_mmap_data); |
1118 | #if SNDRV_PCM_INFO_MMAP_IOMEM | 1116 | #if SNDRV_PCM_INFO_MMAP_IOMEM |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 7010eb271cc7..13efe39e4cc6 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1313,7 +1313,7 @@ static struct action_ops snd_pcm_action_prepare = { | |||
1313 | * | 1313 | * |
1314 | * Prepare the PCM substream to be triggerable. | 1314 | * Prepare the PCM substream to be triggerable. |
1315 | */ | 1315 | */ |
1316 | int snd_pcm_prepare(struct snd_pcm_substream *substream) | 1316 | static int snd_pcm_prepare(struct snd_pcm_substream *substream) |
1317 | { | 1317 | { |
1318 | int res; | 1318 | int res; |
1319 | struct snd_card *card = substream->pcm->card; | 1319 | struct snd_card *card = substream->pcm->card; |
@@ -2736,41 +2736,28 @@ static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd, | |||
2736 | return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg); | 2736 | return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg); |
2737 | } | 2737 | } |
2738 | 2738 | ||
2739 | int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream, | 2739 | int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, |
2740 | unsigned int cmd, void *arg) | 2740 | unsigned int cmd, void *arg) |
2741 | { | ||
2742 | mm_segment_t fs; | ||
2743 | int result; | ||
2744 | |||
2745 | fs = snd_enter_user(); | ||
2746 | result = snd_pcm_playback_ioctl1(substream, cmd, (void __user *)arg); | ||
2747 | snd_leave_user(fs); | ||
2748 | return result; | ||
2749 | } | ||
2750 | |||
2751 | int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream, | ||
2752 | unsigned int cmd, void *arg) | ||
2753 | { | 2741 | { |
2754 | mm_segment_t fs; | 2742 | mm_segment_t fs; |
2755 | int result; | 2743 | int result; |
2756 | 2744 | ||
2757 | fs = snd_enter_user(); | 2745 | fs = snd_enter_user(); |
2758 | result = snd_pcm_capture_ioctl1(substream, cmd, (void __user *)arg); | ||
2759 | snd_leave_user(fs); | ||
2760 | return result; | ||
2761 | } | ||
2762 | |||
2763 | int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, | ||
2764 | unsigned int cmd, void *arg) | ||
2765 | { | ||
2766 | switch (substream->stream) { | 2746 | switch (substream->stream) { |
2767 | case SNDRV_PCM_STREAM_PLAYBACK: | 2747 | case SNDRV_PCM_STREAM_PLAYBACK: |
2768 | return snd_pcm_kernel_playback_ioctl(substream, cmd, arg); | 2748 | result = snd_pcm_playback_ioctl1(substream, |
2749 | cmd, (void __user *)arg); | ||
2750 | break; | ||
2769 | case SNDRV_PCM_STREAM_CAPTURE: | 2751 | case SNDRV_PCM_STREAM_CAPTURE: |
2770 | return snd_pcm_kernel_capture_ioctl(substream, cmd, arg); | 2752 | result = snd_pcm_capture_ioctl1(substream, |
2753 | cmd, (void __user *)arg); | ||
2754 | break; | ||
2771 | default: | 2755 | default: |
2772 | return -EINVAL; | 2756 | result = -EINVAL; |
2757 | break; | ||
2773 | } | 2758 | } |
2759 | snd_leave_user(fs); | ||
2760 | return result; | ||
2774 | } | 2761 | } |
2775 | 2762 | ||
2776 | static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, | 2763 | static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, |