lkml.org 
[lkml]   [2013]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] extcon: arizona: Fix race with microphone detection and removal
Date
The microphone detection code is run as delayed work to provide
additional debounce, it is possible that the jack could have been
removed by the time we process the microphone detection. Turn this case
into a no op.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

As Lee Jones took the first patch (extcon: arizona: Add
defines for microphone detection levels) of my series
yesterday through his tree I have based this patch on the
extcon tree without that change applied.

Thanks,
Charles

drivers/extcon/extcon-arizona.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index dac8ba0..9c20850 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -773,6 +773,12 @@ static void arizona_micd_detect(struct work_struct *work)

mutex_lock(&info->lock);

+ if (!info->cable) {
+ dev_dbg(arizona->dev, "Ignoring MICDET for removed cable\n");
+ mutex_unlock(&info->lock);
+ return;
+ }
+
for (i = 0; i < 10 && !(val & 0x7fc); i++) {
ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val);
if (ret != 0) {
--
1.7.2.5


\
 
 \ /
  Last update: 2013-10-27 17:41    [W:0.084 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site