From patchwork Fri Aug 23 08:09:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13774731 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2059.outbound.protection.outlook.com [40.107.117.59]) (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 5451D28DC3; Fri, 23 Aug 2024 07:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724399687; cv=fail; b=BgSofClT2HEDSAV+j+h2G3uNBcmaF/FoSZEItd7zry2GBH9tM704q58NnN4fnRFJaZxO9gp66Fxgvd/wCr2D4L+TFeJag2AgcldlmLK3DeYkHkKsYDZrn7JaCexdkC42MnuLgsBPPQgzpteabiVXcSCBG6I9ZxgiqaTI4besp1Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724399687; c=relaxed/simple; bh=OpkDP8iOm2UCfdoEa1Ii7UlWLVXfgLyYn8iUqXpGrRk=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=eL3Shm2ClrAJMI/674GMM73c0NgByPzLSHpKh9n3JstzFSPj5awhP/Jd/alPMopehbfqr3bYVhPELc2iIccbz4Jc7MXsQr4ZNK+1j8OQLwhWMy2bN+NUC1VvxIXtLuANZ/mo0sSmiFHNt6bAONiSvk7fH/oirW+BsPDZERcNRBo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=JOQy9DnS; arc=fail smtp.client-ip=40.107.117.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="JOQy9DnS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G7HmNV3KWsYD8DBmgN/cw9ZTzD5NBBm/j/xUWEtukpscJsAfvSELSqcHDmvyJxAPHTQQRvhwXeM14w/7/L9fDRFCBiQ+GJu1L20Ep+vwC5swr+aporER/D0MuGB+pKKkofuzsM4cTxCk0RzPobOI5R7Oj3J1nizCBVQqg70B6ZekRUVROdvdrNBvMJzlawmdn5f1E6j3yVKNRmVIFbgz0rQ0SknzHLpcnDuKjxs7xutSoXBS9+svT56jIp6yjynpy0bE2TgHoKIy0j1V+RSZE/FyvkpNCSio1mcACzYXS7RmjyFVYNK1DNq1lHUgrWIkkYWdtYqWQ6Hk+be+9WaJBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8HUA9Rh9awtogemMnI7dYT8dTbpTFgKgR3AP77HpSYM=; b=XzfpNJWErE2xbJ5PnOFUWOrxqDQFTlgcyBw4kOVmU9H5wueD8mWSzJ1rdn1x4ABzwx1/8/ZbL4lsAddIJ4FUrMX9mi4DMQL4QU5zrAA/zmTwLV4EttiPH2k4fiTrgj6HfFiZB1Hxr4BXeziHg3f5vMgcgRgMwhNA3leZ7k221rTKrAK46iRMYWZesoDk/caJIa2jmpTjmFOirxdmy6DPtVqxTt749iI8bOtXSL7ZnWBOLTWS62ovrXOpJ635rCZ51lK5U5O/q4UvDKeo2Qo6pYaQhf5VtcuYbvcMgxvQIQpLpWrP2OT0rBcHNXsz3xC9/ToJ4O9AI+Kc+mYBGidpNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8HUA9Rh9awtogemMnI7dYT8dTbpTFgKgR3AP77HpSYM=; b=JOQy9DnSeLSlulE7znV/NRnxTW4prBKGCj2TqlyUAuSOgsns/fzBPL7nCEBg0Jldfu/Ki1x52lU7tvFL42LyOn7JTjcyESu1a1Tubq1+6CzqLrANnxHbuOh4OZ3FWtv3RTVWsAiG0Qh6/wr7/6wpCZ8PaxPBTE3FkwqaQy0kO/rFcnH3XSSokel0VrppLtZc3K+axdPy2uTTW/5ISf/fqG9FVYUr7DVdCJJuMwB9/5HT6LUDC8c+XiW8wfQSQfN4V5/NqryM+xM8NO4S4w2AVctis/qqKi5r8erh7LF8QN3HcJdN3DfEGjYfYvOgYV0sxj/IVyCgg0npcRQE0mXkUA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by SEZPR06MB6459.apcprd06.prod.outlook.com (2603:1096:101:186::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.17; Fri, 23 Aug 2024 07:54:42 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7875.019; Fri, 23 Aug 2024 07:54:41 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Bjorn Andersson , Konrad Dybcio , linux-arm-msm@vger.kernel.org, Wu Bo , Wu Bo Subject: [PATCH] bus: qcom-ebi2: change to use devm_clk_get_enabled() helpers Date: Fri, 23 Aug 2024 02:09:39 -0600 Message-Id: <20240823080939.2084108-1-bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|SEZPR06MB6459:EE_ X-MS-Office365-Filtering-Correlation-Id: f91ce90c-de91-4bf2-dfa4-08dcc348d7ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: PT1lZWUXkSntXUIAOydFDAmCfUYhX1RwqobIjt02h9tMhflNisr50xjW5UyQAn9aUxYVKOxfI+xprDg9kY0Uag3Xs4yImgbaoP4q3H9VmStTxf8vkBtMLDlBR5fHnpmq60bCHyoFAMQ1oQTvQrN/lWK9H9tzRAIm9TDs4hZLC85vEdGCRAf4u1oio3yIq1ss4/RgjIcPdDVxVw3BhwHUmgct+nlFJZqfxRZknhG2Y3mhL1UIg+FslBbKtLMd50empHhEBGoc2BHDk+IWbWR8qKQeI581cCR0HEFtxWy/HhpLMUW9/0QAi4nTPex+DeHoDe8+7yaVi8gLeooYkCyCViMT15YXG4k1i+Tz4C6qpuKgi+Zh5D5j3BpyQQOrHQmX3/CXhxlz/EAxlrOvds4IZnoq8CoBRhSVjpDYeiRehxlaRL47472/n6P/+1nhEjJGcbdym0zK3mmmmHbxDczfRMrTL5VuNGntT5c1Dn5354r/I+N4Ei3ppfn25GuMj8fSLL1ESYjyqRbDzMJYjsJvWnqDamWhVJpzUCx7LdTABP4N6702i72UwL67N9AI04uoyctOvDjEqukiD+aaUnVfa4eYkPFdQYNiz+WEtooqqYMFg4bHgzgCLLqEMvkx5256LjaRQOsRygfFvjkWa8B8GwkWqqZPSPZTJy15cDxN67h9QvmVM5RbhfkV9Icr9qn2XQrw/7+vyauBPUv5bpfsNaH17GS7T6sVFNspj/62pl7LltCjOumw4qVlL383F7HKx0G5EHdPuNVIhSocjJduqiQNiyH5SgDgpR6cGV6N63p7Ubli8bnIiNltHBKjbJvHHhzIRHCpmN4BJnbSplflXX+2HEipbntFP5g/ZCF3Q04+5LgKmsfsur8rJoetSOmaMEAEN9xSWfUuFqoxkqPJ+gvaXEKHh7Ie3bdtfkQSqGwyODJ6NI5cj9dEf/oLkhsNVYUgpAairGsIuGr6BWdWct54VMK2B9BcyEbVSuoxjXcLNMYmU5iD+2Wv3xAUFbcTLsmJ3KESiIquiTe8TVyK5oomqQaiIoAr1Jk+Fp62aKq51joEhOnQroYkoG3PX7/X2YTJTzD6oMA6DmaPBLyP815fIqAFyC6/4GcZTmrrO06Opy7E6HnUHwOqzaSeoLuUzSOjagFJpC++/bgAiVymiLb+N8QorlN9dBZ9VX3BCcQm5UGXz52MWwZuva0xtyaAK5lrh/1rElX5QU+XroS7k0eLpH+2kXKAMtfApX8ww18boGne998LHMaOmM2AlSnbYxlt2MD0/9QdiSknd5c/Yj5yNUZ3BWFa9Se1ZY/mzYm7HqCFtN16TLPbyLmGCXU8/qJdHfKxEUwIynVZwwG0QEUOp3/eGdCg6KsR4wZohxTbWyWFjtDkqsKtQTMudWqz1vEX2ITP9gEEs6lFsOIybg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-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nE47i7xp9GkZ9pjoHAGyjuZ71nPbGnUMPbJPhfoLXjt1X6ly25jtwJ79x4/+HwKLvD+ZszrpBusLh5FLgNH/DlfIVHqqf1+lX7THT+RTd4cB/ZX9ibGRsazBNb/BcjJtqvFIjDx3uvkPe48cZO6zBnr4Ej54gNwJSXsG3UnjUxWxEQBfhuZCWAf+fM4dffxL+/5pmIjMmXKr7+1mMq/qP3yGv4Uc21w8XYb1Qa4dTRmF78h20mbXe22TPLDTi6Ji/LjE8VT3QoUkOAYxyEDIHjLdana5xqGhL0qDkJahgOKTggskswRRs7duTAM8jDc9tFXYOTgw+KKUaqO9zKVu0mFHc7zrnDV395dyA+DjQUx8MFZM2A+CR/R29nW0u+kW3TZVcRIOqvv3GoelwfNJOyqD8/jMwRzmgY4C6OPTOt+vBBrQlJ7O34b1+E1fJEOImh/tJU1dt/mfLT2DAH8ia5MWb443kMoSxO6OsBC25G1r4fJnO0UrijxwKH+SnULlsQ7ZMdu+Quy57syEI1cvEYZhpjhNiyeft9tyLAWjK2coO8q+ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f91ce90c-de91-4bf2-dfa4-08dcc348d7ff X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:54:41.0964 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MnelerlhqW3TzkZTJ2xbhjxWzbELZ7ZQanWD+CAHXEYtDzQweWOPuBFHWvA+tWfo7T79WuDNXNy3DxifeLZOtw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6459 Make the code cleaner and avoid call clk_disable_unprepare() Signed-off-by: Wu Bo --- drivers/bus/qcom-ebi2.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/bus/qcom-ebi2.c b/drivers/bus/qcom-ebi2.c index c1fef1b4bd89..a5c721f6180b 100644 --- a/drivers/bus/qcom-ebi2.c +++ b/drivers/bus/qcom-ebi2.c @@ -303,40 +303,28 @@ static int qcom_ebi2_probe(struct platform_device *pdev) u32 val; int ret; - ebi2xclk = devm_clk_get(dev, "ebi2x"); + ebi2xclk = devm_clk_get_enabled(dev, "ebi2x"); if (IS_ERR(ebi2xclk)) - return PTR_ERR(ebi2xclk); - - ret = clk_prepare_enable(ebi2xclk); - if (ret) { - dev_err(dev, "could not enable EBI2X clk (%d)\n", ret); - return ret; - } + return dev_err_probe(dev, PTR_ERR(ebi2xclk), + "could not enable EBI2X clk\n"); ebi2clk = devm_clk_get(dev, "ebi2"); - if (IS_ERR(ebi2clk)) { - ret = PTR_ERR(ebi2clk); - goto err_disable_2x_clk; - } - - ret = clk_prepare_enable(ebi2clk); - if (ret) { - dev_err(dev, "could not enable EBI2 clk\n"); - goto err_disable_2x_clk; - } + if (IS_ERR(ebi2clk)) + return dev_err_probe(dev, PTR_ERR(ebi2clk), + "could not enable EBI2 clk\n"); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ebi2_base = devm_ioremap_resource(dev, res); if (IS_ERR(ebi2_base)) { ret = PTR_ERR(ebi2_base); - goto err_disable_clk; + goto out; } res = platform_get_resource(pdev, IORESOURCE_MEM, 1); ebi2_xmem = devm_ioremap_resource(dev, res); if (IS_ERR(ebi2_xmem)) { ret = PTR_ERR(ebi2_xmem); - goto err_disable_clk; + goto out; } /* Allegedly this turns the power save mode off */ @@ -379,11 +367,7 @@ static int qcom_ebi2_probe(struct platform_device *pdev) return of_platform_default_populate(np, NULL, dev); return 0; -err_disable_clk: - clk_disable_unprepare(ebi2clk); -err_disable_2x_clk: - clk_disable_unprepare(ebi2xclk); - +out: return ret; }