mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Scott Collyer <scollyer@google.com>
Cc: Benson Leung <bleung@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] platform/chrome: cros_ec_ishtp: report EC_HOST_EVENT_PANIC to userspace
Date: Thu, 29 Oct 2026 02:58:15 +0000	[thread overview]
Message-ID: <auK2R5uStmMO79r0@google.com> (raw)
In-Reply-To: <20261028220414.1414481-1-scollyer@google.com>

On Wed, Oct 28, 2026 at 03:04:14PM -0700, Scott Collyer wrote:
> +static int cros_ec_ishtp_event(struct notifier_block *nb,
> +			       unsigned long queued_during_suspend,
> +			       void *data)
> +{
> +	struct ishtp_cl_data *client_data =
> +		container_of(nb, struct ishtp_cl_data, notifier);
> +	struct cros_ec_device *ec_dev = data;
> +	u32 host_event = cros_ec_get_host_event(ec_dev);
> +
> +	if (host_event & EC_HOST_EVENT_MASK(EC_HOST_EVENT_PANIC)) {
> +		static const char * const panic_env[] = { "ERROR=PANIC", NULL };
> +
> +		dev_emerg(cl_data_to_dev(client_data), "CrOS ISH Panic Reported\n");

Use `ec_dev->dev` instead of `cl_data_to_dev(client_data)` so that the
`client_data` lookup can be dropped.

> @@ -555,7 +581,20 @@ static int cros_ec_dev_init(struct ishtp_cl_data *client_data)
>  	ec_dev->pkt_xfer = cros_ec_pkt_xfer_ish;
>  	ec_dev->phys_name = dev_name(dev);
>  
> -	return cros_ec_register(ec_dev);
> +	rv = cros_ec_register(ec_dev);
> +	if (rv)
> +		return rv;
> +
> +	client_data->notifier.notifier_call = cros_ec_ishtp_event;
> +	rv = blocking_notifier_chain_register(&ec_dev->event_notifier,
> +					      &client_data->notifier);
> +	if (rv) {
> +		dev_warn(dev, "failed to setup event notifier: %d\n", rv);
> +		cros_ec_unregister(ec_dev);
> +		return rv;
> +	}

cros_ec_register() already starts dispatching pending events before it
returns, so there is a small window where the notifier could miss them.
Please register the notifier before calling cros_ec_register().

      reply	other threads:[~2026-10-29  2:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 22:04 Scott Collyer
2026-10-29  2:58 ` Tzung-Bi Shih [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=auK2R5uStmMO79r0@google.com \
    --to=tzungbi@kernel.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scollyer@google.com \
    /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

all inboxes | Powered by JetHome®