mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Myeonghun Pak <mhun512@gmail.com>
Cc: Benson Leung <bleung@chromium.org>,
	Abhishek Pandit-Subedi <abhishekpandit@chromium.org>,
	Jameson Thies <jthies@google.com>,
	Andrei Kuchynski <akuchynski@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Ijae Kim <ae878000@gmail.com>
Subject: Re: [PATCH] platform/chrome: cros_ec_typec: Stop altmode work before unregistering ports
Date: Mon, 28 Sep 2026 20:18:00 +0800	[thread overview]
Message-ID: <arpa-Ps8l8LOwbbx@tzungbi-laptop> (raw)
In-Reply-To: <20260917204209.97699-1-mhun512@gmail.com>

On Thu, Sep 17, 2026 at 04:42:09PM -0400, Myeonghun Pak wrote:
> partner altmodes. Disabling also prevents a partner callback from
> requeueing the work while its driver is being removed. Use the common

Would the work be scheduled even if the driver is about to remove()?

> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 50a68819ceb7bbfbd888ca919d678d4c75237c26..e91bbc219c077067294935dd5602c1aec636cfa6 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -378,6 +378,7 @@ static void cros_unregister_ports(struct cros_typec_data *typec)
>  		if (!typec->ports[i])
>  			continue;
>  
> +		cros_typec_altmodes_stop(typec->ports[i]);

Shouldn't this be called in cros_typec_unregister_port_altmodes()?

> diff --git a/drivers/platform/chrome/cros_typec_altmode.c b/drivers/platform/chrome/cros_typec_altmode.c
...
> +void cros_typec_altmodes_stop(struct cros_typec_port *port)
> +{
> +	struct cros_typec_altmode_data *adata;
> +	int i;
> +
> +	for (i = 0; i < CROS_EC_ALTMODE_MAX; i++) {
> +		if (!port->port_altmode[i])
> +			continue;
> +
> +		adata = typec_altmode_get_drvdata(port->port_altmode[i]);
> +		if (adata)
> +			disable_work_sync(&adata->work);

This is a driver teardown path: cancel_work_sync() should be sufficient.

      parent reply	other threads:[~2026-09-28 12:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 20:42 Myeonghun Pak
2026-09-21 23:52 ` Jameson Thies
2026-09-28 12:18 ` 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=arpa-Ps8l8LOwbbx@tzungbi-laptop \
    --to=tzungbi@kernel.org \
    --cc=abhishekpandit@chromium.org \
    --cc=ae878000@gmail.com \
    --cc=akuchynski@chromium.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=jthies@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhun512@gmail.com \
    --cc=stable@vger.kernel.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

all inboxes | Powered by JetHome®