Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp931479lqc; Fri, 8 Mar 2024 17:06:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUYWA30M3Qgh74ybgQnYTBbtoqA1xbbe88Af/eCJqbY0zXzLJ68FXYv5Wwvz5nrT3fWIbPUrB8Sln4upchEcsB7uhZwvceqnvUF5CU1FQ== X-Google-Smtp-Source: AGHT+IHC6pCjRRm04T+HbiRi9XSmopntyryusYL1H2j23mL4+wMrqPSewzkTaANc655zSDp773Ri X-Received: by 2002:a05:6808:1154:b0:3c2:139e:1221 with SMTP id u20-20020a056808115400b003c2139e1221mr1070794oiu.3.1709946401321; Fri, 08 Mar 2024 17:06:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709946401; cv=pass; d=google.com; s=arc-20160816; b=c+JwiK/ivB9Ak63JCx58BR44XhLSL79W5vLi4NlOA0z9gbvoKiOj0YPYNkhebjHKM0 xTiXAaBshGWY08PM04PsF8u51WKlhBnRW/m/LFo3N3fntbPJzNsN5pP1vok5OvPtTkRi X9U7s73TSXVIWtgniRJEk7xeeDop/2cfYfE7O8tjH8RAxdz5W82x7yfTgikScqwPPn6V exIBPpYJkjY2TYGAUor31ofowypTi9wkoMzkHPb7lZF2eXnikMZwQc/NURRFZw+XMqC+ HPzi37JopkAcey+Gy6b6Bn4pTkIrst5lZlzxGPOWTy+pp5LRGrFp/gO4uov3wTdqyREo s3yA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:date:to:cc:from:subject:references:in-reply-to :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:dkim-signature; bh=XDl0hcVZVqjbE9euNKWYEg6P6ZJe8++HiRkYtZU96Kc=; fh=O7q6tkKkWkrmShigO0ZqcrdWKOYVK1h0Qi94bQtjECk=; b=OwJaXrBoq2jW7VX/j4aNOOC/Mn5fXNPP66ILaqoyq6tqqgD8ppZVSnhjgs9wNBda3K cIy60tW/fgKs+y/6pweAWlWzoVUvwf0yKAhPeFszyUp/eFjGNhDCxf2KmDWz2c9q1YpL yMDDvGyNvgSGsF/Rn0JPZMXnaf/G/bNSAxlfA6CLFHqTBFuTwCtG0SZzWEqd1et3sobK 1PCboRZHN3jS27I8i+gELkh8Dd3haP3F0jvSbQvsFZSYabw0HEZr3Mg2/98kuV9SHI5h hYmabumvmDmtpk5uhSERyASD8Z/RRrog7b2Ud3ZBgypFONG9vHguK5BkHNUe9eQJwFVx 955g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AnMD7Ljb; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-97715-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97715-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d18-20020a056a00199200b006e65907147dsi576822pfl.71.2024.03.08.17.06.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 17:06:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97715-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AnMD7Ljb; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-97715-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97715-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 39AE8B2195F for ; Sat, 9 Mar 2024 01:06:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EEBFF15B1; Sat, 9 Mar 2024 01:06:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AnMD7Ljb" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1DFA515AF; Sat, 9 Mar 2024 01:06:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709946372; cv=none; b=ftMucAvdgLTO+S/wWiCaDIV8jcpbnevUbdUcIb56CmVr6qnRiL+LcbKPopBjju//Z2z2g9UP+7r4ImSKwJQIea/D2N46CGgJMmlQTG6lunWouA+hMZZ9S3jWk1kVipcK7YtAnfMDDlYRncHl1ITBgFc6o8yhVHTJcwjW5I7O+K0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709946372; c=relaxed/simple; bh=lREFPRi9v8Cfg8jashZ/rXxJfnbAtvwWICX/500teMI=; h=Message-ID:Content-Type:MIME-Version:In-Reply-To:References: Subject:From:Cc:To:Date; b=Iya7yer4EX1vLwOPE4Eq5izEkVhogf6kCechwhjPt+nkcxRrPfY/tr3vacUJTU2YioJL7+qbQQiJakVzfOv/SDhUHZAa54nXj0bzob1sS60rYEEk4Z5/wlrTrEh6Ie8uVHwqdrE7SGJvmfrxHYCrHYcfjeup5HLG4PgIwA8ZjWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AnMD7Ljb; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AACCC433F1; Sat, 9 Mar 2024 01:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709946371; bh=lREFPRi9v8Cfg8jashZ/rXxJfnbAtvwWICX/500teMI=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=AnMD7Ljb/bWwLQLHeFoHolay53eZ+jAE0E/LgyknWXXz+brGzGIiVEEg6pEDJdrEW TsZjveV1LR15YbyJzSHOcwQNY1RYB7LLwMGOzbTboGIVoID6s8brknXDPG/5C75mUy 80Uwt+HyCShbU8u35uM0hNZqydopewDPTCysW0PV/lxKzgGebBc4Wipp+B9NwUrh+p jQ9do/lNy1tV3f2rFPe1K5X1ZBChj8S1pZL4IA0JgmE6TD5pvJ6rD4dKs/mVTQZlX8 eAlwDsuIw9j+Cqp2Rh2qcCDmChPmGlCoAK44qRCIUHol9IItu+Z94ptmuE94e/oNT1 3lSlW+jdM8whQ== Message-ID: <384bf6c936fac50042389cc5f53c3199.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" 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 In-Reply-To: <20240303121410.240761-1-andy.shevchenko@gmail.com> References: <20240303121410.240761-1-andy.shevchenko@gmail.com> Subject: Re: [PATCH v1 1/1] clk: fractional-divider: Move mask calculations out of lock From: Stephen Boyd Cc: Michael Turquette , Christophe JAILLET , Heiko Stuebner , Andy Shevchenko To: Andy Shevchenko , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 08 Mar 2024 17:06:09 -0800 User-Agent: alot/0.10 Quoting Andy Shevchenko (2024-03-03 04:14:10) > There is no need to calculate masks under the lock taken. > Move them out of it. >=20 > Signed-off-by: Andy Shevchenko > --- Applied to clk-next > diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fract= ional-divider.c > index a0178182fc72..da057172cc90 100644 > --- a/drivers/clk/clk-fractional-divider.c > +++ b/drivers/clk/clk-fractional-divider.c > @@ -195,14 +195,14 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsig= ned long rate, > n--; > } > =20 > + mmask =3D GENMASK(fd->mwidth - 1, 0) << fd->mshift; > + nmask =3D GENMASK(fd->nwidth - 1, 0) << fd->nshift; > + > if (fd->lock) > spin_lock_irqsave(fd->lock, flags); > else > __acquire(fd->lock); > =20 > - mmask =3D GENMASK(fd->mwidth - 1, 0) << fd->mshift; > - nmask =3D GENMASK(fd->nwidth - 1, 0) << fd->nshift; > - > val =3D clk_fd_readl(fd); > val &=3D ~(mmask | nmask); > val |=3D (m << fd->mshift) | (n << fd->nshift); Should we pre-calculate the mask and shift values too!?