All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benson Leung <bleung@google.com>
To: Prashant Malani <pmalani@chromium.org>
Cc: linux-kernel@vger.kernel.org, Benson Leung <bleung@chromium.org>,
	Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Guenter Roeck <groeck@chromium.org>
Subject: Re: [PATCH 1/2] platform/chrome: cros_ec_proto: Update feature check
Date: Mon, 23 Aug 2021 10:30:51 -0700	[thread overview]
Message-ID: <YSPbS6By2DWbpZy+@google.com> (raw)
In-Reply-To: <20210802184711.3872372-1-pmalani@chromium.org>

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

Hi Prashant,

On Mon, Aug 02, 2021 at 11:47:10AM -0700, Prashant Malani wrote:
> EC feature flags now require more than 32 bits to be represented. In
> order to make cros_ec_check_features() usable for more recent features,
> update it to account for the extra 32 bits of features.
> 
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

FYI, as discussed, this patch was dropped from the series.

> ---
>  drivers/platform/chrome/cros_ec_proto.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> index a7404d69b2d3..772edad80593 100644
> --- a/drivers/platform/chrome/cros_ec_proto.c
> +++ b/drivers/platform/chrome/cros_ec_proto.c
> @@ -813,6 +813,7 @@ EXPORT_SYMBOL(cros_ec_get_host_event);
>  int cros_ec_check_features(struct cros_ec_dev *ec, int feature)
>  {
>  	struct cros_ec_command *msg;
> +	u32 mask;
>  	int ret;
>  
>  	if (ec->features[0] == -1U && ec->features[1] == -1U) {
> @@ -839,7 +840,12 @@ int cros_ec_check_features(struct cros_ec_dev *ec, int feature)
>  		kfree(msg);
>  	}
>  
> -	return ec->features[feature / 32] & EC_FEATURE_MASK_0(feature);
> +	if (feature >= 32)
> +		mask = EC_FEATURE_MASK_1(feature);
> +	else
> +		mask = EC_FEATURE_MASK_0(feature);
> +
> +	return ec->features[feature / 32] & mask;
>  }
>  EXPORT_SYMBOL_GPL(cros_ec_check_features);
>  
> -- 
> 2.32.0.554.ge1b32706d8-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 --]

      parent reply	other threads:[~2021-08-23 17:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02 18:47 [PATCH 1/2] platform/chrome: cros_ec_proto: Update feature check Prashant Malani
2021-08-02 18:47 ` [PATCH 2/2] platform/chrome: cros_ec_typec: Use existing " Prashant Malani
2021-08-03 10:09   ` Enric Balletbo i Serra
2021-08-03 17:29     ` Prashant Malani
2021-08-23 17:30 ` Benson Leung [this message]

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=YSPbS6By2DWbpZy+@google.com \
    --to=bleung@google.com \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.