From nobody Sat Feb 7 21:05:34 2026 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 52F08369997 for ; Fri, 30 Jan 2026 11:10:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769771451; cv=none; b=Hb9As5eO5wNaP+Bwl28Tgt+2IqTcugdWJoGhBHaF+Im6ozghwQOI1GDpSvbHF8SAloZxAakTTRUaQYngb0U4VyPvuVHpbX/u3b7rERofq0RQRWnwLExxl3gk/PR3YPA5u3efMBqwe3yqxt6RibUVfvlDwlSDb8uDoGE/j0vk5M8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769771451; c=relaxed/simple; bh=000+YBcuqnKUv4T+6H0j6GbJbdg7y/YIwvOiUVAuiIA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eu+e3QF350NIJkl8sLnbreUPV/ZXKJncQpNWpSUrm+nUS0ZuChL2Ls45aW8ZE9ziKQP7iwIfRDhw1QfQwVrJW5X1HODjHMsjAL5Tf29mSVq/vZi1jaBtVcEBLlEzf/UTRwDRIt3F4a7qXvYxNPQ59WKpO+NrBv/eITGcu+Avs3o= 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=lPLn96aB; arc=none smtp.client-ip=209.85.218.51 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="lPLn96aB" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-b884ad1026cso317849266b.2 for ; Fri, 30 Jan 2026 03:10:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769771449; x=1770376249; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mWmsh3XdIKcxTYGWYNNKasGhX6YaVuG1V2PZUGcRH+U=; b=lPLn96aBRFDSKUMt/g0TTD7xjWAgbaSWZsAhIUabtVGOMmHK2rU8Xe3n5f4OuAefwH 5GCuGEuQa75uLGZte+SLmcsCC44xIfJrIXED7k2YEn5rAxWVH6dTn3D5ptlKSo1CgUGD cIztjsOjqbD/uVMMPBUI995pSxl4tAcBDEAlPz5Rvhpm4iYL0iK38m2J1vZhsLZcS42m jCK4Ct/7UgTZvAgIWXZE1HZVad1fQeRbLWzIC3Gf3/YLX2ugfj8/Kh0ilNlEZuS9c9w7 wNBQI93AZMx9WKE4bxIjKPe0yIncDxadI7FkX6J+8rGBnDa1z9ZHUK2izDlBpJ4cjE4F HxXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769771449; x=1770376249; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mWmsh3XdIKcxTYGWYNNKasGhX6YaVuG1V2PZUGcRH+U=; b=VsAjxa7VZUUBG30JDw9FvV9b11zTUDxpqNVO2g6iMNczX/v4oPsrpW8qZcae2eGAFn RVFwCCVuk48W+PY9cU0D18almAOYgXcOFY0tfIP9tBVu3ahy1Fa+5OotDYdJhumhCXAv RzLQ9EjfOv7cIq3BifeftVqDi6nehPSTWXXEKdbSt4MlyU4AS/p6y536FYDPth23J/2z LNTkkT0K7f5qaKQU9g2VK4GKbXHko2K0BByCk8zixMLouJ1O9dyBS449pefNtVMyJAtN 0NgjCpH8ejSB/LuFEUn0Z51vhKkqkZ+krNyxzbXbMNH3wcbrXZX+ogrOxOaSGoK4ghve eeVA== X-Forwarded-Encrypted: i=1; AJvYcCUCtB8aOYI72MnO2RGvKw60VGmZbiKArS/N0aoFTo+ocLFxlc3L78DHKoB64Azd8zuiB1F1jC4J8+lu5Kg=@vger.kernel.org X-Gm-Message-State: AOJu0YxqBBM+1J/2rWO1DaOU2dMUq5DW8OO30YIFhwd2ZMZDdeypf70W ta0UGrfQebmz/hmYtP0xa+uSy07NnXT3q1nWmDu8SQQvBij/3yH/VgMe X-Gm-Gg: AZuq6aKTiQYNM+dZPazUoreifQf7USAqxx+lOP1GELBBB8Vo678kOovHCBi43JpaZY1 q3xUpq+cnGasS+MIjA/kHleTyOaIRPW0yPDJE3XGcsH5DXUvfb05REnPxw5ljOLZEmJMwzWuXXF r+TokcAa8PYIOkoB3e8V29I16XaKuaiunmQBl65BYgXBq/ciYM4IrL7XJrdDmtH7uw4sjsvUYIg 9uwL4y+IUOqk2IsYGK7uFAPFD90bFXOooywFx8oOaaqcSn9C1uFLbtNjbzIoueCFvxKI1G+37wW TecoOzjVZz2UN6kdeNfvCS3+YpWn09cA64TU5Z2QMJGWkHyT+igZ9VWWQxcClrTzAGhvL/tn7yl JBr5ENHrO+AvIKr4or0hLw+F+cdUh9bfly9ZMk1A1Sd1K9tGzOfdlcJ445Hz9ApqIh2Lxe/y4kX TdbQtShlGl8MDvV3hcHiJPhlPe6aZjBw== X-Received: by 2002:a17:907:948a:b0:b88:646b:ae31 with SMTP id a640c23a62f3a-b8dff6f79d8mr126642666b.47.1769771448498; Fri, 30 Jan 2026 03:10:48 -0800 (PST) Received: from NB-6746.corp.yadro.com ([188.243.183.148]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8dbeffedd3sm396035666b.29.2026.01.30.03.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 03:10:48 -0800 (PST) From: Artem Shimko To: andi.shyti@kernel.org, p.zabel@pengutronix.de, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, jsd@semihalf.com Cc: Artem Shimko , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 1/2] i2c: designware-platdrv: simplify reset control Date: Fri, 30 Jan 2026 14:10:36 +0300 Message-ID: <20260130111039.874548-2-a.shimko.dev@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260130111039.874548-1-a.shimko.dev@gmail.com> References: <20260130111039.874548-1-a.shimko.dev@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The current implementation uses separate calls to acquire and deassert reset control, requiring manual error handling for the deassertion operation. This can be simplified using the dedicated devm function that combines both operations. Replace devm_reset_control_get_optional_exclusive() with devm_reset_control_get_optional_exclusive_deasserted(), which handles both reset acquisition and deassertion in a single call as well as reset_control_put() which is called automatically on driver detach. This eliminates the need for explicit deassertion and its associated error checking while maintaining the same functional behavior through automatic resource management. Signed-off-by: Artem Shimko Acked-by: Mika Westerberg --- drivers/i2c/busses/i2c-designware-platdrv.c | 30 +++++++-------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/buss= es/i2c-designware-platdrv.c index 7be99656a67d..88e70970c72c 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -227,40 +227,32 @@ static int dw_i2c_plat_probe(struct platform_device *= pdev) if (ret) return ret; =20 - dev->rst =3D devm_reset_control_get_optional_exclusive(device, NULL); + dev->rst =3D devm_reset_control_get_optional_exclusive_deasserted(device,= NULL); if (IS_ERR(dev->rst)) return dev_err_probe(device, PTR_ERR(dev->rst), "failed to acquire reset= \n"); =20 - reset_control_deassert(dev->rst); - ret =3D i2c_dw_fw_parse_and_configure(dev); if (ret) - goto exit_reset; + return ret; =20 ret =3D i2c_dw_probe_lock_support(dev); - if (ret) { - dev_err_probe(device, ret, "failed to probe lock support\n"); - goto exit_reset; - } + if (ret) + return dev_err_probe(device, ret, "failed to probe lock support\n"); =20 i2c_dw_configure(dev); =20 /* Optional interface clock */ dev->pclk =3D devm_clk_get_optional(device, "pclk"); - if (IS_ERR(dev->pclk)) { - ret =3D dev_err_probe(device, PTR_ERR(dev->pclk), "failed to acquire pcl= k\n"); - goto exit_reset; - } + if (IS_ERR(dev->pclk)) + return dev_err_probe(device, PTR_ERR(dev->pclk), "failed to acquire pclk= \n"); =20 dev->clk =3D devm_clk_get_optional(device, NULL); - if (IS_ERR(dev->clk)) { - ret =3D dev_err_probe(device, PTR_ERR(dev->clk), "failed to acquire cloc= k\n"); - goto exit_reset; - } + if (IS_ERR(dev->clk)) + return dev_err_probe(device, PTR_ERR(dev->clk), "failed to acquire clock= \n"); =20 ret =3D i2c_dw_prepare_clk(dev, true); if (ret) - goto exit_reset; + return ret; =20 if (dev->clk) { struct i2c_timings *t =3D &dev->timings; @@ -308,8 +300,6 @@ static int dw_i2c_plat_probe(struct platform_device *pd= ev) exit_probe: dw_i2c_plat_pm_cleanup(dev); i2c_dw_prepare_clk(dev, false); -exit_reset: - reset_control_assert(dev->rst); return ret; } =20 @@ -329,8 +319,6 @@ static void dw_i2c_plat_remove(struct platform_device *= pdev) dw_i2c_plat_pm_cleanup(dev); =20 i2c_dw_prepare_clk(dev, false); - - reset_control_assert(dev->rst); } =20 static const struct of_device_id dw_i2c_of_match[] =3D { --=20 2.43.0