From patchwork Fri Sep 29 05:38:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13403686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6AEFE743ED for ; Fri, 29 Sep 2023 05:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nScmC/6zX7poO+7NsgudBoJHYNpTOtSbJXGKJs+crG0=; b=5CrDP3OXgZS0J5 ry1+Zb/s9PJIt1vkm7427DyONjjN8X+kwUp4jxXNnKzK8l5FiswzssVdI/dqeeaWOL9m6e7ytG9b4 PjU08TrkPTc2Q3xmJPVR+06tZXimEeeNTi4Ed/Fepn9Q132Hd4TM/ASakx8KuT7jP6SEtmm8KZxz9 6p+6EWaxWzWBlWD2pzMKAG4UtmXa71oe8kKLy2WnxcniyF8llK7drgWt6Yai9sG+LL4ef3+I3cQ9n gPrJkp49rsUhTTc3rrcz+8jTh+lJ1PTxkvIBb6Qql/BnG6UzGKlPrhAy2ab4jCXzdLZ9dsa+uPhUK f5+9CUPGMAdfgSENCF/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qm6EQ-007BCH-30; Fri, 29 Sep 2023 05:40:06 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qm6Ds-007Asd-2Z for linux-arm-kernel@lists.infradead.org; Fri, 29 Sep 2023 05:39:34 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-99c3c8adb27so1842020466b.1 for ; Thu, 28 Sep 2023 22:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1695965971; x=1696570771; darn=lists.infradead.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=6Tx8IsOEvb8qkvUy2Or6MBahI0OwwMce9fHoVPFho48=; b=OKrSrpu6J8ww1nHd25FBIuyEd+h+/c8nEECNJXhUtSTejwgHeyrjdvldO750ovaWXE A5aH74kgXxqx+kcfkdoLtDbDj811m7zvDDgA1y5XEXxa25+nkfLZumf0Za2SIeI6Gfjg d3gZxKgpsg7i6G50TzEfJ0l0ZHSGq3jL0NJQ+vbRdnY5iAM4ASyJEmj1ILo5pB4dTWw/ prTZNw4iBtmUxkvdumpbf2aQfKJOZQakUQubZ0/j4mzoSKLsM2pzkTL3WjemZ6h50Zfp kcEJVJb+Art+Gm2VNT0xRyx3q7Zn/F3ToKg4HWO2PFmXNM1ZfH+QYX5zGBQcyMrt14Gj pcDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695965971; x=1696570771; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Tx8IsOEvb8qkvUy2Or6MBahI0OwwMce9fHoVPFho48=; b=JdpncWk36lIHk5BQVcmlWLSfwMC/naCR00hDb103GzGy67UX+VmXtJ+oftfTGvFXuM z/ihlV6lwZZ5hmP6W4nJdGiwIkxmc3Vv78yir4+Mz3TvYkl4G7nx7LBMvtjYBEr+B/8u 33SZHILrKlAIR6Nbn0yljVZprOEsJmHEN3Or2GjXH5RddrI5YM8TjOF2/XduceuDRjDr DcTCAjiqI9sVM5r9pdVP8NfY9QKRfdeUcOvl63oqC40O56RbCCl1xGjhy1OeM/c+4pfl Ka8mzRTJzipCCckPk56tuawRsFLa3aAY0B0tLyxmeQM7WHyK8cQDulJ3Qx4zmd3CaB0W H4Ag== X-Gm-Message-State: AOJu0Yw/gN0kGLvhK5ru0S5sv+eo5mbGfuHkQG4g2jBDk9VfrVs5niLd qmLaJS27i1khv4iW/zslzRvbZw== X-Google-Smtp-Source: AGHT+IFssgixc+IrMTS/V7svcvYp3mqrtz9kBpFjxlgOV+eCYx41PSPSVkMAV0EmJXCg9RRV7OOD1A== X-Received: by 2002:a17:906:845b:b0:9ae:695a:fed1 with SMTP id e27-20020a170906845b00b009ae695afed1mr2909592ejy.1.1695965971645; Thu, 28 Sep 2023 22:39:31 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.177]) by smtp.gmail.com with ESMTPSA id z19-20020a1709063ad300b009a1a653770bsm11971992ejd.87.2023.09.28.22.39.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 22:39:31 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: geert+renesas@glider.be, mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linus.walleij@linaro.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, magnus.damm@gmail.com, catalin.marinas@arm.com, will@kernel.org, quic_bjorande@quicinc.com, konrad.dybcio@linaro.org, arnd@arndb.de, neil.armstrong@linaro.org, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com Cc: linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 06/28] clk: renesas: rzg2l: remove critical area Date: Fri, 29 Sep 2023 08:38:53 +0300 Message-Id: <20230929053915.1530607-7-claudiu.beznea@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230929053915.1530607-1-claudiu.beznea@bp.renesas.com> References: <20230929053915.1530607-1-claudiu.beznea@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230928_223932_847560_8DCFEA6E X-CRM114-Status: GOOD ( 12.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Claudiu Beznea spinlock in rzg2l_mod_clock_endisable() is intended to protect the accesses to hardware register. There is no need to protect the instructions that set temporary variable which will be then written to register. With this only one write to one clock register is executed thus locking/unlocking rmw_lock is removed. Signed-off-by: Claudiu Beznea Reviewed-by: Geert Uytterhoeven --- Changes in v2: - removed also the spinlock - s/reduce/remove in patch title drivers/clk/renesas/rzg2l-cpg.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c index f411e428196c..d936832e098f 100644 --- a/drivers/clk/renesas/rzg2l-cpg.c +++ b/drivers/clk/renesas/rzg2l-cpg.c @@ -895,7 +895,6 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable) struct rzg2l_cpg_priv *priv = clock->priv; unsigned int reg = clock->off; struct device *dev = priv->dev; - unsigned long flags; u32 bitmask = BIT(clock->bit); u32 value; int error; @@ -907,14 +906,12 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable) dev_dbg(dev, "CLK_ON %u/%pC %s\n", CLK_ON_R(reg), hw->clk, enable ? "ON" : "OFF"); - spin_lock_irqsave(&priv->rmw_lock, flags); value = bitmask << 16; if (enable) value |= bitmask; - writel(value, priv->base + CLK_ON_R(reg)); - spin_unlock_irqrestore(&priv->rmw_lock, flags); + writel(value, priv->base + CLK_ON_R(reg)); if (!enable) return 0;