From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
Cc: wsa+renesas@sang-engineering.com, linux-i2c@vger.kernel.org,
linux-acpi@vger.kernel.org
Subject: Re: [PATCH 1/1] i2c: acpi: Unbind mux adapters before delete
Date: Thu, 29 Feb 2024 11:54:11 +0200 [thread overview]
Message-ID: <20240229095411.GF8454@black.fi.intel.com> (raw)
In-Reply-To: <20240228023925.2814638-2-hamish.martin@alliedtelesis.co.nz>
On Wed, Feb 28, 2024 at 03:39:25PM +1300, Hamish Martin wrote:
> Unbind any i2c_adapters matching an ACPI device being removed. This
> ensures that the linkage between the ACPI device and the i2c_adapter is
> correctly broken before the ACPI device is destroyed.
I suggest to move some of the information from the cover letter here to
make sure it is not lost. It includes good analysis of the problem so
should be part of the changelog.
> Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
> ---
> drivers/i2c/i2c-core-acpi.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
> index d6037a328669..67fa8deccef6 100644
> --- a/drivers/i2c/i2c-core-acpi.c
> +++ b/drivers/i2c/i2c-core-acpi.c
> @@ -445,6 +445,11 @@ static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev)
> return i2c_find_device_by_fwnode(acpi_fwnode_handle(adev));
> }
>
> +static struct i2c_adapter *i2c_acpi_find_adapter_by_adev(struct acpi_device *adev)
> +{
> + return i2c_find_adapter_by_fwnode(acpi_fwnode_handle(adev));
> +}
> +
> static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,
> void *arg)
> {
> @@ -471,11 +476,17 @@ static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,
> break;
>
> client = i2c_acpi_find_client_by_adev(adev);
> - if (!client)
> - break;
> + if (client) {
> + i2c_unregister_device(client);
> + put_device(&client->dev);
> + }
> +
> + adapter = i2c_acpi_find_adapter_by_adev(adev);
> + if (adapter) {
> + acpi_device_notify_remove(&adapter->dev);
> + put_device(&adapter->dev);
> + }
This looks good to me. I'm just wondering whether we have the same issue
on DT side too?
>
> - i2c_unregister_device(client);
> - put_device(&client->dev);
> break;
> }
>
> --
> 2.43.0
next prev parent reply other threads:[~2024-02-29 9:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 2:39 [PATCH 0/1] I2C mux ACPI SSDT overlay removal issue Hamish Martin
2024-02-28 2:39 ` [PATCH 1/1] i2c: acpi: Unbind mux adapters before delete Hamish Martin
2024-02-29 9:54 ` Mika Westerberg [this message]
2024-02-29 21:40 ` Hamish Martin
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=20240229095411.GF8454@black.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=hamish.martin@alliedtelesis.co.nz \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.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