From: Greg KH <gregkh@linuxfoundation.org>
To: GuangFei Luo <luogf2025@163.com>
Cc: rafael@kernel.org, dan.carpenter@linaro.org, lenb@kernel.org,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, lkp@intel.com, sre@kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v4] ACPI: battery: prevent sysfs_add_battery re-entry on rapid events
Date: Sat, 13 Sep 2025 09:33:36 +0200 [thread overview]
Message-ID: <2025091322-resilient-bottle-6d85@gregkh> (raw)
In-Reply-To: <20250913071925.697603-1-luogf2025@163.com>
On Sat, Sep 13, 2025 at 03:19:25PM +0800, GuangFei Luo wrote:
> v4:
> - Uses guard(mutex) for battery->sysfs_lock in sysfs_add_battery().
> - Since sysfs_add_battery() now handles the battery->bat check with
> proper locking,the extra if (!battery->bat) check at the call site
> has become redundant.
>
> v3:
> - Modified the earlier approach: since sysfs_add_battery() is invoked
> from multiple places, the most reliable way is to add the lock inside
> the function itself.
> - sysfs_remove_battery() had a similar race issue in the past, which was
> fixed by adding a lock as well. Reference:
> https://lore.kernel.org/all/9c921c22a7f33397a6774d7fa076db9b6a0fd669
> .1312318300.git.len.brown@intel.com/
>
> v2:
> - Fix missing mutex_unlock in acpi_battery_update()
> (Reported-by: kernel test robot)
>
> v1:
> When removing and reinserting the laptop battery, ACPI can trigger
> two notifications in quick succession:
Again, all of this goes below the --- line, not above it.
next prev parent reply other threads:[~2025-09-13 7:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-10 14:26 [PATCH v2] ACPI: battery: prevent sysfs_add_battery re-entry on rapid events GuangFei Luo
2025-09-12 14:58 ` [PATCH v3] " GuangFei Luo
2025-09-12 15:48 ` GuangFei Luo
2025-09-12 15:57 ` Greg KH
2025-09-12 16:25 ` GuangFei Luo
2025-09-13 6:05 ` Greg KH
2025-09-13 7:19 ` [PATCH v4] " GuangFei Luo
2025-09-13 7:33 ` Greg KH [this message]
2025-09-13 7:56 ` [PATCH v5] " GuangFei Luo
2025-09-14 11:12 ` [PATCH v6] " GuangFei Luo
2025-09-23 2:38 ` GuangFei Luo
2025-09-23 11:48 ` Rafael J. Wysocki
2025-09-23 16:13 ` GuangFei Luo
2025-09-23 17:12 ` [PATCH " Rafael J. Wysocki
2025-09-23 16:18 ` GuangFei Luo
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=2025091322-resilient-bottle-6d85@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dan.carpenter@linaro.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lkp@intel.com \
--cc=luogf2025@163.com \
--cc=rafael@kernel.org \
--cc=sre@kernel.org \
--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