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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZRaiuXnrPuEPBQZF@kuha.fi.intel.com>
Date:   Fri, 29 Sep 2023 13:11:05 +0300
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     Abdel Alkuor <alkuor@...il.com>
Cc:     krzysztof.kozlowski+dt@...aro.org, bryan.odonoghue@...aro.org,
        gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org, ryan.eleceng@...il.com,
        robh+dt@...nel.org, conor+dt@...nel.org,
        devicetree@...r.kernel.org, Abdel Alkuor <abdelalkuor@...tab.com>
Subject: Re: [PATCH v7 03/14] USB: typec: tps6598x: Add patch mode to tps6598x

On Wed, Sep 27, 2023 at 01:53:37PM -0400, Abdel Alkuor wrote:
> From: Abdel Alkuor <abdelalkuor@...tab.com>
> 
> TPS25750 has a patch mode indicating the device requires
> a configuration to get the device into operational mode
> 
> Signed-off-by: Abdel Alkuor <abdelalkuor@...tab.com>
> ---
> Changes in v7:
>   - Add driver name to commit subject
> Changes in v6:
>   - Return current mode and check it directly
> Changes in v5:
>   - Incorporating tps25750 into tps6598x driver
> 
>  drivers/usb/typec/tipd/core.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index 32420c61660d..58679b1c0cfe 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -68,6 +68,7 @@ enum {
>  	TPS_MODE_BOOT,
>  	TPS_MODE_BIST,
>  	TPS_MODE_DISC,
> +	TPS_MODE_PTCH,
>  };
>  
>  static const char *const modes[] = {
> @@ -75,6 +76,7 @@ static const char *const modes[] = {
>  	[TPS_MODE_BOOT]	= "BOOT",
>  	[TPS_MODE_BIST]	= "BIST",
>  	[TPS_MODE_DISC]	= "DISC",
> +	[TPS_MODE_PTCH] = "PTCH",
>  };
>  
>  /* Unrecognized commands will be replaced with "!CMD" */
> @@ -593,12 +595,15 @@ static int tps6598x_check_mode(struct tps6598x *tps)
>  	if (ret)
>  		return ret;
>  
> -	switch (match_string(modes, ARRAY_SIZE(modes), mode)) {
> +	ret = match_string(modes, ARRAY_SIZE(modes), mode);
> +
> +	switch (ret) {
>  	case TPS_MODE_APP:
> -		return 0;
> +	case TPS_MODE_PTCH:
> +		return ret;
>  	case TPS_MODE_BOOT:
>  		dev_warn(tps->dev, "dead-battery condition\n");
> -		return 0;
> +		return ret;
>  	case TPS_MODE_BIST:
>  	case TPS_MODE_DISC:
>  	default:
> @@ -765,7 +770,7 @@ static int tps6598x_probe(struct i2c_client *client)
>  	tps->irq_handler = irq_handler;
>  	/* Make sure the controller has application firmware running */
>  	ret = tps6598x_check_mode(tps);
> -	if (ret)
> +	if (ret < 0)
>  		return ret;

You are doing two things in this patch - you are adding PTCH mode, and
changing the meaning of the tps6598x_check_mode() return value. Please
make a note also about the latter in the commit message.

Or, just return the mode in the patch were you start using it in
tps6598x_probe().

Br,

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ