From 2b8c2b51000e3d056f9aa27a64b93feabddf77a4 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Thu, 21 Apr 2016 22:14:02 +0530 Subject: [PATCH] greybus: audio: Changes in response to ASoC cleanup Update Makefile in response to SND_SOC_DYNAMIC_DAILINK cflag removal. Update files for msm-dynamic-dailink.h header file removal. Update in response to API name changes. Also, acquire sound card controls_rwsem before adding kcontrols to avoid deadlock. Signed-off-by: Vaibhav Agarwal Reviewed-by: Mark Greer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/Makefile | 6 ++---- drivers/staging/greybus/audio_codec.c | 11 +++++++++-- drivers/staging/greybus/audio_module.c | 1 - 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Makefile index 8ec607460ec0..5bdccccbe171 100644 --- a/drivers/staging/greybus/Makefile +++ b/drivers/staging/greybus/Makefile @@ -52,11 +52,9 @@ obj-m += gb-es2.o ifeq ($(CONFIG_USB_HSIC_USB3613),y) obj-m += gb-arche.o endif -ifeq ($(CONFIG_SND_SOC_DYNAMIC_DAILINK),y) - obj-m += gb-audio-codec.o -obj-m += gb-audio-module.o -endif ifeq ($(CONFIG_ARCH_MSM8994),y) + obj-m += gb-audio-codec.o + obj-m += gb-audio-module.o obj-m += gb-camera.o endif obj-m += gb-audio-gb.o diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index 20feea1c64d3..a2b81ba78196 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -898,6 +898,7 @@ int gbaudio_register_module(struct gbaudio_module_info *module) { int ret; struct snd_soc_codec *codec; + struct snd_card *card; struct snd_soc_jack *jack = NULL; if (!gbcodec) { @@ -906,6 +907,9 @@ int gbaudio_register_module(struct gbaudio_module_info *module) } codec = gbcodec->codec; + card = codec->card->snd_card; + + down_write(&card->controls_rwsem); mutex_lock(&gbcodec->lock); if (module->num_dais) { @@ -913,12 +917,14 @@ int gbaudio_register_module(struct gbaudio_module_info *module) "%d:DAIs not supported via gbcodec driver\n", module->num_dais); mutex_unlock(&gbcodec->lock); + up_write(&card->controls_rwsem); return -EINVAL; } ret = gbaudio_init_jack(module, codec); if (ret) { mutex_unlock(&gbcodec->lock); + up_write(&card->controls_rwsem); return ret; } @@ -936,7 +942,7 @@ int gbaudio_register_module(struct gbaudio_module_info *module) if (codec->card->instantiated) { ret = snd_soc_dapm_new_widgets(&codec->dapm); if (!ret) - snd_soc_dapm_link_dai_widgets_component(codec->card, + snd_soc_dapm_link_component_dai_widgets(codec->card, &codec->dapm); } @@ -953,6 +959,7 @@ int gbaudio_register_module(struct gbaudio_module_info *module) dev_dbg(codec->dev, "Registered %s module\n", module->name); mutex_unlock(&gbcodec->lock); + up_write(&card->controls_rwsem); return 0; } EXPORT_SYMBOL(gbaudio_register_module); @@ -1061,7 +1068,7 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) if (module->controls) { dev_dbg(codec->dev, "Removing %d controls\n", module->num_controls); - soc_remove_codec_controls(codec, module->controls, + snd_soc_remove_codec_controls(codec, module->controls, module->num_controls); } if (module->dapm_widgets) { diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c index dd43b6d5ae07..bdc5ec50b30b 100644 --- a/drivers/staging/greybus/audio_module.c +++ b/drivers/staging/greybus/audio_module.c @@ -9,7 +9,6 @@ #include #include #include -#include #include "audio_codec.h" #include "audio_apbridgea.h" -- 2.20.1