From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795015913; b=dfn8tu7mWoZbNOEhBhlzS4c8uTDqKtVAKsqpd/RW+siol8bad1pdKYZOKOQuXziQY5Ga xpOerZB/Znz85j8K5YaK63IFAphef0PuuVajyUP16P+OZE4fEORyQK6pW+v47u/+SqGsQ L0O8oalmSr6AuVQ1yPcjQFihXO8hkUpAIpYXCg79RGamTUFSA9Lyylq2RoEd8DpijXapg rVPzMH8ZUVB0tQ7eFJGxbAgOEOrq+dRcuWpTsBKza0xxVcEIDldLMwf8WcDVjBWJwuJ2c L0alBA8aax8gqhehUIrRuJcB1dExwoSBW7dnlEoz6kSOesy+3ivT4ZstpjwpypTIX3Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795015913; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Xc8jHRydHzbCuZEaxpjSxNeNrWr/wZa/jfw3jiE+yvc=; b=2HRcA6FfKdC3XxNGkIjT8PzhAYnS06P04U5G7hpCDHCWiNYAEZW0brP85lT3cLZ5YQdH NmwXyCij/8Obj9+yYjI7Ejp+l9QcnLb+0MTatTcTsIE4SdWPPSH5unj60SxtJ2v2mgdOX lSYn8JqbmUKUpZtANnHqgCcq8AVD4EDEfwI2U4b2Wj4vitRo7JKg0V0P5MzF/vTcPUotg LbK//Ma3sBuLWMraVrUK4hL/E/Qqw17haQPtuXZhPnL5e52pDO0S/wvt1njrTLSwcm2NE qx75YGfzPfBPzsG3Pt5BEnb3GzmikRCURZshZPa3Y1dQ+J0PCw0BW7UT+wrtzDpgAqg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=FHYRxkzH; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 881EB606A32A; Wed, 18 Nov 2026 15:31:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=FHYRxkzH Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD2DA1F000C4; Wed, 18 Nov 2026 15:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795015913; bh=Xc8jHRydHzbCuZEaxpjSxNeNrWr/wZa/jfw3jiE+yvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FHYRxkzHJKG/D0giqgpuv7+hYSOOhbgadPpTKwjE3Q5uTfmPZuIEpPwrBo6iu2Dgs KFA0F+56kpPMIvPIcrxEK2L23pDgZX83zU36xjsOFx6TD/+k3Ia6bLbU0LImpKqgH8 ivwsLzq6OBeWH86B+U6nLuJpVOjT9mrurtu9nFdI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chaithanya Lagisetty , Frank Li , Vinod Koul , Sasha Levin Subject: [PATCH 7.3 0301/2651] dmaengine: dw-axi-dmac: convert clock handling to clk_bulk API Date: Wed, 18 Nov 2026 15:25:41 +0100 Message-ID: <20261118150258.738832038@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150247.972732815@linuxfoundation.org> References: <20261118150247.972732815@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chaithanya Lagisetty [ Upstream commit c843417e6d6b55e24318e2edf405566e70786d3b ] The driver managed its two mandatory clocks (core-clk and cfgr-clk) individually. This was error prone: axi_dma_resume() enabled cfgr_clk and then core_clk, and if enabling core_clk failed it returned the error without disabling cfgr_clk, leaving the clock refcount unbalanced. Convert the driver to the clk_bulk API. The two clocks are always acquired, enabled and disabled together, so a clk_bulk_data array expresses this naturally and shrinks the get/enable/disable paths. clk_bulk_prepare_enable() also unwinds any clock it already enabled when a later one fails, which fixes the resume imbalance. Fixes: 1fe20f1b8454 ("dmaengine: Introduce DW AXI DMAC driver") Signed-off-by: Chaithanya Lagisetty Link: https://lore.kernel.org/all/20260813105432.2577322-1-nagachaithanya9911@gmail.com/ Reviewed-by: Frank Li Link: https://patch.msgid.link/20260816054858.2667380-1-nagachaithanya9911@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- .../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 28 ++++++++----------- drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 3 +- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c index eebed2474210d..9c21a5479437d 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -1320,8 +1320,7 @@ static int axi_dma_suspend(struct axi_dma_chip *chip) axi_dma_irq_disable(chip); axi_dma_disable(chip); - clk_disable_unprepare(chip->core_clk); - clk_disable_unprepare(chip->cfgr_clk); + clk_bulk_disable_unprepare(ARRAY_SIZE(chip->clks), chip->clks); return 0; } @@ -1330,11 +1329,7 @@ static int axi_dma_resume(struct axi_dma_chip *chip) { int ret; - ret = clk_prepare_enable(chip->cfgr_clk); - if (ret < 0) - return ret; - - ret = clk_prepare_enable(chip->core_clk); + ret = clk_bulk_prepare_enable(ARRAY_SIZE(chip->clks), chip->clks); if (ret < 0) return ret; @@ -1524,13 +1519,11 @@ static int dw_probe(struct platform_device *pdev) chip->dw->hdata->use_cfg2 = !!(flags & AXI_DMA_FLAG_USE_CFG2); - chip->core_clk = devm_clk_get(chip->dev, "core-clk"); - if (IS_ERR(chip->core_clk)) - return PTR_ERR(chip->core_clk); - - chip->cfgr_clk = devm_clk_get(chip->dev, "cfgr-clk"); - if (IS_ERR(chip->cfgr_clk)) - return PTR_ERR(chip->cfgr_clk); + chip->clks[0].id = "core-clk"; + chip->clks[1].id = "cfgr-clk"; + ret = devm_clk_bulk_get(chip->dev, ARRAY_SIZE(chip->clks), chip->clks); + if (ret) + return dev_err_probe(chip->dev, ret, "failed to get clocks\n"); ret = parse_device_properties(chip); if (ret) @@ -1640,10 +1633,13 @@ static void dw_remove(struct platform_device *pdev) struct dw_axi_dma *dw = chip->dw; struct axi_dma_chan *chan, *_chan; u32 i; + int ret; /* Enable clk before accessing to registers */ - clk_prepare_enable(chip->cfgr_clk); - clk_prepare_enable(chip->core_clk); + ret = clk_bulk_prepare_enable(ARRAY_SIZE(chip->clks), chip->clks); + if (ret) + dev_warn(chip->dev, "failed to enable clocks before remove: %d\n", + ret); axi_dma_irq_disable(chip); for (i = 0; i < dw->hdata->nr_channels; i++) { axi_chan_disable(&chip->dw->chan[i]); diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h index 67cc199e24d1f..039316c42f059 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h @@ -69,8 +69,7 @@ struct axi_dma_chip { int irq[DMAC_MAX_CHANNELS]; void __iomem *regs; void __iomem *apb_regs; - struct clk *core_clk; - struct clk *cfgr_clk; + struct clk_bulk_data clks[2]; struct dw_axi_dma *dw; }; -- 2.53.0