From nobody Tue Apr 7 02:37:43 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 CA7BA391E50; Tue, 17 Mar 2026 07:42:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773733340; cv=none; b=dCoZ1hKwMkePvoinLZZ1W9VewOKRV/Mn7GOww9zuiegl4bTCPTJJaRHoRG1133YUjnlQwr6OhaLZxqaBep3rVcl3WDb7IYZF70FRTwvFMAe5SY00DfkwbcwaaGy6VFCkbb7fE4RrVrBEkYRxjvip7O8aZRIZYcV9r/1NIptsYVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773733340; c=relaxed/simple; bh=IGFOK7+cyfsIjrXf2BngLyE/Uu+NP0nXY+LPcOKd1lg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rEzZKveiJwJxskQwSeEDZjDLDHnnI0j0tM9yXtBQadVGjICfRo8TkNiYOafATn3h3gCpjNTrOwlgEetIMwXChbB+8ic+L63taBlpLh3I/ZGG2AJStoi5Gh/Zk59emt/GJcoaSJm2WL0wXK3vnK9j/su8pRGsZLoKMtXltvVulDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: cb0bbaee21d411f1a21c59e7364eecb8-20260317 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.11,REQID:8ed28783-528a-49b8-b422-9e532f0e4568,IP:0,U RL:0,TC:0,Content:-25,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:89c9d04,CLOUDID:d1496f212eed61f0c89101fc49fc3b6e,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850|898,TC:nil,Content:0|15|50 ,EDM:5,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OS A:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: cb0bbaee21d411f1a21c59e7364eecb8-20260317 X-User: xiaopei01@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 209579328; Tue, 17 Mar 2026 15:42:04 +0800 From: Pei Xiao To: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, openbmc@lists.ozlabs.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, broonie@kernel.org Cc: Pei Xiao Subject: [PATCH v3 02/17] spi: bcm63xx-hsspi: Use helper function devm_clk_get_enabled() Date: Tue, 17 Mar 2026 15:41:44 +0800 Message-Id: <4edc7f6b63cc8b83b2185c398256234426a3d859.1773733017.git.xiaopei01@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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" devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when driver enables the clocks. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly. Simplify code. Signed-off-by: Pei Xiao --- drivers/spi/spi-bcm63xx-hsspi.c | 46 +++++++++------------------------ 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hssp= i.c index 612f8802e690..266eabd3715b 100644 --- a/drivers/spi/spi-bcm63xx-hsspi.c +++ b/drivers/spi/spi-bcm63xx-hsspi.c @@ -758,8 +758,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *= pdev) if (IS_ERR(regs)) return PTR_ERR(regs); =20 - clk =3D devm_clk_get(dev, "hsspi"); - + clk =3D devm_clk_get_enabled(dev, "hsspi"); if (IS_ERR(clk)) return PTR_ERR(clk); =20 @@ -767,41 +766,26 @@ static int bcm63xx_hsspi_probe(struct platform_device= *pdev) if (IS_ERR(reset)) return PTR_ERR(reset); =20 - ret =3D clk_prepare_enable(clk); - if (ret) - return ret; - ret =3D reset_control_reset(reset); - if (ret) { - dev_err(dev, "unable to reset device: %d\n", ret); - goto out_disable_clk; - } + if (ret) + return dev_err_probe(dev, ret, "unable to reset device: %d\n", ret); =20 rate =3D clk_get_rate(clk); if (!rate) { - pll_clk =3D devm_clk_get(dev, "pll"); - - if (IS_ERR(pll_clk)) { - ret =3D PTR_ERR(pll_clk); - goto out_disable_clk; - } - - ret =3D clk_prepare_enable(pll_clk); - if (ret) - goto out_disable_clk; + pll_clk =3D devm_clk_get_enabled(dev, "pll"); + if (IS_ERR(pll_clk)) + return dev_err_probe(dev, PTR_ERR(pll_clk), + "failed enable pll clk\n"); =20 rate =3D clk_get_rate(pll_clk); - if (!rate) { - ret =3D -EINVAL; - goto out_disable_pll_clk; - } + if (!rate) + return dev_err_probe(dev, -EINVAL, + "failed get pll clk rate\n"); } =20 host =3D spi_alloc_host(&pdev->dev, sizeof(*bs)); - if (!host) { - ret =3D -ENOMEM; - goto out_disable_pll_clk; - } + if (!host) + return dev_err_probe(dev, -ENOMEM, "alloc host no mem\n"); =20 bs =3D spi_controller_get_devdata(host); bs->pdev =3D pdev; @@ -887,10 +871,6 @@ static int bcm63xx_hsspi_probe(struct platform_device = *pdev) pm_runtime_disable(&pdev->dev); out_put_host: spi_controller_put(host); -out_disable_pll_clk: - clk_disable_unprepare(pll_clk); -out_disable_clk: - clk_disable_unprepare(clk); return ret; } =20 @@ -902,8 +882,6 @@ static void bcm63xx_hsspi_remove(struct platform_device= *pdev) =20 /* reset the hardware and block queue progress */ __raw_writel(0, bs->regs + HSSPI_INT_MASK_REG); - clk_disable_unprepare(bs->pll_clk); - clk_disable_unprepare(bs->clk); sysfs_remove_group(&pdev->dev.kobj, &bcm63xx_hsspi_group); } =20 --=20 2.25.1