Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795042360; b=LiQaBOhs9/yJa6M+L2Bu2fz6Ly2d3VbvGzASWDJUyqV/iXbLrThi6n+tfZ21PvCSt4EU mgJyk/J9zZxvAGjXiCd7WyfFMhLijLhk9mh+B2iFTbZEE6LZWtDLKV2YojBtK0lOEZlV/ i9cbreOKII4FEnRutFgTbCA506BaUGse6pfLAunVMw4nR2lMGI2vW+8CJNQGvNK7tgdhr 2rma1bn7+DZzbKpxyOw2MsCs4VhO3zgXtCdwmMMfqdhAUhGyPUNo88KCIkSyEPzbfjSFn o48b6B3zKi8NEb1lKlV8RHbJZwbzK6G7fjkP/OKoQY+Yww9jY8/Qa8ASrIU9OD6FcLA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795042360; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=fUhRw6ufaq9KMElRtcSYCCAzj7oNbb01KZt3N/KifK0=; b=CBjRpPl+j9EkcPFOKLsUVvLiHM4EuKDAipHYIVzUymO7WSdHd9GPPStdS0SN1liN+4eA 4dKv6blzbdjlrGksV2uQI/5OFM6ggWShBtY7F2OOyPQWJ+dKAmRJoWV5SLCLh0cJj3mzJ Of8zFP4zX9iRcBhKr8Bb/vnRxO9/H0StZpI1oEdGY8tl6FrT1BIq3+JLPyyRgXqKp9QXq dn3dLuQDg569H9bRnOIt+NXUQ2uN1YKbVe/3OGYZaQ34R0F/wC9/oijGCkBBsyzetkLmp RZlsSEfDFjnnxNvgfPo1pdc3s7rXuEPraxLcqZeiC3tH4YxGwhBfB/HEvTBEP3X13gg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=PoRn68Uh; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A82CB606A325; Wed, 18 Nov 2026 22:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=PoRn68Uh Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CE001F000C4; Wed, 18 Nov 2026 22:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795042360; bh=fUhRw6ufaq9KMElRtcSYCCAzj7oNbb01KZt3N/KifK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PoRn68UhPiajnpXiS9Ohr30hMavL2XR+YywQhJW2cxB38vBb16pIpxc6Md7PZ5bLu +Yhxoi6W7ePAxe5viYaJ5IZ2TT6vKAQorWGgtJvJjFlyQ34QhItijoHf9Bw3KXYb9m Z+nsR5O/wrwi5J9MbBa+WoYlP+7ICGZ0SPg9jGs0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiale Yao , Matti Vaittinen , Mark Brown , Sasha Levin Subject: [PATCH 6.6 3142/3318] regulator: irq: freeze deferred hardware access during suspend Date: Wed, 18 Nov 2026 16:02:44 +0100 Message-ID: <20261118150454.134546424@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150313.527275416@linuxfoundation.org> References: <20261118150313.527275416@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiale Yao [ Upstream commit 8a6d73e316f95e398a1de1d1f58314b6d3e7f641 ] The regulator IRQ helper delays status checks and recovery callbacks on non-freezable workqueues. Those callbacks may access regulator hardware after the backing bus has been suspended. Use system_freezable_wq for normal-priority callbacks. Allocate a freezable high-priority workqueue when requested so the high_prio contract is preserved while hardware access is frozen across suspend. Signed-off-by: Jiale Yao Fixes: 7111c6d1b31b ("regulator: IRQ based event/error notification helpers") Reviewed-by: Matti Vaittinen Link: https://patch.msgid.link/20261016100522.2582557-3-yaojiale02@163.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/irq_helpers.c | 38 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/regulator/irq_helpers.c b/drivers/regulator/irq_helpers.c index ad424d7542f14..79fe9f2bc6efb 100644 --- a/drivers/regulator/irq_helpers.c +++ b/drivers/regulator/irq_helpers.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "internal.h" @@ -27,6 +28,7 @@ struct regulator_irq { int irq; int retry_cnt; struct delayed_work isr_work; + struct workqueue_struct *wq; }; /* @@ -145,12 +147,7 @@ static void regulator_notifier_isr_work(struct work_struct *work) return; reschedule: - if (!d->high_prio) - mod_delayed_work(system_dfl_wq, &h->isr_work, - msecs_to_jiffies(tmo)); - else - mod_delayed_work(system_highpri_wq, &h->isr_work, - msecs_to_jiffies(tmo)); + mod_delayed_work(h->wq, &h->isr_work, msecs_to_jiffies(tmo)); } static irqreturn_t regulator_notifier_isr(int irq, void *data) @@ -248,13 +245,8 @@ static irqreturn_t regulator_notifier_isr(int irq, void *data) } if (d->irq_off_ms) { - if (!d->high_prio) - schedule_delayed_work(&h->isr_work, - msecs_to_jiffies(d->irq_off_ms)); - else - mod_delayed_work(system_highpri_wq, - &h->isr_work, - msecs_to_jiffies(d->irq_off_ms)); + mod_delayed_work(h->wq, &h->isr_work, + msecs_to_jiffies(d->irq_off_ms)); } return IRQ_HANDLED; @@ -363,13 +355,25 @@ void *regulator_irq_helper(struct device *dev, init_rdev_errors(h); - if (h->desc.irq_off_ms) + if (h->desc.irq_off_ms) { + if (h->desc.high_prio) { + h->wq = alloc_workqueue("regulator_irq_highpri", + WQ_FREEZABLE | WQ_HIGHPRI, 0); + if (!h->wq) + return ERR_PTR(-ENOMEM); + } else { + h->wq = system_freezable_wq; + } + INIT_DELAYED_WORK(&h->isr_work, regulator_notifier_isr_work); + } ret = request_threaded_irq(h->irq, NULL, regulator_notifier_isr, IRQF_ONESHOT | irq_flags, h->desc.name, h); if (ret) { dev_err(dev, "Failed to request IRQ %d\n", irq); + if (h->desc.irq_off_ms && h->desc.high_prio) + destroy_workqueue(h->wq); return ERR_PTR(ret); } @@ -393,8 +397,11 @@ void regulator_irq_helper_cancel(void **handle) struct regulator_irq *h = *handle; free_irq(h->irq, h); - if (h->desc.irq_off_ms) + if (h->desc.irq_off_ms) { cancel_delayed_work_sync(&h->isr_work); + if (h->desc.high_prio) + destroy_workqueue(h->wq); + } h = NULL; } @@ -436,4 +443,3 @@ int regulator_irq_map_event_simple(int irq, struct regulator_irq_data *rid, return 0; } EXPORT_SYMBOL_GPL(regulator_irq_map_event_simple); - -- 2.53.0