From patchwork Tue Apr 4 19:42:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13200923 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 B7C56C6FD1D for ; Tue, 4 Apr 2023 19:42:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 254136B0071; Tue, 4 Apr 2023 15:42:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DD456B0074; Tue, 4 Apr 2023 15:42:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 07E206B0075; Tue, 4 Apr 2023 15:42:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E83756B0071 for ; Tue, 4 Apr 2023 15:42:37 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BD56F80E1B for ; Tue, 4 Apr 2023 19:42:37 +0000 (UTC) X-FDA: 80644730754.18.0E4AFA9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id D05FAA0015 for ; Tue, 4 Apr 2023 19:42:35 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QCUUSa3r; spf=pass (imf15.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=1680637356; a=rsa-sha256; cv=none; b=k7W2vDHOA1RZbNVDWzB87hDKdTeuVdaXKBMwT69XFbiAdW+Wx1nfDa0OEW6mZHzU6Jxn42 Lc7payyAH0FScynHPJt0M1o2jUwl9YMPnhs5NCxhxtoqcIrNAUdhsqKScdp45rscboFwRX lHmGc7y2IC62dMzwNI8laNFkRE8kZdw= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QCUUSa3r; spf=pass (imf15.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=1680637355; 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=belcUcwcJSTvehLpZ3HHthnBR8LWz/q2jszUDXZZW0E=; b=YOkSDZofH5oKsLQUjO6qk3rGZq3SZ4aov3ZE3UZtR6/lUnepI3p7mJZNTUaO876NFihQ3a 8eKflbfZ0S6pWJyeAJqVxoRWiCjHhdE3dVl7pMk6cqi+MB/h0cjjXog4liRQibxCj1hBGt /W70DWe59km4yFH6tW056IrNa9UOmKg= 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 DB09A63557; Tue, 4 Apr 2023 19:42:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BDF1C433EF; Tue, 4 Apr 2023 19:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680637354; bh=9jF6cncPMExB3h8iUIwTFCwOtG+nCcN1cxEvxO5Y8io=; h=From:Date:Subject:To:Cc:From; b=QCUUSa3rs55stYoSESzuIUFgKM4FYXJLnU2ZqUGAVl0lkJhfc3X7gkqiUZWGV5dX5 B/hNkM4Yq0sRmmBALwdG4QeBv6rfN0rtjUN8Gw6/QmvrYPf/o0fw/JaRKFjI6BKOLh wnNfzpe8aAs2kMjfiJGk/7txXqtj/rmh/5W0DuCFnpk31RGKSGLzlHOA8CnWcANGdb AfO/Pa4DSCINVt9neu8/vM7x2L0oV+JK6KSWxowycPTkC4o32ZuG1kV7acYJ77qinw nOps0zVk4W005pPGsOwNTAkqvACa6zAJOiDoQ3vN4npoKbpHrv9Eg6hbIvTtJvuQZz bTxajOXFOoPdQ== From: Mark Brown Date: Tue, 04 Apr 2023 20:42:28 +0100 Subject: [PATCH v2] regmap: Use mas_walk() instead of mas_find() MIME-Version: 1.0 Message-Id: <20230403-regmap-maple-walk-fine-v2-1-c07371c8a867@kernel.org> X-B4-Tracking: v=1; b=H4sIAKN9LGQC/4WNQQqDMBBFryKz7pQkNlC76j3ERWJGDdpEJkVbx Ls3eoEu/uJ9eLwNErGnBI9iA6bFJx9DBnUpoB1M6Am9ywxKqFLcRIlM/cvMmDcRrmYasfOBsLo ra51ybUcasmxNIrRsQjsc+hp5PO6ZqfOfs1c3mQef3pG/Z36Rx/u3tEiUKCotlXNakhbPkTjQd I3cQ7Pv+w+Cdfal1AAAAA== 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=1460; i=broonie@kernel.org; h=from:subject:message-id; bh=9jF6cncPMExB3h8iUIwTFCwOtG+nCcN1cxEvxO5Y8io=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkLH2ofhETmgYh0TRqZKndr5LeWM04/2yTtJQCSP+m jP9LfwyJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZCx9qAAKCRAk1otyXVSH0HTIB/ 4hzczWbRFBucw2Q4aW32qRaWrUomLRaPgbkaAiIziLaHdGalxllgJVJYX7X6PxVRogv5VgIkAJ+C6g Ge1ATIMT5xX7lxGcjMkobPROm0QXechQ/V80oqWyZ+u97rgjgFRkWxP/enPxUfx+OiBB++EOjI3RCy W/6ZEA3P1vLelu85zbCtDMKhWRa4D6W2YfCydFZLC0nrUZLfClrMnyVo1jU7oLymErdhhPs/i4gP2c n/w2+XHPh78tyR05UbpfZtKbeq4fuhqItSknFkoFdbyxZ+6GGjzR5ob0gnLAVmBILFPAo2srAAvu3f 54XRBnNKR5DmrozZ4OJ+NhkUUYYrUe X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspam-User: X-Rspamd-Queue-Id: D05FAA0015 X-Rspamd-Server: rspam01 X-Stat-Signature: 7d5qasyz8zfusfggukaesfirqw3amtck X-HE-Tag: 1680637355-993874 X-HE-Meta: U2FsdGVkX197O13StECO2weAeNZmeOqm3RjR7XaXakgKeYzNbPBL+meoYPRdtFL74sBcf6uUSuNE2wMKQwr9/LSeCXp6hovpCEpSCWDM/dKoXkP/oegLbRpbBVhlDwpMvzX5wc5ze8xZ3vztZes53tax9+mklIfzE2fuiA63d9DjHFCbFZFpJ9RZUV7JyBG94x9gdfRGvbdSCtsPyOpKXU20wjvNr5/tl/aG87oJXxl/Td58uLxXBMJjcREdWkaPHYBlJoYA6f090YZnQM46GwfY/DOeDHkz5uR5znx1lH7Gr1N1e8bvdZeEyaQxXL+T7Y08ztRm30A9L86OVGcj1n59LXIKvXbm0517srAwlD9uWs5XHlTiDTy3kg0Io/5w4wPmqNi6CM6pqU9m2XZC+XMbb0yliA+ycVeK+82FNWhRVTqOfgOKPMBksaOqWbmUliGAMo84FfgToyCpfZaC4IbZRy5t+Y3+RHfqGGF/lBXlXA9FQFunlxwJffm8ivog+9oOx5l0WspTVk1UQQCxBSWOzR3rZuab7RnxvsJw5ivoJjaGLx9xl1Os3Of15NxWMmIaAxSCQVy2vwE5UcnP528l3dEJX8HkFppTAxKpmJGP3U0ViDnsdwBO4WhjyHSY/755qf4BY8ym41bHqicNpFqcrhhx6/nyI9+8CBpxZepX4QcoOyhszykikbAjiTvA+PqULDJzqZ051ko0pOg8eeVJNaGP40EfqzSX7hLm+jX0dwICijGEB/C17Q18rWVHutP3kkebNYtfaShmvlKYuFExUx/HssbAEd1KfOlIz+PSSzhCk/K+lCi3txAvMtyX2JArd/VCRoij8YUDVNz90U9ryL/0dL/k+FaPHWzlctfRx9jBoFKeNyPyGetLz6UsojfLegbwVuycyegLJxx9QeyIp7OXX05WkEbppVX9E7ji7VAxTsHHwbtZD3mmpmeDuddDv3tqRH10vR+54Rd r8u8t3D7 kLokS2If3p/1xNO7PUblsA984FMyFRYXMu5bnFn/LbeRVYCu7LrK6wQHq25KuxkTb+4B5Ij9VxFdxCNPHZT9Ev5kootxPhrW6jwu29IqdiOn1uEcwUButjmGf0Vfvwec0do9wcKNVJX2zbFBo7wM1ioB5Xm9Gz4JLwAwLUWHhLq8JrJRPU+DcLEb7XJRSjqcySMqtD0JHkZugI+fEQ4f0Y1KJOR1Y1ptmCoLo7ECxOvRvtMkE0qbxHAn2eqwixqdG+Z3MhJYHutgif+qg8E8CygYlx05D5Z9H+2tZA1KfgMuKId66thGqRoeRyeWcUfvwR3wDlJq0yztrVp8eR70uBOSVsPD3kyVoHeId2wRtn+HFcuqu4dJrXxnIT6JdmP9yTr0NJNUbUUvhZYA0VUJnpIRYAwqZBU5XmaNkq7lFYrT1O9MVvaIZDlpy/Q== 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 --- Changes in v2: - Don't set index and last again needlessly. - Link to v1: https://lore.kernel.org/r/20230403-regmap-maple-walk-fine-v1-1-09512dd51e50@kernel.org --- drivers/base/regmap/regcache-maple.c | 4 ++-- 1 file changed, 2 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..e48f5b0c96cb 100644 --- a/drivers/base/regmap/regcache-maple.c +++ b/drivers/base/regmap/regcache-maple.c @@ -22,7 +22,7 @@ static int regcache_maple_read(struct regmap *map, rcu_read_lock(); - entry = mas_find(&mas, reg); + entry = mas_walk(&mas); if (!entry) { rcu_read_unlock(); return -ENOENT; @@ -47,7 +47,7 @@ static int regcache_maple_write(struct regmap *map, unsigned int reg, rcu_read_lock(); - entry = mas_find(&mas, reg); + entry = mas_walk(&mas); if (entry) { entry[reg - mas.index] = val; rcu_read_unlock();