greybus: audio: use variable 'is_connected' to maintain module state
authorVaibhav Agarwal <vaibhav.agarwal@linaro.org>
Thu, 28 Jan 2016 15:45:40 +0000 (21:15 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 3 Feb 2016 05:46:54 +0000 (21:46 -0800)
commit3994e0b139c709047cdeb44b6c28cfb39f89f3f2
tree6cd7caf1fd59c104d0c0431adb80ef657d0eb973
parent796fad441cb248c1eac88bfb3a5929bb1a10fabb
greybus: audio: use variable 'is_connected' to maintain module state

there is race condition between _disconnect() request &
stop_trigger() in case of abrupt module removal.
And sometimes this can lead to deadlock while acquiring
codec_info->lock.
To avoid such situation, atomic variable is used to maintain
codec connected state.
During dai operations (trigger, shutdown, etc.), 'is_connected'
variable is validated to avoid unnecessary lock acquire in
case module already removed.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/audio_codec.c
drivers/staging/greybus/audio_codec.h
drivers/staging/greybus/audio_topology.c