Re: [PATCH v2] platform/chrome: cros_ec_ishtp: report EC_HOST_EVENT_PANIC to userspace
From: Tzung-Bi Shih
Date: Wed Oct 28 2026 - 22:58:23 EST
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().