Date: Fri, 24 Apr 2026 17:56:28 +0000 From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: a7cf142ba904 - stable/15 - acpi_apm: Narrow scope of ACPI_LOCK Message-ID: <69ebaecc.1d116.3dc1cb30@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a7cf142ba9044c3b8f88b4a8ed7f5720bc39b90c commit a7cf142ba9044c3b8f88b4a8ed7f5720bc39b90c Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2026-03-30 13:38:54 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2026-04-24 17:49:14 +0000 acpi_apm: Narrow scope of ACPI_LOCK This lock doesn't need to be held across seldrain/knlist_destroy. It is also redundant (and a bug) to hold it across knlist_add and knlist_remove since it is the mutex for the knlist. PR: 293901 Reported by: Jiaming Zhang <r772577952@gmail.com> Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55994 (cherry picked from commit cc2715cf1f864345ab175db691d4e152d5fb84af) --- sys/x86/acpica/acpi_apm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/x86/acpica/acpi_apm.c b/sys/x86/acpica/acpi_apm.c index d5fee124703d..74987ad01d0d 100644 --- a/sys/x86/acpica/acpi_apm.c +++ b/sys/x86/acpica/acpi_apm.c @@ -243,9 +243,9 @@ apmdtor(void *data) /* Remove this clone's data from the list and free it. */ ACPI_LOCK(acpi); STAILQ_REMOVE(&acpi_sc->apm_cdevs, clone, apm_clone_data, entries); + ACPI_UNLOCK(acpi); seldrain(&clone->sel_read); knlist_destroy(&clone->sel_read.si_note); - ACPI_UNLOCK(acpi); free(clone, M_APMDEV); } @@ -407,11 +407,9 @@ apmkqfilter(struct cdev *dev, struct knote *kn) struct apm_clone_data *clone; devfs_get_cdevpriv((void **)&clone); - ACPI_LOCK(acpi); kn->kn_hook = clone; kn->kn_fop = &apm_readfiltops; knlist_add(&clone->sel_read.si_note, kn, 0); - ACPI_UNLOCK(acpi); return (0); } @@ -420,10 +418,8 @@ apmreadfiltdetach(struct knote *kn) { struct apm_clone_data *clone; - ACPI_LOCK(acpi); clone = kn->kn_hook; knlist_remove(&clone->sel_read.si_note, kn, 0); - ACPI_UNLOCK(acpi); } static int @@ -432,8 +428,8 @@ apmreadfilt(struct knote *kn, long hint) struct apm_clone_data *clone; int sleeping; - ACPI_LOCK(acpi); clone = kn->kn_hook; + ACPI_LOCK(acpi); sleeping = clone->acpi_sc->acpi_next_sstate ? 1 : 0; ACPI_UNLOCK(acpi); return (sleeping);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69ebaecc.1d116.3dc1cb30>
