lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 13 Aug 2020 08:03:24 +0200
From:   Krzysztof Kozlowski <krzk@...nel.org>
To:     MyungJoo Ham <myungjoo.ham@...sung.com>,
        Chanwoo Choi <cw00.choi@...sung.com>,
        Rob Herring <robh+dt@...nel.org>,
        Vijai Kumar K <vijaikumar.kanagarajan@...il.com>,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH 08/11] extcon: ptn5150: Check current USB mode when
 probing

On Wed, Aug 12, 2020 at 06:29:55PM +0200, Krzysztof Kozlowski wrote:
> When machine boots up, the USB could be already in OTG mode.  In such
> case there will be no interrupt coming to ptn5150 device and driver will
> report default state of nothing connected.  Detection of USB connection
> would happen on first unplug of the cable.
> 
> Factor out code for checking current connection mode and call it right
> after probe so the existing USB mode will be properly reported.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
> ---
>  drivers/extcon/extcon-ptn5150.c | 93 ++++++++++++++++++---------------
>  1 file changed, 50 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c
> index a57fef384a29..bbb185378e4b 100644
> --- a/drivers/extcon/extcon-ptn5150.c
> +++ b/drivers/extcon/extcon-ptn5150.c
> @@ -5,6 +5,7 @@
>  // Based on extcon-sm5502.c driver
>  // Copyright (c) 2018-2019 by Vijai Kumar K
>  // Author: Vijai Kumar K <vijaikumar.kanagarajan@...il.com>
> +// Copyright (c) 2020 Krzysztof Kozlowski <krzk@...nel.org>
>  
>  #include <linux/err.h>
>  #include <linux/i2c.h>
> @@ -83,12 +84,50 @@ static const struct regmap_config ptn5150_regmap_config = {
>  	.max_register	= PTN5150_REG_END,
>  };
>  
> +static void ptn5150_check_state(struct ptn5150_info *info)
> +{
> +	unsigned int port_status, reg_data, vbus;
> +	int ret;
> +
> +	ret = regmap_read(info->regmap, PTN5150_REG_CC_STATUS, &reg_data);
> +	if (ret) {
> +		dev_err(info->dev, "failed to read CC STATUS %d\n", ret);
> +		mutex_unlock(&info->mutex);

There is a double mutex unlock here, I'll send a v2.

Best regards,
Krzysztof

Powered by blists - more mailing lists