aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
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 /include/sound
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 'include/sound')
-rw-r--r--include/sound/pcm.h81
1 files changed, 12 insertions, 69 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index bc79962f4aa6..67e0bdb9f0fa 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -494,9 +494,6 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
494 * Native I/O 494 * Native I/O
495 */ 495 */
496 496
497extern rwlock_t snd_pcm_link_rwlock;
498extern struct rw_semaphore snd_pcm_link_rwsem;
499
500int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info); 497int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info);
501int snd_pcm_info_user(struct snd_pcm_substream *substream, 498int snd_pcm_info_user(struct snd_pcm_substream *substream,
502 struct snd_pcm_info __user *info); 499 struct snd_pcm_info __user *info);
@@ -540,72 +537,18 @@ static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
540 return substream->group != &substream->self_group; 537 return substream->group != &substream->self_group;
541} 538}
542 539
543static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream) 540void snd_pcm_stream_lock(struct snd_pcm_substream *substream);
544{ 541void snd_pcm_stream_unlock(struct snd_pcm_substream *substream);
545 if (substream->pcm->nonatomic) { 542void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);
546 down_read(&snd_pcm_link_rwsem); 543void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
547 mutex_lock(&substream->self_group.mutex); 544unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
548 } else { 545#define snd_pcm_stream_lock_irqsave(substream, flags) \
549 read_lock(&snd_pcm_link_rwlock); 546 do { \
550 spin_lock(&substream->self_group.lock); 547 typecheck(unsigned long, flags); \
551 } 548 flags = _snd_pcm_stream_lock_irqsave(substream); \
552} 549 } while (0)
553 550void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
554static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) 551 unsigned long flags);
555{
556 if (substream->pcm->nonatomic) {
557 mutex_unlock(&substream->self_group.mutex);
558 up_read(&snd_pcm_link_rwsem);
559 } else {
560 spin_unlock(&substream->self_group.lock);
561 read_unlock(&snd_pcm_link_rwlock);
562 }
563}
564
565static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream)
566{
567 if (substream->pcm->nonatomic) {
568 down_read(&snd_pcm_link_rwsem);
569 mutex_lock(&substream->self_group.mutex);
570 } else {
571 read_lock_irq(&snd_pcm_link_rwlock);
572 spin_lock(&substream->self_group.lock);
573 }
574}
575
576static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream)
577{
578 if (substream->pcm->nonatomic) {
579 mutex_unlock(&substream->self_group.mutex);
580 up_read(&snd_pcm_link_rwsem);
581 } else {
582 spin_unlock(&substream->self_group.lock);
583 read_unlock_irq(&snd_pcm_link_rwlock);
584 }
585}
586
587#define snd_pcm_stream_lock_irqsave(substream, flags) \
588do { \
589 if ((substream)->pcm->nonatomic) { \
590 (flags) = 0; /* XXX for avoid warning */ \
591 down_read(&snd_pcm_link_rwsem); \
592 mutex_lock(&(substream)->self_group.mutex); \
593 } else { \
594 read_lock_irqsave(&snd_pcm_link_rwlock, (flags)); \
595 spin_lock(&(substream)->self_group.lock); \
596 } \
597} while (0)
598
599#define snd_pcm_stream_unlock_irqrestore(substream, flags) \
600do { \
601 if ((substream)->pcm->nonatomic) { \
602 mutex_unlock(&(substream)->self_group.mutex); \
603 up_read(&snd_pcm_link_rwsem); \
604 } else { \
605 spin_unlock(&(substream)->self_group.lock); \
606 read_unlock_irqrestore(&snd_pcm_link_rwlock, (flags)); \
607 } \
608} while (0)
609 552
610#define snd_pcm_group_for_each_entry(s, substream) \ 553#define snd_pcm_group_for_each_entry(s, substream) \
611 list_for_each_entry(s, &substream->group->substreams, link_list) 554 list_for_each_entry(s, &substream->group->substreams, link_list)