mirror of https://gitee.com/openkylin/linux.git
greybus: audio: Cleanup GB Audio bundle driver.
Remove unnecessary lock & list maintained in GB audio bundle driver Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
84e0e38744
commit
e6ab7a154c
|
@ -14,9 +14,6 @@
|
||||||
#include "audio_apbridgea.h"
|
#include "audio_apbridgea.h"
|
||||||
#include "audio_manager.h"
|
#include "audio_manager.h"
|
||||||
|
|
||||||
static DEFINE_MUTEX(gb_codec_list_lock);
|
|
||||||
static LIST_HEAD(gb_codec_list);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gb_snd management functions
|
* gb_snd management functions
|
||||||
*/
|
*/
|
||||||
|
@ -241,16 +238,13 @@ static int gb_audio_probe(struct gb_bundle *bundle,
|
||||||
if (bundle->num_cports < 2)
|
if (bundle->num_cports < 2)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
mutex_lock(&gb_codec_list_lock);
|
|
||||||
/*
|
/*
|
||||||
* There can be only one Management connection and any number of data
|
* There can be only one Management connection and any number of data
|
||||||
* connections.
|
* connections.
|
||||||
*/
|
*/
|
||||||
gbmodule = devm_kzalloc(dev, sizeof(*gbmodule), GFP_KERNEL);
|
gbmodule = devm_kzalloc(dev, sizeof(*gbmodule), GFP_KERNEL);
|
||||||
if (!gbmodule) {
|
if (!gbmodule)
|
||||||
mutex_unlock(&gb_codec_list_lock);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
gbmodule->num_data_connections = bundle->num_cports - 1;
|
gbmodule->num_data_connections = bundle->num_cports - 1;
|
||||||
mutex_init(&gbmodule->lock);
|
mutex_init(&gbmodule->lock);
|
||||||
|
@ -348,7 +342,6 @@ static int gb_audio_probe(struct gb_bundle *bundle,
|
||||||
gbmodule->manager_id = gb_audio_manager_add(&desc);
|
gbmodule->manager_id = gb_audio_manager_add(&desc);
|
||||||
|
|
||||||
dev_dbg(dev, "Add GB Audio device:%s\n", gbmodule->name);
|
dev_dbg(dev, "Add GB Audio device:%s\n", gbmodule->name);
|
||||||
mutex_unlock(&gb_codec_list_lock);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -378,7 +371,6 @@ static int gb_audio_probe(struct gb_bundle *bundle,
|
||||||
gb_connection_destroy(gbmodule->mgmt_connection);
|
gb_connection_destroy(gbmodule->mgmt_connection);
|
||||||
|
|
||||||
devm_kfree(dev, gbmodule);
|
devm_kfree(dev, gbmodule);
|
||||||
mutex_unlock(&gb_codec_list_lock);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -388,8 +380,6 @@ static void gb_audio_disconnect(struct gb_bundle *bundle)
|
||||||
struct gbaudio_module_info *gbmodule = greybus_get_drvdata(bundle);
|
struct gbaudio_module_info *gbmodule = greybus_get_drvdata(bundle);
|
||||||
struct gbaudio_data_connection *dai, *_dai;
|
struct gbaudio_data_connection *dai, *_dai;
|
||||||
|
|
||||||
mutex_lock(&gb_codec_list_lock);
|
|
||||||
|
|
||||||
gbaudio_unregister_module(gbmodule);
|
gbaudio_unregister_module(gbmodule);
|
||||||
|
|
||||||
/* inform uevent to above layers */
|
/* inform uevent to above layers */
|
||||||
|
@ -409,7 +399,6 @@ static void gb_audio_disconnect(struct gb_bundle *bundle)
|
||||||
gbmodule->mgmt_connection = NULL;
|
gbmodule->mgmt_connection = NULL;
|
||||||
|
|
||||||
devm_kfree(&bundle->dev, gbmodule);
|
devm_kfree(&bundle->dev, gbmodule);
|
||||||
mutex_unlock(&gb_codec_list_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct greybus_bundle_id gb_audio_id_table[] = {
|
static const struct greybus_bundle_id gb_audio_id_table[] = {
|
||||||
|
|
Loading…
Reference in New Issue