From nobody Mon Feb 9 00:05:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 394A630649A; Fri, 23 Jan 2026 16:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186057; cv=none; b=BEpRG3dMIBiG2Zb1I1ODWd7niXd6AMuFDBonpOmsVqfNg3ndZCGy9SizGhCGtwi70kpLNOBFqiVNJVqzGKot79yMRAKUL1DvTiNgdiQaeVckpGoPfoL03UIJsWftn6V+rYtU94zAnkvp1KzhiwWYw9lylYVKyFfrEXkNgfSQRmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186057; c=relaxed/simple; bh=mA693d2B+lCutFgSWj64GcSrZarkiCgLGJixz53RjCk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XeOk5LNgZFQPtENvPyfLalmzPVMcVacUoQ4GVvTmhKZTqCF/798X6sGBIl+MiHv7ZqCfOC6qu0rpWY9I3jbdMSejbn/CpVS+8nBej6g7wEwYHyQw32FdHgpxmTHACLMDKD95OOVOF2HyUIEpodlNYPWf8hBfHttdxXH+cMuCd5s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t2enw8dH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t2enw8dH" Received: by smtp.kernel.org (Postfix) with ESMTPS id D5EACC19422; Fri, 23 Jan 2026 16:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769186056; bh=mA693d2B+lCutFgSWj64GcSrZarkiCgLGJixz53RjCk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=t2enw8dHZyxTEK2l+4YEqkG81wTj2Bngqv2Hec++sETMkzrZ5omooaOb/1kyn+HGI URrZ3u8C5Qg4ljQMFv2UaOnIUul4SUoUZ66HH++MIDsj8rj2UuEFfSHKe323lZUSCp Z0GHoJopD4Wqt2kqmypjqa0W0FziEODzp9HZW+lSid781834KYHE0M3MA/fmCGhDzQ qhDAkESyZZ/gqL/jIp35PWLTZ472diwBClrPL3CbGDwVmF32kDx9A1xpbziiv80vLD ECK1UZZH0HHS7eQzy4krsqfgy3aTAQ3KESkC+9fP3DMi4hwAkjybJInLuzIAbkG2bO 0FyZKyPWr2z9A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C63BED74EFF; Fri, 23 Jan 2026 16:34:16 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 23 Jan 2026 16:34:14 +0000 Subject: [PATCH v4 1/5] i2c: xiic: minor cosmetic cleanup 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: <20260123-i2c-xiic-v4-1-4a3eba3510ce@nexthop.ai> References: <20260123-i2c-xiic-v4-0-4a3eba3510ce@nexthop.ai> In-Reply-To: <20260123-i2c-xiic-v4-0-4a3eba3510ce@nexthop.ai> To: Michal Simek , Andi Shyti Cc: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769186056; l=5157; i=abdurrahman@nexthop.ai; s=20260119; h=from:subject:message-id; bh=0QQ3AZ9kvIaYMsjGFuaC+WxbuuTcDJrOZdiaoj9V0Us=; b=Zf7buBeB54Kay6AbbJHNDAjugWSFk0yHlrcN4HOY2Hq5Wi2h+6lrkFZzLQA+6j8jrNNdJCUg7 cQ1pQvOONErDAKhgYM8Xj9qQDKILPCCwW1tG/eoiQcQp3MEtSyc4WvO X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=S+ysnf+NwMcBdHBlyKIUEAtaFGSIhQwcJcgcXhq0osg= X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/20260119 with auth_id=608 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain Add a temporary dev variable and reuse it instead of referencing pdev->dev everywhere. Signed-off-by: Abdurrahman Hussain --- drivers/i2c/busses/i2c-xiic.c | 57 ++++++++++++++++++++++-----------------= ---- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 28015d77599d..12321654055f 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -1423,6 +1423,7 @@ MODULE_DEVICE_TABLE(of, xiic_of_match); =20 static int xiic_i2c_probe(struct platform_device *pdev) { + struct device *dev =3D &pdev->dev; struct xiic_i2c *i2c; struct xiic_i2c_platform_data *pdata; const struct of_device_id *match; @@ -1431,11 +1432,11 @@ static int xiic_i2c_probe(struct platform_device *p= dev) u8 i; u32 sr; =20 - i2c =3D devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c =3D devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); if (!i2c) return -ENOMEM; =20 - match =3D of_match_node(xiic_of_match, pdev->dev.of_node); + match =3D of_match_node(xiic_of_match, dev->of_node); if (match && match->data) { const struct xiic_version_data *data =3D match->data; =20 @@ -1450,50 +1451,49 @@ static int xiic_i2c_probe(struct platform_device *p= dev) if (irq < 0) return irq; =20 - pdata =3D dev_get_platdata(&pdev->dev); + pdata =3D dev_get_platdata(dev); =20 /* hook up driver to tree */ platform_set_drvdata(pdev, i2c); i2c->adap =3D xiic_adapter; i2c_set_adapdata(&i2c->adap, i2c); - i2c->adap.dev.parent =3D &pdev->dev; - i2c->adap.dev.of_node =3D pdev->dev.of_node; + i2c->adap.dev.parent =3D dev; + i2c->adap.dev.of_node =3D dev->of_node; snprintf(i2c->adap.name, sizeof(i2c->adap.name), DRIVER_NAME " %s", pdev->name); =20 mutex_init(&i2c->lock); spin_lock_init(&i2c->atomic_lock); =20 - i2c->clk =3D devm_clk_get_enabled(&pdev->dev, NULL); + i2c->clk =3D devm_clk_get_enabled(dev, NULL); if (IS_ERR(i2c->clk)) - return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk), + return dev_err_probe(dev, PTR_ERR(i2c->clk), "failed to enable input clock.\n"); =20 - i2c->dev =3D &pdev->dev; - pm_runtime_set_autosuspend_delay(i2c->dev, XIIC_PM_TIMEOUT); - pm_runtime_use_autosuspend(i2c->dev); - pm_runtime_set_active(i2c->dev); - pm_runtime_enable(i2c->dev); + i2c->dev =3D dev; + pm_runtime_set_autosuspend_delay(dev, XIIC_PM_TIMEOUT); + pm_runtime_use_autosuspend(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); =20 /* SCL frequency configuration */ i2c->input_clk =3D clk_get_rate(i2c->clk); - ret =3D of_property_read_u32(pdev->dev.of_node, "clock-frequency", + ret =3D of_property_read_u32(dev->of_node, "clock-frequency", &i2c->i2c_clk); /* If clock-frequency not specified in DT, do not configure in SW */ if (ret || i2c->i2c_clk > I2C_MAX_FAST_MODE_PLUS_FREQ) i2c->i2c_clk =3D 0; =20 - ret =3D devm_request_threaded_irq(&pdev->dev, irq, NULL, - xiic_process, IRQF_ONESHOT, - pdev->name, i2c); + ret =3D devm_request_threaded_irq(dev, irq, NULL, xiic_process, + IRQF_ONESHOT, pdev->name, i2c); =20 if (ret < 0) { - dev_err_probe(&pdev->dev, ret, "Cannot claim IRQ\n"); + dev_err_probe(dev, ret, "Cannot claim IRQ\n"); goto err_pm_disable; } =20 i2c->singlemaster =3D - of_property_read_bool(pdev->dev.of_node, "single-master"); + of_property_read_bool(dev->of_node, "single-master"); =20 /* * Detect endianness @@ -1509,7 +1509,7 @@ static int xiic_i2c_probe(struct platform_device *pde= v) =20 ret =3D xiic_reinit(i2c); if (ret < 0) { - dev_err_probe(&pdev->dev, ret, "Cannot xiic_reinit\n"); + dev_err_probe(dev, ret, "Cannot xiic_reinit\n"); goto err_pm_disable; } =20 @@ -1526,38 +1526,39 @@ static int xiic_i2c_probe(struct platform_device *p= dev) i2c_new_client_device(&i2c->adap, pdata->devices + i); } =20 - dev_dbg(&pdev->dev, "mmio %08lx irq %d scl clock frequency %d\n", + dev_dbg(dev, "mmio %08lx irq %d scl clock frequency %d\n", (unsigned long)res->start, irq, i2c->i2c_clk); =20 return 0; =20 err_pm_disable: - pm_runtime_disable(&pdev->dev); - pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); =20 return ret; } =20 static void xiic_i2c_remove(struct platform_device *pdev) { + struct device *dev =3D &pdev->dev; struct xiic_i2c *i2c =3D platform_get_drvdata(pdev); int ret; =20 /* remove adapter & data */ i2c_del_adapter(&i2c->adap); =20 - ret =3D pm_runtime_get_sync(i2c->dev); + ret =3D pm_runtime_get_sync(dev); =20 if (ret < 0) - dev_warn(&pdev->dev, "Failed to activate device for removal (%pe)\n", + dev_warn(dev, "Failed to activate device for removal (%pe)\n", ERR_PTR(ret)); else xiic_deinit(i2c); =20 - pm_runtime_put_sync(i2c->dev); - pm_runtime_disable(&pdev->dev); - pm_runtime_set_suspended(&pdev->dev); - pm_runtime_dont_use_autosuspend(&pdev->dev); + 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 { --=20 2.52.0 From nobody Mon Feb 9 00:05:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 393DA305066; Fri, 23 Jan 2026 16:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186057; cv=none; b=nOQMMsRbUJ75hQmBfIh04FKOqHHdMui3ABhy2XTvOGABTeBNxmuRRatvxChB/uzxGH/TotJJiVVygn/Ka4JRtxnedJf69WYFrrvPrKLI8KciwUbF+arHg5jNWmL1IT7CtNLS/mVuiHwzeLcn8ul+4A+UZf2qAqJ4RWRxGFi2x3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186057; c=relaxed/simple; bh=0j9fka9qYEljxA2gF2TFcdOGxmcCOdV/rmK49EHEP+0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tdlGoEo0zErLbcsnuYl3dklLqhGSh/np0SGehJhytMvJaG8B/OklWkSGYguTkqqf0AsOKgZPvmiFcm+mA2Eb4xDTXUhYT+rzO0YJ6HTpE9jVXRz/i7igY1+N1h+4B0fL+5Sr4Wj7v9OTd/zT4Z63b0VVluJejbudFM2LYw1tDjk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I7zBMseF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I7zBMseF" Received: by smtp.kernel.org (Postfix) with ESMTPS id E110DC19421; Fri, 23 Jan 2026 16:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769186057; bh=0j9fka9qYEljxA2gF2TFcdOGxmcCOdV/rmK49EHEP+0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=I7zBMseFop7gn5wUH3Gy2Z+oom+2FKUWp1yajwGARs3SqTDXcgRq9LfpTYaqlq73B E19os8fjCaySlALvD8m3eoTxbSK8tGOpG0TT/PnYU//UH1qjjGDjNQv6N374q2DIk6 90a1p+dZOncsl32kQV91sS5UTXqDAeO2xl5LQVQE2CSohDjaUm6scUxiR8TLdEgpuv GPOezWseLPhlfI9aCmBoeYFccxRmnX84hCqk67/7HSFYbqGfKsLB1oJR86vJE5LJB+ p9dhJLFtgoufvlVSj4/uaycvbujs+E7nUOM7wfKSfOFn/TTMVweDe+MntMi7rmPRi0 SrHE3iMMoxq7Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3962D6CFD7; Fri, 23 Jan 2026 16:34:16 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 23 Jan 2026 16:34:15 +0000 Subject: [PATCH v4 2/5] i2c: xiic: make the clock optional 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: <20260123-i2c-xiic-v4-2-4a3eba3510ce@nexthop.ai> References: <20260123-i2c-xiic-v4-0-4a3eba3510ce@nexthop.ai> In-Reply-To: <20260123-i2c-xiic-v4-0-4a3eba3510ce@nexthop.ai> To: Michal Simek , Andi Shyti Cc: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769186056; l=1147; i=abdurrahman@nexthop.ai; s=20260119; h=from:subject:message-id; bh=epD2VW7nyikMBdytoxP7e2Rce+7IIwA5ENNJm0jD8gY=; b=D9uydca7fy2OIAMy8n1HUFnVYz4YxJwcME46moeenGRF3EONXGqNcmYgkvV5+CtF0DohQcWRv XMv8nFAHL5sDzRkNr8AWxvqu7jJNbOr/IPTQ/XAgLhDipB2EtSVoSLQ X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=S+ysnf+NwMcBdHBlyKIUEAtaFGSIhQwcJcgcXhq0osg= X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/20260119 with auth_id=608 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain The xiic driver is designed to operate without explicit clock configuration when clocks are not specified in the firmware. This functionality is already implemented in xiic_setclk(), which performs an early return when either i2c_clk or input_clk are zero: This condition is satisfied when clocks are missing, as clk_get_rate(NULL) returns zero, allowing the driver to rely on hardware-configured timing. Signed-off-by: Abdurrahman Hussain --- drivers/i2c/busses/i2c-xiic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 12321654055f..2da7e9d1d5ca 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -1465,7 +1465,7 @@ static int xiic_i2c_probe(struct platform_device *pde= v) mutex_init(&i2c->lock); spin_lock_init(&i2c->atomic_lock); =20 - i2c->clk =3D devm_clk_get_enabled(dev, NULL); + i2c->clk =3D devm_clk_get_optional_enabled(dev, NULL); if (IS_ERR(i2c->clk)) return dev_err_probe(dev, PTR_ERR(i2c->clk), "failed to enable input clock.\n"); --=20 2.52.0 From nobody Mon Feb 9 00:05:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 393182F99B8; Fri, 23 Jan 2026 16:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186057; cv=none; b=monRHlAMG1beYwAWlEVN9B05G+uZmcCqDNxrTuJK3HJpx58J1BCB6T3u9D2hnwGz+dSb4Ivcp7UD1xtY4qMy7G/VraHqVOSHYIvrMR4RJbhrAAtLcHilQY0aVE1awFHWJQdDsMmLeYQAiAdbXSuSLCKAOvBn1JD1fA9AHGCKQGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186057; c=relaxed/simple; bh=/kZ+kma1og4vRIL1r88KYLIWI/ylSgoxJtILoW3MkpQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Mq+bIhk8aKVSTpwOMaWPpH0tBr+5Ll8XypCD/8a3I2jRwcNl7lDBdIdkSexTHQ1o8F3X18yHQqFC1okrMzAWKb3la/Rjq8MAWcaw7yT9OpwWHzIhX+/wAayEEprndfdi4bkH5pq5cYHOOVBKHvVNArGKoBd0WgyW8GSS/7SiQr0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bVi/QwtI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bVi/QwtI" Received: by smtp.kernel.org (Postfix) with ESMTPS id EA5DAC19424; Fri, 23 Jan 2026 16:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769186057; bh=/kZ+kma1og4vRIL1r88KYLIWI/ylSgoxJtILoW3MkpQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=bVi/QwtIw8uqTnKTsXNGme0jiBrWH4bvY4Sx7oJFH+8f1yWf5sM1sPScZgOCyMs4P LNY1u0cP4zLS9u86fuaKM3kYVfJMxsqgiEL/OJqPmo4IvpN0WNoPXlvMDwEAiA+A2h REcR9DOVBiV6nVVevUJ+m05MVhQE3wsKxlvzg4DI29DlbBtrjHdVV8VFY8R2V7LkY2 PkMow6Y1MU4m9dBkzjdW4GeDlzu2bBANtTOc8Rtp7wY1OZ5BN76Uzt7DEyt8p2jGr2 FKIWh9/KtC97qgHZI+bwXtk0heCR5RtgRUz/t3yg5mLAcYYx+lQxEuRzczBLLrh653 EjLKM7Ffmi13g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0BA7D72371; Fri, 23 Jan 2026 16:34:16 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 23 Jan 2026 16:34:16 +0000 Subject: [PATCH v4 3/5] i2c: xiic: switch to devm_ managed apis to simplify the error code paths 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: <20260123-i2c-xiic-v4-3-4a3eba3510ce@nexthop.ai> References: <20260123-i2c-xiic-v4-0-4a3eba3510ce@nexthop.ai> In-Reply-To: <20260123-i2c-xiic-v4-0-4a3eba3510ce@nexthop.ai> To: Michal Simek , Andi Shyti Cc: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769186056; l=2482; i=abdurrahman@nexthop.ai; s=20260119; h=from:subject:message-id; bh=XbK+CsMc3APHOOXbUz+q5n+IsW+oIYdY5pzCy9rqMqo=; b=k35E0GXsoob5esmQwD9M0HPEhmsWR+DRjgaOdoF/JhihDiy794tnusnmsq940m+6M9wGWHHay 2cN6x42rEPtBYXqH/cx6X7+8g/k4VecVLBqBzOnFeps5v/ri4qOyyur X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=S+ysnf+NwMcBdHBlyKIUEAtaFGSIhQwcJcgcXhq0osg= X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/20260119 with auth_id=608 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain Simplify the error code paths by switching devm_mutex_init() and devm_pm_runtime_set_active_enabled(). Signed-off-by: Abdurrahman Hussain --- drivers/i2c/busses/i2c-xiic.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 2da7e9d1d5ca..6d47c9972719 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -1462,7 +1462,10 @@ static int xiic_i2c_probe(struct platform_device *pd= ev) snprintf(i2c->adap.name, sizeof(i2c->adap.name), DRIVER_NAME " %s", pdev->name); =20 - mutex_init(&i2c->lock); + ret =3D devm_mutex_init(&pdev->dev, &i2c->lock); + if (ret < 0) + return ret; + spin_lock_init(&i2c->atomic_lock); =20 i2c->clk =3D devm_clk_get_optional_enabled(dev, NULL); @@ -1473,8 +1476,9 @@ static int xiic_i2c_probe(struct platform_device *pde= v) i2c->dev =3D dev; pm_runtime_set_autosuspend_delay(dev, XIIC_PM_TIMEOUT); pm_runtime_use_autosuspend(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); + ret =3D devm_pm_runtime_set_active_enabled(dev); + if (ret < 0) + return ret; =20 /* SCL frequency configuration */ i2c->input_clk =3D clk_get_rate(i2c->clk); @@ -1489,7 +1493,7 @@ static int xiic_i2c_probe(struct platform_device *pde= v) =20 if (ret < 0) { dev_err_probe(dev, ret, "Cannot claim IRQ\n"); - goto err_pm_disable; + return ret; } =20 i2c->singlemaster =3D @@ -1510,14 +1514,14 @@ static int xiic_i2c_probe(struct platform_device *p= dev) ret =3D xiic_reinit(i2c); if (ret < 0) { dev_err_probe(dev, ret, "Cannot xiic_reinit\n"); - goto err_pm_disable; + return ret; } =20 /* add i2c adapter to i2c tree */ ret =3D i2c_add_adapter(&i2c->adap); if (ret) { xiic_deinit(i2c); - goto err_pm_disable; + return ret; } =20 if (pdata) { @@ -1529,12 +1533,6 @@ static int xiic_i2c_probe(struct platform_device *pd= ev) dev_dbg(dev, "mmio %08lx irq %d scl clock frequency %d\n", (unsigned long)res->start, irq, i2c->i2c_clk); =20 - return 0; - -err_pm_disable: - pm_runtime_disable(dev); - pm_runtime_set_suspended(dev); - return ret; } =20 @@ -1556,8 +1554,6 @@ 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 --=20 2.52.0 From nobody Mon Feb 9 00:05:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 445C33081B0; Fri, 23 Jan 2026 16:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186057; cv=none; b=oPgdGY6FdahGBPMhcU6RgjtOeyqZUMVdg40nShhSLeg/Rn+Mp89rBX0PqjrP7n7zIR4i3T3DnSN3N5A0jepxXowjEwBtUPobj8e2pSy9UVazUKVGbmJjI6sSh1cJcb17a4LooZrjHE3mb3lQu5W715JzR5pw8cOqbbtnZMqP1Ek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186057; c=relaxed/simple; bh=Uwth4qQHTqLwY75OKA44FVxHDgLRiSU4SpL+uWLAnHQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ogf27tMFJf0hUekNhdXtZNt8RYbKArpgl3vTAPZLoN4+jwIEowRdjpZkGpozZPMGodhvukXR/POcZtp+tIHOUMKalZt7bfW86WviSSUd3QX5RVxGKegffwonYdWGmSrWmABV5nGZhHCG5Xkpyu+95GnOKBUEQrd5UTHiZ7F6uMw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=phg4aZ3L; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="phg4aZ3L" Received: by smtp.kernel.org (Postfix) with ESMTPS id 04DB9C2BC9E; Fri, 23 Jan 2026 16:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769186057; bh=Uwth4qQHTqLwY75OKA44FVxHDgLRiSU4SpL+uWLAnHQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=phg4aZ3L6uad6Zyl19V4tpu029pg4BalZYOeH4yb/P1e8qu6m5tKRdx7qERNh+TgL g6/tg8mhIytDyJFtWDikAdA+75BUE9XyONFXzZ/Rb/9sZ7wbdWusZ0n6JsJbCOZG3F 5ehBlMau0UoU2i3IvW6SnqZIA1TyHrRDJX4BPLcJ1lz2j5q0kQVWpFht225h+53Jv2 WGv5/IEnT3hjfvel4kd0VhssX623UPqVItZ5I8WsGw11alRRFC44zFDvThL6QaxxLI a3XUH9eXsLZ7LERNKI5GnaR7DlO8RQWX/QOjIuZxcsxe/LHrPSDaaU7ZmR0UElV2vo X6bdZvDlWs0pw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE73ED6CFA7; Fri, 23 Jan 2026 16:34:16 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 23 Jan 2026 16:34:17 +0000 Subject: [PATCH v4 4/5] i2c: xiic: remove duplicate error message 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: <20260123-i2c-xiic-v4-4-4a3eba3510ce@nexthop.ai> References: <20260123-i2c-xiic-v4-0-4a3eba3510ce@nexthop.ai> In-Reply-To: <20260123-i2c-xiic-v4-0-4a3eba3510ce@nexthop.ai> To: Michal Simek , Andi Shyti Cc: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769186056; l=832; i=abdurrahman@nexthop.ai; s=20260119; h=from:subject:message-id; bh=BSG/SlNQJILNTQbChjjZzK6BX9LQhT0R0SiLAYGmwP0=; b=t0BNbvH3/YpRUwikr6asJyBLXrzq6x9Q0JfwDHrCRBlEXFsYW4E2uVF2n7yiAIgM599aax/1O FVC8s6Uy88lDmkb899+kUDIqiIDSZBIXbpqxwOhNkM58eUdSwizZ3Or X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=S+ysnf+NwMcBdHBlyKIUEAtaFGSIhQwcJcgcXhq0osg= X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/20260119 with auth_id=608 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain The devm_request_threaded_irq() already prints an error message. Remove the duplicate. Signed-off-by: Abdurrahman Hussain --- drivers/i2c/busses/i2c-xiic.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 6d47c9972719..800a27413978 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -1491,10 +1491,8 @@ static int xiic_i2c_probe(struct platform_device *pd= ev) ret =3D devm_request_threaded_irq(dev, irq, NULL, xiic_process, IRQF_ONESHOT, pdev->name, i2c); =20 - if (ret < 0) { - dev_err_probe(dev, ret, "Cannot claim IRQ\n"); + if (ret < 0) return ret; - } =20 i2c->singlemaster =3D of_property_read_bool(dev->of_node, "single-master"); --=20 2.52.0 From nobody Mon Feb 9 00:05:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6473430E0F9; Fri, 23 Jan 2026 16:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186057; cv=none; b=G60r6gLphOVR2zLg6lqKDzqH8auR2QBSg2mYw0gq6+qOnyh+r9u5OvuSaYcRJ+PHmDfga2CeExg+4zc844/NJQNSBlUetUsYIsblzr7j3jkhXOr4PBEOmgniufmOkjwEww4ryA5j04mIp6snCK4Q37SvSa4/rKF8XxUORU2/Peo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186057; c=relaxed/simple; bh=apN1b+EezFacC+qjuAQtj456Ag24dmmsc1OGhTskqs8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OdMV0IqHLCuTZMezHWlu1uaVpGoFCA/ZNO9SFM7no1qpcnC6TiQaaWvFcMaHhwKysJNtRu4wZDrIIsnGPSbU9LTvXFxeRHT6oF/A4mWz2/cb8h2ul/B5ETdmrYnKA5ABwxW9y1eQciM3UgLn3iHclWkkqEj2k4wdVxzslzjwVc0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LaJ3WvO4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LaJ3WvO4" Received: by smtp.kernel.org (Postfix) with ESMTPS id 0DCF4C2BC87; Fri, 23 Jan 2026 16:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769186057; bh=apN1b+EezFacC+qjuAQtj456Ag24dmmsc1OGhTskqs8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LaJ3WvO4tZ8UGQlTgvarZvYPJ1MAMSsfOJDcv8YPnp5cp9JqfJEWpzNVqcAG5XJEY tH4SEXxeosYptq75HKkEMWDVrVWRwPWxjQWQYUaB6047vXvBrMZ0TmrNmhpO0ZKmlq u7Ycaz17nGaLTI2D7C6936kqxINuGwU7wMgPN56sgs1XWnlSBxxUVQEYgQvR0ndia7 zy2XC0EkSCEsuUTF/8vwrTQcDByIBpFUfbzyXROwtbEMf06G7An97My4CPsteGG5Sh U51UplPwrL/AaTMVIBM86mle+BT6LQfcisA22zkTrCyp8DNfJERJyUY7nlNwJ+UVVX fsO3VX2qZY/qg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07076D7237B; Fri, 23 Jan 2026 16:34:17 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 23 Jan 2026 16:34:18 +0000 Subject: [PATCH v4 5/5] i2c: xiic: switch to generic device property accessors 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: <20260123-i2c-xiic-v4-5-4a3eba3510ce@nexthop.ai> References: <20260123-i2c-xiic-v4-0-4a3eba3510ce@nexthop.ai> In-Reply-To: <20260123-i2c-xiic-v4-0-4a3eba3510ce@nexthop.ai> To: Michal Simek , Andi Shyti Cc: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769186056; l=2907; i=abdurrahman@nexthop.ai; s=20260119; h=from:subject:message-id; bh=6N04KTIpIe9uMfd715SAHiqS6vRoJRqDBiumzlWnGDQ=; b=4oaNZy9uKbS3W4B/M27EwmlJ72yO2kLyR11GzJ+HcTLfSnqDmLfkC3V3I3rjq+VDwaJfDyZdX yGONqpiyZ47BSer8eLYvHi3AuVhJGMY9JK9bLYci/teeuapVcnn+Zz9 X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=S+ysnf+NwMcBdHBlyKIUEAtaFGSIhQwcJcgcXhq0osg= X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/20260119 with auth_id=608 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain Use generic device property accessors. Signed-off-by: Abdurrahman Hussain --- drivers/i2c/busses/i2c-xiic.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 800a27413978..dfb8fa2787b2 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -1408,7 +1407,6 @@ static const struct i2c_adapter xiic_adapter =3D { .algo =3D &xiic_algorithm, }; =20 -#if defined(CONFIG_OF) static const struct xiic_version_data xiic_2_00 =3D { .quirks =3D DYNAMIC_MODE_READ_BROKEN_BIT, }; @@ -1419,14 +1417,13 @@ static const struct of_device_id xiic_of_match[] = =3D { {}, }; MODULE_DEVICE_TABLE(of, xiic_of_match); -#endif =20 static int xiic_i2c_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; struct xiic_i2c *i2c; struct xiic_i2c_platform_data *pdata; - const struct of_device_id *match; + const struct xiic_version_data *data; struct resource *res; int ret, irq; u8 i; @@ -1436,12 +1433,9 @@ static int xiic_i2c_probe(struct platform_device *pd= ev) if (!i2c) return -ENOMEM; =20 - match =3D of_match_node(xiic_of_match, dev->of_node); - if (match && match->data) { - const struct xiic_version_data *data =3D match->data; - + data =3D device_get_match_data(dev); + if (data) i2c->quirks =3D data->quirks; - } =20 i2c->base =3D devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(i2c->base)) @@ -1458,7 +1452,7 @@ static int xiic_i2c_probe(struct platform_device *pde= v) i2c->adap =3D xiic_adapter; i2c_set_adapdata(&i2c->adap, i2c); i2c->adap.dev.parent =3D dev; - i2c->adap.dev.of_node =3D dev->of_node; + device_set_node(&i2c->adap.dev, dev_fwnode(dev)); snprintf(i2c->adap.name, sizeof(i2c->adap.name), DRIVER_NAME " %s", pdev->name); =20 @@ -1482,8 +1476,7 @@ static int xiic_i2c_probe(struct platform_device *pde= v) =20 /* SCL frequency configuration */ i2c->input_clk =3D clk_get_rate(i2c->clk); - ret =3D of_property_read_u32(dev->of_node, "clock-frequency", - &i2c->i2c_clk); + ret =3D device_property_read_u32(dev, "clock-frequency", &i2c->i2c_clk); /* If clock-frequency not specified in DT, do not configure in SW */ if (ret || i2c->i2c_clk > I2C_MAX_FAST_MODE_PLUS_FREQ) i2c->i2c_clk =3D 0; @@ -1494,8 +1487,7 @@ static int xiic_i2c_probe(struct platform_device *pde= v) if (ret < 0) return ret; =20 - i2c->singlemaster =3D - of_property_read_bool(dev->of_node, "single-master"); + i2c->singlemaster =3D device_property_read_bool(dev, "single-master"); =20 /* * Detect endianness --=20 2.52.0