/* PCM to create, set by hda_codec_ops.build_pcms callback */
struct list_head pcm_list_head;
- refcount_t pcm_ref;
- wait_queue_head_t remove_sleep;
+ struct snd_refcount pcm_ref;
/* codec specific info */
void *spec;
static inline void snd_hda_codec_pcm_get(struct hda_pcm *pcm)
{
- refcount_inc(&pcm->codec->pcm_ref);
+ snd_refcount_get(&pcm->codec->pcm_ref);
+}
+static inline void snd_hda_codec_pcm_put(struct hda_pcm *pcm)
+{
+ snd_refcount_put(&pcm->codec->pcm_ref);
}
-void snd_hda_codec_pcm_put(struct hda_pcm *pcm);
int snd_hda_codec_prepare(struct hda_codec *codec,
struct hda_pcm_stream *hinfo,
snd_hda_codec_disconnect_pcms(codec);
snd_hda_jack_tbl_disconnect(codec);
- if (!refcount_dec_and_test(&codec->pcm_ref))
- wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref));
+ snd_refcount_sync(&codec->pcm_ref);
snd_power_sync_ref(codec->bus->card);
if (driver->ops->remove)
/*
* PCM device
*/
-void snd_hda_codec_pcm_put(struct hda_pcm *pcm)
-{
- if (refcount_dec_and_test(&pcm->codec->pcm_ref))
- wake_up(&pcm->codec->remove_sleep);
-}
-EXPORT_SYMBOL_GPL(snd_hda_codec_pcm_put);
-
struct hda_pcm *snd_hda_codec_pcm_new(struct hda_codec *codec,
const char *fmt, ...)
{
}
list_add_tail(&pcm->list, &codec->pcm_list_head);
- refcount_inc(&codec->pcm_ref);
+ snd_hda_codec_pcm_get(pcm);
return pcm;
}
EXPORT_SYMBOL_GPL(snd_hda_codec_pcm_new);
remove_conn_list(codec);
snd_hdac_regmap_exit(&codec->core);
codec->configured = 0;
- refcount_set(&codec->pcm_ref, 1); /* reset refcount */
+ snd_refcount_init(&codec->pcm_ref); /* reset refcount */
}
EXPORT_SYMBOL_GPL(snd_hda_codec_cleanup_for_unbind);
INIT_LIST_HEAD(&codec->conn_list);
INIT_LIST_HEAD(&codec->pcm_list_head);
INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work);
- refcount_set(&codec->pcm_ref, 1);
- init_waitqueue_head(&codec->remove_sleep);
+ snd_refcount_init(&codec->pcm_ref);
return codec;
}