From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Mark Pearson <mpearson-lenovo@squebb.ca>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: ucsi: acpi: Remove notifier before destroying handler
Date: Thu, 23 Mar 2023 11:57:37 +0200 [thread overview]
Message-ID: <ZBwikZ0wyQ1LGYBc@kuha.fi.intel.com> (raw)
In-Reply-To: <20230321190136.449485-1-mpearson-lenovo@squebb.ca>
On Tue, Mar 21, 2023 at 03:01:36PM -0400, Mark Pearson wrote:
> Was debugging another issue (since fixed) and noticed that the acpi
> notify_handler should be removed before the ucsi object is destroyed.
>
> This isn't fixing any issues that I'm aware of - but I assume could
> potentially lead to a race condition if you were really unlucky?
>
> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> ---
> drivers/usb/typec/ucsi/ucsi_acpi.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
> index ce0c8ef80c04..be3bf4f996d3 100644
> --- a/drivers/usb/typec/ucsi/ucsi_acpi.c
> +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
> @@ -176,12 +176,12 @@ static int ucsi_acpi_remove(struct platform_device *pdev)
> {
> struct ucsi_acpi *ua = platform_get_drvdata(pdev);
>
> - ucsi_unregister(ua->ucsi);
> - ucsi_destroy(ua->ucsi);
> -
> acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev), ACPI_DEVICE_NOTIFY,
> ucsi_acpi_notify);
>
> + ucsi_unregister(ua->ucsi);
> + ucsi_destroy(ua->ucsi);
> +
> return 0;
> }
Calling ucsi_desctroy() after removing the notifier makes sense to me,
but do you also need to unregister the instance after that?
You may still be in the middle of init or resume, so I think we need
to accept notifications until we are sure those have finished, i.e.
ucsi_unregister() has finished.
thanks,
--
heikki
next prev parent reply other threads:[~2023-03-23 9:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 19:01 [PATCH] usb: typec: ucsi: acpi: Remove notifier before destroying handler Mark Pearson
2023-03-23 9:57 ` Heikki Krogerus [this message]
2023-03-24 12:50 ` Mark Pearson
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=ZBwikZ0wyQ1LGYBc@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mpearson-lenovo@squebb.ca \
/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