Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1635046pxb; Thu, 4 Mar 2021 17:05:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwx1sDuoUSIbb/Jl+Ov+xxHfZYtdDueF7iIykV3JdR80RepSselvGi1Tnf+MqHRLy2SEh3 X-Received: by 2002:a5d:9510:: with SMTP id d16mr5865023iom.81.1614906327974; Thu, 04 Mar 2021 17:05:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614906327; cv=none; d=google.com; s=arc-20160816; b=KLqQN3EcmVYNBlC65/goP8RCMdtcS8XDoRmP8oV89v1Da4litmvku/Ucb8n5H5PUSe tA+zKqXxrtdqba1UNldVzaWx+4IaxruM1mi4xyndggjADBkPisYBXQZga4a+2AaD098y fYs5bNxEPgG0l2qm9GczFma1FI4ekhpwZYW2U1QAG5PwbOMfOpN0SqRlkKxeLINRW2PF OgI7jxe8EnizPd8D3p1i6lpbrnwc+pxX4Z+gCm2oWT8HmPXFoAaKa8UddGq61w8Liz8b ngXnA4INLTnysl2sAQh/GxLRFnX97oK4i/tvlLNN6gWB6gmH15+u603RGDrvCkb22kwF pE3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UERQO4egOHXp3lfQJ/sHEH1TG5FquGO2TdMFVt16Qp0=; b=lNqTG9BWkh1KZi4kOsvm0sto+psGtmugKrZsyUxeC21OI6Wtgm5PVKCDWEp+RoV3GY W0rArq6fPYehqD8fE3M8Hy9kDfSlMEnhmmNigdmtGBRrGssQICy58QRfIG/nl1WQY4RO I/btAJQQBE/0mvEiQADxGTb5ENw2rZK/1bSruUCBLWHaeSUm6SH9r9341IIQwO5nOvrf +fEE5+BgbqtQkEPeBsLzKuoMycGk7/ojHqieoZcc9r77gXFpnm4LZsXY9GTFNt7ek8OT phhDsgh/s43v6FhYvAaKxCVQjFgBUIvAQ6TJG5vhtb6U9TxsgJdlv/VfF5Zetk4niUn4 SMwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Gi09YjnZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si985087jat.59.2021.03.04.17.05.12; Thu, 04 Mar 2021 17:05:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Gi09YjnZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230165AbhCEAdj (ORCPT + 99 others); Thu, 4 Mar 2021 19:33:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbhCEAdi (ORCPT ); Thu, 4 Mar 2021 19:33:38 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 276F4C061574 for ; Thu, 4 Mar 2021 16:33:38 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id bm21so157386ejb.4 for ; Thu, 04 Mar 2021 16:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UERQO4egOHXp3lfQJ/sHEH1TG5FquGO2TdMFVt16Qp0=; b=Gi09YjnZ8XiisKl6ZPp/ol6m5jzpaVysKvVemGggbWEt4G9eN0T+z0MF5xvHOkb6rN Q5diwLSfZ+gYDpm4TOUdB2NhGMjiRL3Gnho1H8RwiXJtoH6/e9KRX465ScXr87B27M33 n3KFFs6amgzDp6wg1dNVvW1J4xj+ZUjuxSPXY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UERQO4egOHXp3lfQJ/sHEH1TG5FquGO2TdMFVt16Qp0=; b=Ai+1GU+jg6xLn7OodVPJS5OYNs4gCiMvdMLZl+PG/Hi4tbCjxDoGzFPVr5zCZckzsV X3oc6WFejzxLmnDy2x7+eQaZP7mwZZickZYo6ng8yqyuAsaauhfAXuuScV72xMl+FCyX BcwdwplaeEgnGJAHwIDyVp8KUzg33oTZPrplzpocdN7RHIE+83Bbt6QPqfSaKeJJwVz7 tLKyrdR/ud9aEYyGZZMpMyn2RddyZx3InWqc2nMXK61rCy64Q6liMPRt1FFU8I12zydO NcOdDJccbxQEBvm3zRYsoKHZdY+3zUI1JecHUFPqccGwFqaK0EkN9oTazJYkcno+nd77 t0Hg== X-Gm-Message-State: AOAM532i6YgXSg1FOLraaADGz31+vEvD6NrS9QU+SA+MMwEh0cUCsEyK hBog5mLsRzF3wLt7dnWVVm25Rg== X-Received: by 2002:a17:907:2075:: with SMTP id qp21mr93448ejb.451.1614904416948; Thu, 04 Mar 2021 16:33:36 -0800 (PST) Received: from prevas-ravi.prevas.se ([80.208.71.141]) by smtp.gmail.com with ESMTPSA id r13sm549501edy.3.2021.03.04.16.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 16:33:36 -0800 (PST) From: Rasmus Villemoes To: Michael Turquette , Stephen Boyd Cc: Rasmus Villemoes , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: use clk_core_enable_lock() a bit more Date: Fri, 5 Mar 2021 01:33:34 +0100 Message-Id: <20210305003334.575831-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use clk_core_enable_lock() and clk_core_disable_lock() in a few places rather than open-coding them. Signed-off-by: Rasmus Villemoes --- drivers/clk/clk.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 5052541a0986..8c1ed844b97e 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2078,12 +2078,8 @@ static void clk_change_rate(struct clk_core *core) return; if (core->flags & CLK_SET_RATE_UNGATE) { - unsigned long flags; - clk_core_prepare(core); - flags = clk_enable_lock(); - clk_core_enable(core); - clk_enable_unlock(flags); + clk_core_enable_lock(core); } if (core->new_parent && core->new_parent != core->parent) { @@ -2116,11 +2112,7 @@ static void clk_change_rate(struct clk_core *core) core->rate = clk_recalc(core, best_parent_rate); if (core->flags & CLK_SET_RATE_UNGATE) { - unsigned long flags; - - flags = clk_enable_lock(); - clk_core_disable(core); - clk_enable_unlock(flags); + clk_core_disable_lock(core); clk_core_unprepare(core); } @@ -3564,8 +3556,6 @@ static int __clk_core_init(struct clk_core *core) * reparenting clocks */ if (core->flags & CLK_IS_CRITICAL) { - unsigned long flags; - ret = clk_core_prepare(core); if (ret) { pr_warn("%s: critical clk '%s' failed to prepare\n", @@ -3573,9 +3563,7 @@ static int __clk_core_init(struct clk_core *core) goto out; } - flags = clk_enable_lock(); - ret = clk_core_enable(core); - clk_enable_unlock(flags); + ret = clk_core_enable_lock(core); if (ret) { pr_warn("%s: critical clk '%s' failed to enable\n", __func__, core->name); -- 2.29.2