aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKarsten Wiese <annabellesgarden@yahoo.de>2005-08-10 05:18:19 -0400
committerJaroslav Kysela <perex@suse.cz>2005-08-30 02:44:48 -0400
commit443feb882679e21ba5d1e0ff9eff067ac26d9461 (patch)
treedf831615407843f4c33a16adc9efe841ec70aa46 /sound
parent9bcf655109ae06a8e652671a0de6fe2da5c213c2 (diff)
[ALSA] ALSA's struct _snd_pcm_substream: Obsolete open_flag
PCM Midlevel,ALSA<-OSS emulation,USB USX2Y This patch removes open_flag from struct _snd_pcm_substream. All of its uses are substituted by querying struct _snd_pcm_substream's member ffile instead. Signed-off-by: Karsten Wiese <annabellesgarden@yahoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/oss/pcm_oss.c11
-rw-r--r--sound/core/pcm_lib.c16
-rw-r--r--sound/core/pcm_native.c10
-rw-r--r--sound/usb/usx2y/usx2yhwdeppcm.c2
4 files changed, 22 insertions, 17 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index de7444c586f9..a13bd7bb4c9f 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1705,13 +1705,12 @@ static int snd_pcm_oss_release_file(snd_pcm_oss_file_t *pcm_oss_file)
1705 if (snd_pcm_running(substream)) 1705 if (snd_pcm_running(substream))
1706 snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); 1706 snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
1707 snd_pcm_stream_unlock_irq(substream); 1707 snd_pcm_stream_unlock_irq(substream);
1708 if (substream->open_flag) { 1708 if (substream->ffile != NULL) {
1709 if (substream->ops->hw_free != NULL) 1709 if (substream->ops->hw_free != NULL)
1710 substream->ops->hw_free(substream); 1710 substream->ops->hw_free(substream);
1711 substream->ops->close(substream); 1711 substream->ops->close(substream);
1712 substream->open_flag = 0; 1712 substream->ffile = NULL;
1713 } 1713 }
1714 substream->ffile = NULL;
1715 snd_pcm_oss_release_substream(substream); 1714 snd_pcm_oss_release_substream(substream);
1716 snd_pcm_release_substream(substream); 1715 snd_pcm_release_substream(substream);
1717 } 1716 }
@@ -1778,14 +1777,13 @@ static int snd_pcm_oss_open_file(struct file *file,
1778 snd_pcm_oss_release_file(pcm_oss_file); 1777 snd_pcm_oss_release_file(pcm_oss_file);
1779 return err; 1778 return err;
1780 } 1779 }
1781 psubstream->open_flag = 1; 1780 psubstream->ffile = file;
1782 err = snd_pcm_hw_constraints_complete(psubstream); 1781 err = snd_pcm_hw_constraints_complete(psubstream);
1783 if (err < 0) { 1782 if (err < 0) {
1784 snd_printd("snd_pcm_hw_constraint_complete failed\n"); 1783 snd_printd("snd_pcm_hw_constraint_complete failed\n");
1785 snd_pcm_oss_release_file(pcm_oss_file); 1784 snd_pcm_oss_release_file(pcm_oss_file);
1786 return err; 1785 return err;
1787 } 1786 }
1788 psubstream->ffile = file;
1789 snd_pcm_oss_init_substream(psubstream, psetup, minor); 1787 snd_pcm_oss_init_substream(psubstream, psetup, minor);
1790 } 1788 }
1791 if (csubstream != NULL) { 1789 if (csubstream != NULL) {
@@ -1800,14 +1798,13 @@ static int snd_pcm_oss_open_file(struct file *file,
1800 snd_pcm_oss_release_file(pcm_oss_file); 1798 snd_pcm_oss_release_file(pcm_oss_file);
1801 return err; 1799 return err;
1802 } 1800 }
1803 csubstream->open_flag = 1; 1801 csubstream->ffile = file;
1804 err = snd_pcm_hw_constraints_complete(csubstream); 1802 err = snd_pcm_hw_constraints_complete(csubstream);
1805 if (err < 0) { 1803 if (err < 0) {
1806 snd_printd("snd_pcm_hw_constraint_complete failed\n"); 1804 snd_printd("snd_pcm_hw_constraint_complete failed\n");
1807 snd_pcm_oss_release_file(pcm_oss_file); 1805 snd_pcm_oss_release_file(pcm_oss_file);
1808 return err; 1806 return err;
1809 } 1807 }
1810 csubstream->ffile = file;
1811 snd_pcm_oss_init_substream(csubstream, csetup, minor); 1808 snd_pcm_oss_init_substream(csubstream, csetup, minor);
1812 } 1809 }
1813 1810
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index c5bfd0918cff..c41ec2e9f201 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -2063,7 +2063,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
2063 if (((avail < runtime->control->avail_min && size > avail) || 2063 if (((avail < runtime->control->avail_min && size > avail) ||
2064 (size >= runtime->xfer_align && avail < runtime->xfer_align))) { 2064 (size >= runtime->xfer_align && avail < runtime->xfer_align))) {
2065 wait_queue_t wait; 2065 wait_queue_t wait;
2066 enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED } state; 2066 enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state;
2067 long tout; 2067 long tout;
2068 2068
2069 if (nonblock) { 2069 if (nonblock) {
@@ -2097,6 +2097,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
2097 case SNDRV_PCM_STATE_SUSPENDED: 2097 case SNDRV_PCM_STATE_SUSPENDED:
2098 state = SUSPENDED; 2098 state = SUSPENDED;
2099 goto _end_loop; 2099 goto _end_loop;
2100 case SNDRV_PCM_STATE_SETUP:
2101 state = DROPPED;
2102 goto _end_loop;
2100 default: 2103 default:
2101 break; 2104 break;
2102 } 2105 }
@@ -2123,6 +2126,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream,
2123 snd_printd("playback write error (DMA or IRQ trouble?)\n"); 2126 snd_printd("playback write error (DMA or IRQ trouble?)\n");
2124 err = -EIO; 2127 err = -EIO;
2125 goto _end_unlock; 2128 goto _end_unlock;
2129 case DROPPED:
2130 err = -EBADFD;
2131 goto _end_unlock;
2126 default: 2132 default:
2127 break; 2133 break;
2128 } 2134 }
@@ -2359,7 +2365,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream,
2359 } else if ((avail < runtime->control->avail_min && size > avail) || 2365 } else if ((avail < runtime->control->avail_min && size > avail) ||
2360 (size >= runtime->xfer_align && avail < runtime->xfer_align)) { 2366 (size >= runtime->xfer_align && avail < runtime->xfer_align)) {
2361 wait_queue_t wait; 2367 wait_queue_t wait;
2362 enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED } state; 2368 enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state;
2363 long tout; 2369 long tout;
2364 2370
2365 if (nonblock) { 2371 if (nonblock) {
@@ -2394,6 +2400,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream,
2394 goto _end_loop; 2400 goto _end_loop;
2395 case SNDRV_PCM_STATE_DRAINING: 2401 case SNDRV_PCM_STATE_DRAINING:
2396 goto __draining; 2402 goto __draining;
2403 case SNDRV_PCM_STATE_SETUP:
2404 state = DROPPED;
2405 goto _end_loop;
2397 default: 2406 default:
2398 break; 2407 break;
2399 } 2408 }
@@ -2420,6 +2429,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream,
2420 snd_printd("capture read error (DMA or IRQ trouble?)\n"); 2429 snd_printd("capture read error (DMA or IRQ trouble?)\n");
2421 err = -EIO; 2430 err = -EIO;
2422 goto _end_unlock; 2431 goto _end_unlock;
2432 case DROPPED:
2433 err = -EBADFD;
2434 goto _end_unlock;
2423 default: 2435 default:
2424 break; 2436 break;
2425 } 2437 }
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 10c2c9832649..5041be25d75b 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1967,13 +1967,12 @@ static int snd_pcm_release_file(snd_pcm_file_t * pcm_file)
1967 runtime = substream->runtime; 1967 runtime = substream->runtime;
1968 str = substream->pstr; 1968 str = substream->pstr;
1969 snd_pcm_unlink(substream); 1969 snd_pcm_unlink(substream);
1970 if (substream->open_flag) { 1970 if (substream->ffile != NULL) {
1971 if (substream->ops->hw_free != NULL) 1971 if (substream->ops->hw_free != NULL)
1972 substream->ops->hw_free(substream); 1972 substream->ops->hw_free(substream);
1973 substream->ops->close(substream); 1973 substream->ops->close(substream);
1974 substream->open_flag = 0; 1974 substream->ffile = NULL;
1975 } 1975 }
1976 substream->ffile = NULL;
1977 snd_pcm_remove_file(str, pcm_file); 1976 snd_pcm_remove_file(str, pcm_file);
1978 snd_pcm_release_substream(substream); 1977 snd_pcm_release_substream(substream);
1979 kfree(pcm_file); 1978 kfree(pcm_file);
@@ -2022,18 +2021,15 @@ static int snd_pcm_open_file(struct file *file,
2022 snd_pcm_release_file(pcm_file); 2021 snd_pcm_release_file(pcm_file);
2023 return err; 2022 return err;
2024 } 2023 }
2025 substream->open_flag = 1; 2024 substream->ffile = file;
2026 2025
2027 err = snd_pcm_hw_constraints_complete(substream); 2026 err = snd_pcm_hw_constraints_complete(substream);
2028 if (err < 0) { 2027 if (err < 0) {
2029 snd_printd("snd_pcm_hw_constraints_complete failed\n"); 2028 snd_printd("snd_pcm_hw_constraints_complete failed\n");
2030 substream->ops->close(substream);
2031 snd_pcm_release_file(pcm_file); 2029 snd_pcm_release_file(pcm_file);
2032 return err; 2030 return err;
2033 } 2031 }
2034 2032
2035 substream->ffile = file;
2036
2037 file->private_data = pcm_file; 2033 file->private_data = pcm_file;
2038 *rpcm_file = pcm_file; 2034 *rpcm_file = pcm_file;
2039 return 0; 2035 return 0;
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index ef28061287f2..d0199c4e5551 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -624,7 +624,7 @@ static int usX2Y_pcms_lock_check(snd_card_t *card)
624 for (s = 0; s < 2; ++s) { 624 for (s = 0; s < 2; ++s) {
625 snd_pcm_substream_t *substream; 625 snd_pcm_substream_t *substream;
626 substream = pcm->streams[s].substream; 626 substream = pcm->streams[s].substream;
627 if (substream && substream->open_flag) 627 if (substream && substream->ffile != NULL)
628 err = -EBUSY; 628 err = -EBUSY;
629 } 629 }
630 } 630 }