aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-09-01 05:19:37 -0400
committerTakashi Iwai <tiwai@suse.de>2014-09-03 08:04:18 -0400
commit7af142f752116e86adbe2073f2922d8265a77709 (patch)
tree160e8e0b8c93fa08031100663e0de239138dc589 /sound/core
parent257f8cce5d40b811d229ed71602882baa0012808 (diff)
ALSA: pcm: Uninline snd_pcm_stream_lock() and _unlock()
The previous commit for the non-atomic PCM ops added more codes to snd_pcm_stream_lock() and its variants. Since they are inlined functions, it resulted in a significant code size bloat. For reducing the size bloat, this patch changes the inline functions to the normal function calls. The export of rwlock and rwsem are removed as well, since they are referred only in pcm_native.c now. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_native.c64
1 files changed, 60 insertions, 4 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 16d9b7e15f8b..85fe1a216225 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -74,11 +74,67 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream);
74 * 74 *
75 */ 75 */
76 76
77DEFINE_RWLOCK(snd_pcm_link_rwlock); 77static DEFINE_RWLOCK(snd_pcm_link_rwlock);
78EXPORT_SYMBOL(snd_pcm_link_rwlock); 78static DECLARE_RWSEM(snd_pcm_link_rwsem);
79 79
80DECLARE_RWSEM(snd_pcm_link_rwsem); 80void snd_pcm_stream_lock(struct snd_pcm_substream *substream)
81EXPORT_SYMBOL(snd_pcm_link_rwsem); 81{
82 if (substream->pcm->nonatomic) {
83 down_read(&snd_pcm_link_rwsem);
84 mutex_lock(&substream->self_group.mutex);
85 } else {
86 read_lock(&snd_pcm_link_rwlock);
87 spin_lock(&substream->self_group.lock);
88 }
89}
90EXPORT_SYMBOL_GPL(snd_pcm_stream_lock);
91
92void snd_pcm_stream_unlock(struct snd_pcm_substream *substream)
93{
94 if (substream->pcm->nonatomic) {
95 mutex_unlock(&substream->self_group.mutex);
96 up_read(&snd_pcm_link_rwsem);
97 } else {
98 spin_unlock(&substream->self_group.lock);
99 read_unlock(&snd_pcm_link_rwlock);
100 }
101}
102EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock);
103
104void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream)
105{
106 if (!substream->pcm->nonatomic)
107 local_irq_disable();
108 snd_pcm_stream_lock(substream);
109}
110EXPORT_SYMBOL_GPL(snd_pcm_stream_lock_irq);
111
112void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream)
113{
114 snd_pcm_stream_unlock(substream);
115 if (!substream->pcm->nonatomic)
116 local_irq_enable();
117}
118EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock_irq);
119
120unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream)
121{
122 unsigned long flags = 0;
123 if (!substream->pcm->nonatomic)
124 local_irq_save(flags);
125 snd_pcm_stream_lock(substream);
126 return flags;
127}
128EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave);
129
130void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
131 unsigned long flags)
132{
133 snd_pcm_stream_unlock(substream);
134 if (!substream->pcm->nonatomic)
135 local_irq_restore(flags);
136}
137EXPORT_SYMBOL_GPL(snd_pcm_stream_unlock_irqrestore);
82 138
83static inline mm_segment_t snd_enter_user(void) 139static inline mm_segment_t snd_enter_user(void)
84{ 140{