From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ua1-f53.google.com (mail-ua1-f53.google.com [209.85.222.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1FC51F63D9 for ; Mon, 17 Aug 2026 19:06:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786993605; cv=none; b=fjHRX+bSU8baoqXIc100zrggSYdymvRmKCQtQz0Xm0+G2WvNJIJpZxjh2S1zOdB/JmtNOA6Cyx9iC5FxIKwDrapPsrY3Xu/m0TXjMMiiFBUYGJcjPCicVRSZ9rQUTT0eN8MHCYnxOi6naGKjI0b/i2FhDyvGjUMRTOYLKd9e4e8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786993605; c=relaxed/simple; bh=pCuT5j+t68Y7+S/yGjb1D8D/rR4CADshW4zqB3bHisk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=U0Q7s/1/3nuXcOsVSVYVcD7BMHDH55o4/ESw2YWPPZPqpdtZJUk6fYTL9PRtcV8pKgHKqmIyctCMmoEwDEhgtC1KcfYEXsIJPg6Ebd2+pluc4aI3h8bfGq2/14FYEdvkigcSWPwDvfOHLutarQP6VYjQ+c7NJu8ifZpTH5nCLtI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EeexxzKr; arc=none smtp.client-ip=209.85.222.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EeexxzKr" Received: by mail-ua1-f53.google.com with SMTP id a1e0cc1a2514c-9667ea2fc22so637825241.2 for ; Mon, 17 Aug 2026 12:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786993602; x=1787598402; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=2Cow1LoK1RpWgLnVwBvg5GQpyW2mpO7mAA8eh4DHICY=; b=EeexxzKrKjHzNR+IuiyNX8Bz3mIhgI02/OAzb42igvYDbI1/5lmlaRdCot2C8rULYn r0XljpHfJzLgRQzpm3e00vXI58lJXEtUlaufNOVRgQHr0niIS+BuFf3dAFmba++Zajdp RB99ouctrmfLg/E3YO/XNEI3jjjUmQ1gfqRdMawitEoSAlzdZBjEVHxNaN28/Q/BoDze g1OmOT/bTPF02tzfTduG9q7tqgLwTwsGTrmuO+IICZaV1a7yy+8gB4Fxdy84ba6gDy95 hBbRK+n82dRv1/0V/jm5jJdiH2f/KdRF48rTw2s6wbq4eeg+eEgbkg+uPhteQmvvqC9R HOww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786993602; x=1787598402; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=2Cow1LoK1RpWgLnVwBvg5GQpyW2mpO7mAA8eh4DHICY=; b=W1Sbx2u5s1I0KIqtCliXywxV4DsC5y3wMIvikjWoTs0DGBJvsGn6y8v9SyKgfipev8 UDYLh0dMoIDw3aU42o8s+9xiOTtgRBGRqKfDdIWyIfR+oi/pFRDX0D1bePs7aErDmI4I q+ev/tug2C+egY3pogETzJwzaAJXrxb/Z1sEAbhpEmI60Xh0xs8DDhuzy1djq8QMQC8z 048OAcCdQX+cqrQ6TTze0vESasK4zbNIw9Ln0J3T/RCXP5tW+BMaNlSgzS/1AtGNil89 OsrpTHhSY5zPv/ZY7yY5Gc2gq8DUISdgiCOGbvKTu7ptsv6lUdK/wYWTMxfLM7vfG8Z7 jH/Q== X-Forwarded-Encrypted: i=1; AHgh+Rr9jBXlBzQj9GQ8gt7eyMtNxDLzX2HZUlUVn8S2dGPnAYYUCdHsic1Tpo+ElLfjnCmhTYH0iCkWT/fLjVs=@vger.kernel.org X-Gm-Message-State: AOJu0YyjOHe/PPirrHiF/vZnxbsqPAF9guVBZ60HnqbF1HxKA7jqSPl6 cR2nkIEMOxtYXJiR8FnuVUUAugsTi0T1F2IwnzUkGMXW87YabYxVwTg4 X-Gm-Gg: AR+sD11K3pkJfBVS/jjPPxNFII/VYpwO26aRMmZVVFaPyTgdYjL6EU8keL5uDY7IMDT EFchczxNkW3TZ1JN2QyWJsNkWZk9BDZ8kzLCSvMxOeyDpK6dASIAIy/w6GOmKIZbNSBhtb1bxL2 UUiuRA/lTC96IqVyiAAdcGire4KW2La3fJTX0O7eNQyAFeUQKwr6C4g0OhgjQanwz9WVuw/fHRx vix6Diuh+imuzocU92Ckg6PptPF+SGOdmv8+qS1QXfM6EL9G+XcG/1kxuNVvBiji3CC/OLXf7qn VeoAHuzvyF4IgP6mo60N07rqc3V2Vj3+07iZi/iu6IjCx+mtc020Gec0ZcrBaGVA0b1R5MSNbrv hi71pmZGl9xM7xIIRl2rHVtDLY/Z17DBrlp2CSxDq6sg06FbOWpizq/0n455j+QCF/bblAbPRKE zc/L1BR5r/4lz2AxIi18lYlzx4XLwwDsMFNllaEo8fuSmJDsTQyLp2t4ohKc+ewbh3HJvgFKttT kheb4uxD8UwP23DSEsJmFNpv5RTMWDpXWDEAw== X-Received: by 2002:a05:6102:548c:b0:740:177:f357 with SMTP id ada2fe7eead31-76f2b301b18mr4697798137.6.1786993602448; Mon, 17 Aug 2026 12:06:42 -0700 (PDT) Received: from fabio-X870-EAGLE-WIFI7.. ([2804:1b3:a802:463c:ff0a:9155:ae80:b1ba]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-773c508ab92sm1312783137.7.2026.08.17.12.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 12:06:41 -0700 (PDT) From: Fabio Estevam To: tglx@kernel.org Cc: radu@rendec.net, Frank.Li@nxp.com, linux-kernel@vger.kernel.org, Fabio Estevam Subject: [PATCH v4 1/2] irqchip/imx-irqsteer: Convert to devm_pm_runtime_enable() Date: Mon, 17 Aug 2026 16:06:20 -0300 Message-ID: <20260817190621.335492-1-festevam@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Fabio Estevam imx_irqsteer_probe() enables runtime PM, but imx_irqsteer_remove() does not disable it. Consequently, runtime PM remains enabled after unbinding the device, and rebinding it triggers: Unbalanced pm_runtime_enable! Use devm_pm_runtime_enable() to automatically disable runtime PM when the device is removed. The driver core may runtime suspend the device before calling remove. In that case, the runtime suspend callback has already disabled the IPG clock, so only disable it in remove when the device is still active. Set up runtime PM before creating the IRQ domain and registering chained handlers so that a failure cannot leave either resource pointing at freed driver data. Fixes: 4730d2233311 ("irqchip/imx-irqsteer: Add runtime PM support") Signed-off-by: Fabio Estevam --- Changes since v3: - Do not disable the IPG clock in remove when runtime PM has already suspended the device, preventing a clock reference-count underflow. (Radu) drivers/irqchip/irq-imx-irqsteer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c index 87b07f517be3..f4df5ae73e9a 100644 --- a/drivers/irqchip/irq-imx-irqsteer.c +++ b/drivers/irqchip/irq-imx-irqsteer.c @@ -236,6 +236,11 @@ static int imx_irqsteer_probe(struct platform_device *pdev) if (irqsteer_has_chanctrl(data->devtype_data)) writel_relaxed(BIT(data->channel), data->regs + CHANCTRL); + pm_runtime_set_active(&pdev->dev); + ret = devm_pm_runtime_enable(&pdev->dev); + if (ret) + goto out; + data->domain = irq_domain_create_linear(dev_fwnode(&pdev->dev), data->reg_num * 32, &imx_irqsteer_domain_ops, data); if (!data->domain) { @@ -262,9 +267,6 @@ static int imx_irqsteer_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); - return 0; out: clk_disable_unprepare(data->ipg_clk); @@ -286,7 +288,8 @@ static void imx_irqsteer_remove(struct platform_device *pdev) irq_domain_remove(irqsteer_data->domain); - clk_disable_unprepare(irqsteer_data->ipg_clk); + if (!pm_runtime_status_suspended(&pdev->dev)) + clk_disable_unprepare(irqsteer_data->ipg_clk); } #ifdef CONFIG_PM -- 2.43.0