Re: [PATCH v2 1/2] extcon: arizona: Fix reset of HPDET after race withremoval

From: Chanwoo Choi
Date: Sun Nov 03 2013 - 19:32:55 EST


Hi Charles,

On 10/28/2013 01:19 AM, Charles Keepax wrote:
> We need to make sure we reset back to our starting state, especially
> making sure that we have disabled poll in the register cache.
>
> Signed-off-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/extcon/extcon-arizona.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index ec9a14e..dac8ba0 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -596,9 +596,15 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
> dev_err(arizona->dev, "Failed to report HP/line: %d\n",
> ret);
>
> +done:
> + /* Reset back to starting range */
> + regmap_update_bits(arizona->regmap,
> + ARIZONA_HEADPHONE_DETECT_1,
> + ARIZONA_HP_IMPEDANCE_RANGE_MASK | ARIZONA_HP_POLL,
> + 0);
> +
> arizona_extcon_do_magic(info, 0);
>
> -done:
> if (id_gpio)
> gpio_set_value_cansleep(id_gpio, 0);
>
>

The arizona_hpdet_do_id() return only either -EAGIN or 0(zero).
extcon-arizona driver could never execute 'goto done;' statement.

ret = arizona_hpdet_do_id(info, &reading, &mic);
if (ret == -EAGAIN) {
goto out;
} else if (ret < 0) {
goto done;
}

Thanks,
Chanwoo Choi


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/