From nobody Mon Sep 28 16:24:08 2026 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (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 5154E48A2A9 for ; Wed, 19 Aug 2026 16:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787158068; cv=none; b=BlXFOEiJnhev/yGsCUW9l3yQ+HPZ2n1FNnSrm2nPGVAXLqW6gkYy4DjNEh+20zKDLZmiXoRgCQ6c2450Oei/65JTKLecncGcGKtnyt4HfgX/FClJbykXcKceTK0f+WiRA/zzi3lcZogFlgz/t9RTJhCAvnvVvRjaxeP1xC1BeGc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787158068; c=relaxed/simple; bh=M8vBSbuA8VI2DOK1kxP8WB42QTX2GzsUgR6WmbobO8c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=dt1qcxFcF/uoemsGzAN/ckbs4OTGmLiMT3VgdH5NGkMORotPjvdwHNwHiO9zNPdiIncYQSUCoJLerJGcRw62HoZNUDIg94tPWHaZ4SNazM4l90cuFBV6gVOS4xX5vZzg1Z2Rhn32uL5r4DXpLJDkXPlgi707ssswkIt93iqi/Zo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=Y16U7R7y; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="Y16U7R7y" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-38e041ea211so1341767a91.0 for ; Wed, 19 Aug 2026 09:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1787158066; x=1787762866; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:content-type :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=+nlBq5UdgVIUTs785HzCl/oYDRAOZ9I08lv0VtlQk+w=; b=Y16U7R7ynP8xZbmV/N39J666Hu82BwNK+AQ7zbgsZ3qMzB8M9tiWxWaa6nqYHdR6dh 3bhtuoMxBvRdO1CmHwhWC8gcxM4muRJoPx4YFZAvS1gvrSQ5+Jabafd5ZJjwRLirsA59 I+LpMtwcDgFpShlx0ZKKm7Ceinh+Xt2C/zqINLonXeFtiIHyMV3k2mQeQx3NK2I0PVb0 z8qnOJy697ZYjHGwQ2srKaZG/jc8NbzI3lMJYKJHd4DICLprQWUJuZKFcewlXHHs89/o 2OKx7EDPRHssD5Snu4pg8nfflkcuLqwE7jz8joL/UtC/E3BlvEjwI/yi5i/5bGbDmECq dLXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787158066; x=1787762866; h=cc:to:message-id:content-transfer-encoding:content-type :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=+nlBq5UdgVIUTs785HzCl/oYDRAOZ9I08lv0VtlQk+w=; b=hIOTSMxIImC3EpHrA/rvpW4cJBsCxMvd6qe9Z5qcIt6GQtBg7bYUd6NB9SGhCi5T6+ sDzdOW8m5LhzL/CnP00NxyNwCFmkj2ue2To8SZTTeXdNgcw0Fv2tEyLoAr6MCtEKPHX/ G8C/Bng5gnaCF6dbZq31PWTwPBN2khIWzT0wZqf3M2MiQGudx0YjbK6LcOhF2ioV5Nuv H18bzyV2vXLRZ+9hvK8bhimVh23+EfsHiDREWfJpy8dHmhfyHFbIS5yfP2WEy+Dq8AMm ha5RUKg3KrerAGcwncbFY0dMaaQjQX3jdihdayR1ZmTc0hGNLsyP+DdYogfQrhHYxZDv i0RQ== X-Forwarded-Encrypted: i=1; AHgh+RoPAgMkVKY7VomLujusOJVRNT9VfawpKBzRwY9fCRS9ST4T0quXsvkLy2/WMpuYRzjCyCfrtHQOwJS/UQY=@vger.kernel.org X-Gm-Message-State: AFuF++n0IBkhPwdVAMKgh59ydBIW/qdOs6Ewgi2/k4NsDHBP7CwFBzu2 q8t2eYE1xff0bn+0wAXNdpBb5rZuuJrAwYJjR+bqBZYyGyG4KxzTu8L95zGAkSEjsrmavK+nn9N ny9zDjQg= X-Gm-Gg: AR+sD12G1BrcntuDKwNq0rdqo2KexRNKSlhkN/vLtSEc4tPDfysHEitshHzweNgge6Q IGQ1GN8ByqCjCcboRLbCB4fMnHqMV95+1n9O+wtsQC9tZjtbbtpSZoXzyfzypx5WnhWr6gxpP0K U2K5YZ/ss7Jqki360akjYMry4RU0WvKMc5K1KVQym5ekhMTbjmHw9SZ35aaG88hoZrTmPgU9REF cSoim2LKDA3dUOt7d2bqyM+LUJtZcCLsgJaCiLN2I6K4wVnzf0A3O8+n3AIQaXUtaRlmiu6N/A5 7gQuYmNCgklx6h0n60cOIYxYL+LWj1kXL82kJohaq9X7RN8SGgDwE8OfCl6IyQZt0XAkALrxGM/ o2QDRJVFxSm32/DdkW3rEGJBWBUFT2e1uE0kxY2QlhvDkpZwuvNjmDaO+DKRm18gIbAxjgSjbqa wkKX9dNR5Cv5guwBecFpdbL1g357wHbCanF9Tmy3yMxL/+isCjT/OWtG4OCGwC4b0= X-Received: by 2002:a17:90b:4a46:b0:37f:e326:6557 with SMTP id 98e67ed59e1d1-3958083fc60mr10940911a91.4.1787158060779; Wed, 19 Aug 2026 09:47:40 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3957faf596fsm3184128a91.11.2026.08.19.09.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Aug 2026 09:47:39 -0700 (PDT) From: Abdurrahman Hussain Date: Wed, 19 Aug 2026 09:47:37 -0700 Subject: [PATCH v4] i2c: xiic: restore non-managed runtime PM to fix clk WARN flood Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260819-i2c-xiic-restore-runtime-pm-teardown-v4-1-6999eb434d1c@nexthop.ai> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/5XOzU7DMBAE4FepfGbR2m6awIn3QD34Z00WqU5ku yFVlXfHLpciLuU40uibuYpMiSmL191VJFo48xRr2D/thBtN/CBgX7NQqA44SA2sHKzMDhLlMiW CdI6FTwTzCQqZ5KevCN6jsdJb5VCJSs2JAq+3mffjT85n+0muNLs1Rm7a5fZjka33z8lFggSk3 ger8NC/4FuktYzT/GxYtM1F3av7B1VV1d5Q59FpDEH9UfW9Ojyo6qp2wWvZWewHkr/Ubdu+Aec pUkOXAQAA X-Change-ID: 20260813-i2c-xiic-restore-runtime-pm-teardown-dd0ab1db2c02 To: Michal Simek , Andi Shyti , Andy Shevchenko Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1787158059; l=6356; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=M8vBSbuA8VI2DOK1kxP8WB42QTX2GzsUgR6WmbobO8c=; b=bDi1TK6LLCQWJEOOxLNfPaCR2kU7PLBpyloOuASAxvRp4naHPgNsgBElSDaXl7THv2vDPwmR/ 2U7PjotYbNuBLe7oFVGlgoHgdscLNNzeCALnwdstI8fKYnoVCQRxF3t X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= The devres conversion replaced manual pm_runtime_enable()/disable() with devm_pm_runtime_set_active_enabled() and dropped the remove-time runtime PM teardown. The managed release tears runtime PM down in the wrong order: it calls pm_runtime_dont_use_autosuspend() before pm_runtime_disable(), i.e. while runtime PM is still enabled, and devres is LIFO so the devm_clk_get_enabled() release runs afterwards. At remove(), pm_runtime_put_sync() leaves the device active with the autosuspend timer armed. Clearing use_autosuspend then makes rpm_idle() suspend immediately, and xiic_i2c_runtime_suspend() clk_disable()s the clock. The later devm_clk_get_enabled() release clk_disable_unprepare()s the already-disabled clock, so clk_core_disable() WARNs ("clkN already disabled") on every teardown. Drop the managed helper and restore the non-managed runtime PM setup and teardown, so runtime PM is enabled once in probe and disabled once in remove and the clock enable count stays balanced. Restore the non-managed IRQ request as well. The probe error paths now unwind runtime PM by hand via goto, and a devm-registered handler is only freed later during devres unwind, so it would stay live across the manual teardown (and across any future failing step added after it). Request the IRQ with request_threaded_irq() and free it explicitly in the probe error path and in remove. Fixes: 50c63491ff26 ("i2c: xiic: switch to devres managed APIs") Signed-off-by: Abdurrahman Hussain --- Changes in v4: - Request the IRQ non-managed (request_threaded_irq/free_irq) and free it in the probe error path and in remove(), instead of a devm handler that would only be released during devres unwind and so stay live across the manual runtime PM teardown in the goto error paths (Andy). - Link to v3: https://patch.msgid.link/20260818-i2c-xiic-restore-runtime-pm= -teardown-v3-1-5fd315b078e1@nexthop.ai Changes in v3: - Drop the managed devm_pm_runtime_set_active_enabled() helper entirely and restore the non-managed runtime PM setup (pm_runtime_set_active + pm_runtime_enable, with probe error unwinding) and teardown (pm_runtime_disable + set_suspended + dont_use_autosuspend), so the disable depth stays balanced rather than being disabled twice (Andi). - Link to v2: https://patch.msgid.link/20260814-i2c-xiic-restore-runtime-pm= -teardown-v2-1-7ae5d0c30ff2@nexthop.ai Changes in v2: - Move the Signed-off-by into the commit message proper (Andy). - Link to v1: https://patch.msgid.link/20260813-i2c-xiic-restore-runtime-pm= -teardown-v1-1-0e7dfb206790@nexthop.ai To: Michal Simek To: Andi Shyti To: Abdurrahman Hussain To: Andy Shevchenko Cc: linux-arm-kernel@lists.infradead.org Cc: linux-i2c@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/i2c/busses/i2c-xiic.c | 43 ++++++++++++++++++++++++++++++++++-----= ---- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 3e7735e1dae0..bafae1cc44aa 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -92,6 +92,7 @@ struct xiic_i2c { int rx_pos; enum xiic_endian endianness; struct clk *clk; + int irq; enum xilinx_i2c_state state; bool singlemaster; bool dynamic; @@ -1475,9 +1476,13 @@ static int xiic_i2c_probe(struct platform_device *pd= ev) =20 pm_runtime_set_autosuspend_delay(dev, XIIC_PM_TIMEOUT); pm_runtime_use_autosuspend(dev); - ret =3D devm_pm_runtime_set_active_enabled(dev); - if (ret) - return ret; + /* + * Enable runtime PM by hand: devm_pm_runtime_set_active_enabled() + * tears down in an order that races the devm-enabled clock release and + * makes clk_core_disable() WARN (see xiic_i2c_remove()). + */ + pm_runtime_set_active(dev); + pm_runtime_enable(dev); =20 /* SCL frequency configuration */ i2c->input_clk =3D clk_get_rate(i2c->clk); @@ -1486,10 +1491,15 @@ static int xiic_i2c_probe(struct platform_device *p= dev) if (ret || i2c->i2c_clk > I2C_MAX_FAST_MODE_PLUS_FREQ) i2c->i2c_clk =3D 0; =20 - ret =3D devm_request_threaded_irq(dev, irq, NULL, xiic_process, - IRQF_ONESHOT, pdev->name, i2c); + /* + * Request the IRQ non-managed: later probe steps unwind manually via + * goto, so a devm handler could still be live after that teardown runs. + */ + i2c->irq =3D irq; + ret =3D request_threaded_irq(irq, NULL, xiic_process, IRQF_ONESHOT, + pdev->name, i2c); if (ret) - return ret; + goto err_pm_disable; =20 i2c->singlemaster =3D device_property_read_bool(dev, "single-master"); =20 @@ -1506,14 +1516,16 @@ static int xiic_i2c_probe(struct platform_device *p= dev) i2c->endianness =3D BIG; =20 ret =3D xiic_reinit(i2c); - if (ret) - return dev_err_probe(dev, ret, "Cannot xiic_reinit\n"); + if (ret) { + dev_err_probe(dev, ret, "Cannot xiic_reinit\n"); + goto err_free_irq; + } =20 /* add i2c adapter to i2c tree */ ret =3D i2c_add_numbered_adapter(&i2c->adap); if (ret) { xiic_deinit(i2c); - return ret; + goto err_free_irq; } =20 if (pdata) { @@ -1526,6 +1538,14 @@ static int xiic_i2c_probe(struct platform_device *pd= ev) res, irq, i2c->i2c_clk); =20 return 0; + +err_free_irq: + free_irq(irq, i2c); +err_pm_disable: + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + + return ret; } =20 static void xiic_i2c_remove(struct platform_device *pdev) @@ -1537,6 +1557,8 @@ static void xiic_i2c_remove(struct platform_device *p= dev) /* remove adapter & data */ i2c_del_adapter(&i2c->adap); =20 + free_irq(i2c->irq, i2c); + ret =3D pm_runtime_get_sync(dev); if (ret < 0) dev_warn(dev, "Failed to activate device for removal (%pe)\n", @@ -1545,6 +1567,9 @@ static void xiic_i2c_remove(struct platform_device *p= dev) xiic_deinit(i2c); =20 pm_runtime_put_sync(dev); + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_dont_use_autosuspend(dev); } =20 static const struct dev_pm_ops xiic_dev_pm_ops =3D { --- base-commit: d58772d8520c7ef247c4b95c9bd76d3a25da9ff5 change-id: 20260813-i2c-xiic-restore-runtime-pm-teardown-dd0ab1db2c02 Best regards, -- =20 Abdurrahman Hussain