From nobody Thu Mar 5 16:33:21 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 EA21E309F00; Mon, 23 Feb 2026 15:59:19 +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=1771862360; cv=none; b=nDPVA3cBGRZGiItinISAb1PvbmUGyD81et4h7q8UVRXIRY+RIB/NvAXffjccu1Nm84TyWNPW4lSc7Y7NhGW2ZxVCnWSYW+NRru/VylEYRM4LA2Cgc5R689Mipzk/RP19Qdt/1uBTfxQ6YeUqG+XyII7mTpgdPgsQR9EwfcXsUuE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771862360; c=relaxed/simple; bh=odmV5niUZmpfJnRwHXoQMD5/apRHKE+2PCyK8AQML/I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kMhElMT9INakDSSxjh6awiEB9I8XPXxTupy0gHBM75rZG22f4LWmm7FJNfkaBFyTOcqF9M30C0GeWAr9V1vdi4i+lpT2k45X/Q+jvYyS4n4QPTjpdPuuRYRfP/opS3rEuFKrBsXJAd+xoMBV5lbwqj6q/yvdsPxy/Ngxp3N+0EM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ufMULU1Q; 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="ufMULU1Q" Received: by smtp.kernel.org (Postfix) with ESMTPS id AE240C19424; Mon, 23 Feb 2026 15:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771862359; bh=odmV5niUZmpfJnRwHXoQMD5/apRHKE+2PCyK8AQML/I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ufMULU1Q1nU+iY5SbLAwKRFE/BGEl+MR0c8BBk2cCaVyvdurdu0l4Ptfe3Q8epKXb WFjEuYV8rOtDy2ckKOXTWb+OD7Mxt+03pkSTbrd96EvjB0Mluhsp+7eoOllejiaqgm 1DyCeNmTXHS4FEGKBE/QFovjU1cZbV6s07jI2WPcb9NSpPIRguBf4mLtJIgzBjsRkP /pDM4gKSrmltuOIf3rl9+b9qgHUsMtEHG0STs25rOqYHkjfwdvUJNhJN90T32kqL7w AUpLe9Gw1N6+qSHVr9HzJk27ZSAF1cLvuP4JqjYpwbPYnIgk+PlFjB1U/PR/4Ugf7U LwZpLILFSh3Bw== 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 9E86CE98E1E; Mon, 23 Feb 2026 15:59:19 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Mon, 23 Feb 2026 15:59:16 +0000 Subject: [PATCH v12 1/7] i2c: xiic: switch to devres managed APIs 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: <20260223-i2c-xiic-v12-1-b6c9ce4e4f3c@nexthop.ai> References: <20260223-i2c-xiic-v12-0-b6c9ce4e4f3c@nexthop.ai> In-Reply-To: <20260223-i2c-xiic-v12-0-b6c9ce4e4f3c@nexthop.ai> To: Michal Simek , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1771862359; l=2992; i=abdurrahman@nexthop.ai; s=20260119; h=from:subject:message-id; bh=xe5Qq7Si6KCzd0ih/kyZJPCw0i78NqZP8R5Fx1dBPLI=; b=dSWr0yb7yLam0ZeenJw4Q8x+zVLKvodtxjR4j7snA0Cpx8wy4SBYXzX9IU6GQ1X4EvMTyRhgM jPoKoS4tr5xD5+Hsxx0Ay32J1DWFTxS+2XlA1LfiDl0j9OdXERcht0c 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 to devres managed helper functions. Reviewed-by: Andy Shevchenko Signed-off-by: Abdurrahman Hussain --- drivers/i2c/busses/i2c-xiic.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 28015d77599d..65aa280f6fd9 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; @@ -1461,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(dev, &i2c->lock); + if (ret) + return ret; + spin_lock_init(&i2c->atomic_lock); =20 i2c->clk =3D devm_clk_get_enabled(&pdev->dev, NULL); @@ -1472,8 +1476,9 @@ static int xiic_i2c_probe(struct platform_device *pde= v) 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); + ret =3D devm_pm_runtime_set_active_enabled(dev); + if (ret) + return ret; =20 /* SCL frequency configuration */ i2c->input_clk =3D clk_get_rate(i2c->clk); @@ -1489,7 +1494,7 @@ static int xiic_i2c_probe(struct platform_device *pde= v) =20 if (ret < 0) { dev_err_probe(&pdev->dev, ret, "Cannot claim IRQ\n"); - goto err_pm_disable; + return ret; } =20 i2c->singlemaster =3D @@ -1508,16 +1513,14 @@ static int xiic_i2c_probe(struct platform_device *p= dev) i2c->endianness =3D BIG; =20 ret =3D xiic_reinit(i2c); - if (ret < 0) { - dev_err_probe(&pdev->dev, ret, "Cannot xiic_reinit\n"); - goto err_pm_disable; - } + if (ret) + return dev_err_probe(dev, ret, "Cannot xiic_reinit\n"); =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) { @@ -1530,12 +1533,6 @@ static int xiic_i2c_probe(struct platform_device *pd= ev) (unsigned long)res->start, irq, i2c->i2c_clk); =20 return 0; - -err_pm_disable: - pm_runtime_disable(&pdev->dev); - pm_runtime_set_suspended(&pdev->dev); - - return ret; } =20 static void xiic_i2c_remove(struct platform_device *pdev) @@ -1555,9 +1552,6 @@ static void xiic_i2c_remove(struct platform_device *p= dev) 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); } =20 static const struct dev_pm_ops xiic_dev_pm_ops =3D { --=20 2.52.0