From patchwork Mon Apr 3 19:59:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13198670 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4836BC76196 for ; Mon, 3 Apr 2023 20:00:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D94D6B0072; Mon, 3 Apr 2023 16:00:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9620D6B0074; Mon, 3 Apr 2023 16:00:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 803876B0075; Mon, 3 Apr 2023 16:00:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 711B96B0072 for ; Mon, 3 Apr 2023 16:00:21 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 47CF91608F0 for ; Mon, 3 Apr 2023 20:00:21 +0000 (UTC) X-FDA: 80641146642.30.48B8DD4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 810E31A0018 for ; Mon, 3 Apr 2023 20:00:19 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RlU27bvg; spf=pass (imf19.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680552019; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=Bg/HCXdFOa6pEuZtZpdQAudL+0Nih+E2fbYA1vbqCPo=; b=n/EPIE796ijCspbv9aiLsz++qh0XCpijxQ1hZJbRgASm/D6XgQNSHMaB0rEOio1AR0avad Sqv8J/bjW/sX9bg3O8mhf6WeKSPL96yBd2aGksFH3vKyiZ21+Vdpfwwxp6pUwAYzfg68o6 hM6Zk5ETCouYYH0l1CtiiIR8EvwoSaE= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RlU27bvg; spf=pass (imf19.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680552019; a=rsa-sha256; cv=none; b=2EAjLKDx4HkxVpmQz6K1za/63AMtFzf4Ou9tocm2Hz6G6whGhsPeqZ2la8kJefjQiAW1fu zixFYbvWze5VmUR0fgeDlTM3yjx7FgYQclVGqF88iFeDXub0anGUO0K7KarVQaRYl/5AOc wqtcA6VVCSP33LWS/NAbICbNNWrFxhc= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 771CD62943; Mon, 3 Apr 2023 20:00:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B32ECC433D2; Mon, 3 Apr 2023 20:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680552017; bh=wWhl5BO+MfmttCEYPrR6iCQCTocuBDmG7hzKkDLpiEY=; h=From:Date:Subject:To:Cc:From; b=RlU27bvgnVIZ1GKdEIB6+ciFV1mx+akcXX2NWw7hnvXjrDbv+u3PSsaD6sKwAwIkU AL98YXCl+Vd6CUGAPMpP3zB+l4XBlj94ev9DaHwhA7USUXiwbsr9UFb+m9E0PbkmVp deWnn2Pa1hPuobDynVtTAm17pEGTTb448DOY8vZekIBHyTTFrm1128Scm79wPvijuw /8BaI07flgBKl8npYnm0hfRPNRNLfCHYtBXwmoHMpxFOl1HM4roaUxq4sitqFW5Q7S HR7DQLI51P2f0qGvOuQvy0SsqKE5EYHDMcsVkr0t62Hsc45KJUP7akn9e5S0j1x30y TJFCGaaOT+inw== From: Mark Brown Date: Mon, 03 Apr 2023 20:59:44 +0100 Subject: [PATCH] regmap: Use mas_walk() instead of mas_find() MIME-Version: 1.0 Message-Id: <20230403-regmap-maple-walk-fine-v1-1-09512dd51e50@kernel.org> X-B4-Tracking: v=1; b=H4sIAC8wK2QC/x2NywqDMBBFf0Vm3YE0Vmj7K6WLPG500EaZQC2I/ 97o4i7OhcPZqEAFhZ7NRoqvFJlzheuloTC43IMlViZrbGtupmVF/3EL103g1U0jJ8ngx916H20 MCR1V2bsC9upyGA59nXU87kWR5Hf2Xu99/wPwVgZsfwAAAA== To: Liam.Howlett@Oracle.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-00303 X-Developer-Signature: v=1; a=openpgp-sha256; l=1373; i=broonie@kernel.org; h=from:subject:message-id; bh=wWhl5BO+MfmttCEYPrR6iCQCTocuBDmG7hzKkDLpiEY=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkKzBPMCJJJ9pw9zNKYOGOOOthUXSElqODjRYbaAQQ wHMJiNaJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZCswTwAKCRAk1otyXVSH0HyjB/ 9wuWX5Z7lfnrqp1liHLKEwKUHODnEuvabqwTPf1uvVDhjFhgC3G9DFzPu978V6VXl4p3wNClqRku2N 2T/8cUIuGr60h7YwgaE/UdYTwjzCUKTls1yYu7Oaxw+joUONq5KfogO5wpcxpPJf5y5zb5Jb4QFJl/ 5WSOkQdPYZG/sub3/fHB9hpDpyENfZbsu/xDWmcztea3nGf2Z47ygjGAeJ2b5RMBZrfruvpZZqgyvP UBPLEgFuOCPeFsQlCwn2dSugunJehlic96yryxmykQFgB7JayX7/cM8avae/ar6WTSoH43xw77ikLD 9/pZKZMFtYcEsLineeob16SXJ/jxOO X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 810E31A0018 X-Stat-Signature: igsxaotqm8qw6cihr6q1pu3xbwctg8xz X-HE-Tag: 1680552019-963138 X-HE-Meta: U2FsdGVkX18U1L7i6WuetNrd7g2tnVIrgfGpMzDr+yrCCXd2dNA51Rc27n0QGBDT0e2KL3Zx74+rNjF7ueB5qVNbT29YG37orRBxL6hZSaiqEE7Egi9lEpVSrY3moZ2NhIX3OGRF8nBr58373hYIbVIXBn25lkxx54L+gn+aOJq1uphbgku/Xjxz47QemgrxmUrAqbHQBNTszfLOg6QdTT8HkY4bc/C49m8d2R8JojHDWkv0h5ojdkBt2EtWYYU6QheVLCxPt2ocL1yaKPLbXEPudCvlUyXVq0TeljKSjExgXSuYaX9B+s1wWQUT8P0WsG16TKW93weGoa0B/wqMvqZKvH7YTMdCUuH7ng4dHHyJfD+eiGf+L3AmcWW7Z4LQElBUuds5ZZNjwtYQQYSm6+MiP34ke6A9zizv/gE4ScEot4QGW++HFBFFRu3WFTlvL26G0QnyTgRWelV5wJjWLOIo9/I/gg+wNrnXHD7hsw3+0v1iQfgveBA18Qb0EZ2Zm8Yq45IdZWYG14sQLU2XnMsXzol4OuJD6MCDLJZx2SOGZGKtlNOP2VLqWelEZ0rysxe4dCN7bSAIQJuyxQKAPmB/6+i/mQlORumHfKQsZwBQC0z+Y1oo+BDasHTKN7Iw2Au3g6IYENjxiXddiJMAF1ZE/VYq8ASYzrT6FpH3TK34jYfoDS/ugWyPTEycAeVxQial6amdIxN0R9pQcTBZp/VdkTSJZK7nJzzsgGirp+y7mPQDynJ46h/Iza14fz9Z6ypcqAN9f0taSwiDDac7QU5ciRpKLaxXA8cTwDq+LAaDkzKJihRAlJef7T/uybCtn4p/5hXPyCpRD+c/h57lGVILibdKgiTUwarx4YfSjE3VXD5/p6kTUEts9PcSk5YL5w9HPoiA5zsIidr+MavKpKF+lFL5uiAZncvQOpq5CarjcP64QL9WJgrKOH3yTLALyyFKFq00iwPIFlzEmYu sijGYPJE 0vZrf0A7uODG+U5hOXsJPPpGKpYEQlc1WUkYwhQWKPlojaldzBzkvS4YssOwogEoWN+nwrdNQ7zUJGdeN8hDp2fmFgWBRs9fbuAMl1m3dI8Jqz9geTBIQTdamWUa+3UJz0j4dBnTIJMTyKvdpzvyrcOJ9+kFIkYNkqbLMb6sF3vLC3YeYsiqqQoHnlNXDprlN/DwjcZyStSJ+eEffP9aMHaSkra5c7N9TCTtciZnjs21hk8oqBD67wb3uQn92i/3tUwdMdr0pg7NF93HV9jW44THJsE+IuNntPcanpAOv2MtmffDkCzQ23UJ3HezJegLyZjcJTR4BospGtMwmn+0KTXTS+SHi14AW0ABs0iLK6W6dVQbRwR4/rvkN95DySFYw/ghGJKAj4kWZrHtXhYKTg/OfEi2UecCpGiKtCLPhh4lM0Cva9IP58vgRmg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Liam recommends using mas_walk() instead of mas_find() for our use case so let's do that, it avoids some minor overhead associated with being able to restart the operation which we don't need since we do a simple search. Suggested-by: Liam R. Howlett Signed-off-by: Mark Brown --- drivers/base/regmap/regcache-maple.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- base-commit: f033c26de5a5734625d2dd1dc196745fae186f1b change-id: 20230403-regmap-maple-walk-fine-982bbd2dcfe5 Best regards, diff --git a/drivers/base/regmap/regcache-maple.c b/drivers/base/regmap/regcache-maple.c index 497cc708d277..5d1bc3691830 100644 --- a/drivers/base/regmap/regcache-maple.c +++ b/drivers/base/regmap/regcache-maple.c @@ -22,7 +22,9 @@ static int regcache_maple_read(struct regmap *map, rcu_read_lock(); - entry = mas_find(&mas, reg); + mas.index = reg; + mas.last = reg; + entry = mas_walk(&mas); if (!entry) { rcu_read_unlock(); return -ENOENT; @@ -47,7 +49,9 @@ static int regcache_maple_write(struct regmap *map, unsigned int reg, rcu_read_lock(); - entry = mas_find(&mas, reg); + mas.index = reg; + mas.last = reg; + entry = mas_walk(&mas); if (entry) { entry[reg - mas.index] = val; rcu_read_unlock();