Chrome platform driver development
 help / color / mirror / Atom feed
From: Benson Leung <bleung@google.com>
To: Prashant Malani <pmalani@chromium.org>
Cc: linux-kernel@vger.kernel.org,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Benson Leung <bleung@chromium.org>,
	"open list:CHROMEOS EC USB TYPE-C DRIVER"
	<chrome-platform@lists.linux.dev>,
	Guenter Roeck <groeck@chromium.org>
Subject: Re: [PATCH] platform/chrome: cros_ec_typec: Make try power role optional
Date: Thu, 27 Jan 2022 22:20:52 -0800	[thread overview]
Message-ID: <YfOLRBGmwGKwCksR@google.com> (raw)
In-Reply-To: <20220127191659.3560810-1-pmalani@chromium.org>

[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]

Hi Prashant,

On Thu, Jan 27, 2022 at 07:16:59PM +0000, Prashant Malani wrote:
> Some boards prefer not to specify a try-power-role. Update the port
> property parsing logic to not error out in case a try-power-role is not
> specified.
> 
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

This looks good to me.

Heikki, if this usage of TYPEC_NO_PREFERRED_ROLE looks good to you, I can
merge it.

Benson

> ---
>  drivers/platform/chrome/cros_ec_typec.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 5de0bfb0bc4d..ee12658009e5 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -115,17 +115,18 @@ static int cros_typec_parse_port_props(struct typec_capability *cap,
>  		return ret;
>  	cap->data = ret;
>  
> +	/* Try-power-role is optional. */
>  	ret = fwnode_property_read_string(fwnode, "try-power-role", &buf);
>  	if (ret) {
> -		dev_err(dev, "try-power-role not found: %d\n", ret);
> -		return ret;
> +		dev_warn(dev, "try-power-role not found: %d\n", ret);
> +		cap->prefer_role = TYPEC_NO_PREFERRED_ROLE;
> +	} else {
> +		ret = typec_find_power_role(buf);
> +		if (ret < 0)
> +			return ret;
> +		cap->prefer_role = ret;
>  	}
>  
> -	ret = typec_find_power_role(buf);
> -	if (ret < 0)
> -		return ret;
> -	cap->prefer_role = ret;
> -
>  	cap->fwnode = fwnode;
>  
>  	return 0;
> -- 
> 2.35.0.rc0.227.g00780c9af4-goog
> 

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2022-01-28  6:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 19:16 [PATCH] platform/chrome: cros_ec_typec: Make try power role optional Prashant Malani
2022-01-28  6:20 ` Benson Leung [this message]
2022-01-31  8:48   ` Heikki Krogerus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YfOLRBGmwGKwCksR@google.com \
    --to=bleung@google.com \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmalani@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox