Message ID | 20230313071812.13577-1-alexander.stein@ew.tq-group.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1042495wrd; Mon, 13 Mar 2023 00:19:16 -0700 (PDT) X-Google-Smtp-Source: AK7set9+/qCoxv85dLbalI6gI+zuz06jHF+a4s30uCFLwJSaGQz7LLozeOseBeiDoaJhuI1Px7mo X-Received: by 2002:a62:18c8:0:b0:622:bdec:d49 with SMTP id 191-20020a6218c8000000b00622bdec0d49mr4386377pfy.11.1678691956239; Mon, 13 Mar 2023 00:19:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678691956; cv=none; d=google.com; s=arc-20160816; b=buAtq5PJEJNP39PG/MutC54nsYJODU0Pu3Ez1n206l3LD7PR7+wUZx+2n3jVyPs1Z6 eqrqucsyPnm/WyUey1cELCQ/jb++pMry+MsPg2yhpduMd3rrkJ05AjnrFqAi/iFHJjrV aWMqGKwjiEQoPFnEnb4RQTGgKUFUSv+HUHEiUSovmuL3/CXRkJ9GEcFkSHWCsM+qcpUS iqOAisiReGfLwFFfUH9nAMamWKNhoubVM5CmWix9imIO2jnn2fhCPo5SVP2NIIjH5mMD IJFivOMsXsHcrV2gcYT28+0e4QNXe8CFSgnS8MiECFDzaBAmZYjPQkdz7mx2TGGBB/FF Ki/g== 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:dkim-signature; bh=uxphrJO53fgWyH9ueJOT+zSEyjnRIfnzD2Q0hhVeNvc=; b=seI9bM9lcmqTYRQGEkjIOx4hIG5nXsIXMzyFpQe1JKme7noE1iMKGU0LPPEQYNFK3R IZ16pBuH0j1BrqAIAIIh6PoIetXSOkXLzw0jQ7mXK5a+l8uHvIPKUfWrhD7YGB218KqW MviWf/enect2jTPwLgWnh7cDUCrbZCHO25WUz4mxG7tUzXFngMOJoNxNH0ty3ygdtiXJ YHW/aC4sCpoeQFYCGzmN/V7lZRN7XBXk/hXng67t1vvjgbDuii3tFNkByys96MtN+UZ3 COFGa/D1UgW1jdJaH91SQtjNJ7p/tVbFVRvqOFmBI7ZanUp39kCyDl5WU3HaEcQ5c/U7 CaMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b="iMdVv/a0"; dkim=pass header.i=@tq-group.com header.s=key1 header.b=HMro8iQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x27-20020aa7957b000000b00593c99a9c87si5838137pfq.348.2023.03.13.00.19.01; Mon, 13 Mar 2023 00:19:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b="iMdVv/a0"; dkim=pass header.i=@tq-group.com header.s=key1 header.b=HMro8iQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229888AbjCMHSY (ORCPT <rfc822;realc9580@gmail.com> + 99 others); Mon, 13 Mar 2023 03:18:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229914AbjCMHSW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 13 Mar 2023 03:18:22 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF4811517B for <linux-kernel@vger.kernel.org>; Mon, 13 Mar 2023 00:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678691899; x=1710227899; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=uxphrJO53fgWyH9ueJOT+zSEyjnRIfnzD2Q0hhVeNvc=; b=iMdVv/a0aPgLbZKy6xmZ4Y+6laZTliaGnafPkbb0fLGAOvu5a4yLaM77 NN1ZEzLn0q1sFPWjjR7rU6WFQS8djudbF98uoL6F5b/5YZHkfj5oZS6fU NVaaMcMNFsnLyKz5BVNcEiM9tqP97IT1Zg8CBCfc8DLcroQ0CBApDPxb3 xUl9dxCT8Xj8WU5HzEnPD0PtK4sA4h3ebdivhCLO9T2La5UtNMUmR/Qsc nWd7e+AhZB6gNkwMaEiKMHS4onIfKIUd8ObSoVewAuME3KAdZu59hFV12 SOD/17rsz5AxlskvX6tHnCwcrBQ2hUjmDLxkO4k1rXtD4tmJP1QKadcVz w==; X-IronPort-AV: E=Sophos;i="5.98,256,1673910000"; d="scan'208";a="29633085" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 13 Mar 2023 08:18:16 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Mon, 13 Mar 2023 08:18:16 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Mon, 13 Mar 2023 08:18:16 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678691896; x=1710227896; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=uxphrJO53fgWyH9ueJOT+zSEyjnRIfnzD2Q0hhVeNvc=; b=HMro8iQ49nANm+L+bGGLmG3UFd9JhjbRNpfFacT6opGwAgqJy44GJ0R+ SVXWyqI1QBgAvgIOpBdjARatJYcqGr1Eq1i0L56Aqt9P17pO7VwZNKoox 7hld7X4ltrF6zm34OLG6rVIGFls9B1Yu9iFAYFlqh99p+X0yAmUDNY6v1 AubtB9sB08LKIXO8CZeQ0ypE5QFoDmoSJfdc6Tf/hJR5Se9fJw8+WhCnm CB6wIAmjQ79QEj/VAMtuMW7n4A+46pZYotuW/ta3uudDbSjPwVnV8yfhz 9RpaozDUhz5Bkt1h2n4TuMwzFIoeUArnAQTVNxJhn5vxqRmgkrFS+mHcS Q==; X-IronPort-AV: E=Sophos;i="5.98,256,1673910000"; d="scan'208";a="29633083" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 13 Mar 2023 08:18:16 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 9BDC2280056; Mon, 13 Mar 2023 08:18:16 +0100 (CET) From: Alexander Stein <alexander.stein@ew.tq-group.com> To: Mark Brown <broonie@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J . Wysocki" <rafael@kernel.org> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] regmap: cache: Return error in cache sync operations for REGCACHE_NONE Date: Mon, 13 Mar 2023 08:18:11 +0100 Message-Id: <20230313071812.13577-1-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760236096278730621?= X-GMAIL-MSGID: =?utf-8?q?1760236096278730621?= |
Series |
[v2,1/2] regmap: cache: Return error in cache sync operations for REGCACHE_NONE
|
|
Commit Message
Alexander Stein
March 13, 2023, 7:18 a.m. UTC
There is no sense in doing a cache sync on REGCACHE_NONE regmaps.
Instead of panicking the kernel due to missing cache_ops, return an error
to client driver.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Changes in v2:
* Reworded the reasoning in the commit message
* Use WARN_ON to indicate there is an implementation error
* Return -EINVAL instead
drivers/base/regmap/regcache.c | 6 ++++++
1 file changed, 6 insertions(+)
Comments
On Mon, 13 Mar 2023 08:18:11 +0100, Alexander Stein wrote: > There is no sense in doing a cache sync on REGCACHE_NONE regmaps. > Instead of panicking the kernel due to missing cache_ops, return an error > to client driver. > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next Thanks! [1/2] regmap: cache: Return error in cache sync operations for REGCACHE_NONE commit: fd883d79e4dcd2417c2b80756f22a2ff03b0f6e0 [2/2] regmap: cache: Fix return value commit: 24d80fde40c995b2e2faaf72034e12e60a416630 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 362e043e26d86..8031007b4887d 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -349,6 +349,9 @@ int regcache_sync(struct regmap *map) const char *name; bool bypass; + if (WARN_ON(map->cache_type == REGCACHE_NONE)) + return -EINVAL; + BUG_ON(!map->cache_ops); map->lock(map->lock_arg); @@ -418,6 +421,9 @@ int regcache_sync_region(struct regmap *map, unsigned int min, const char *name; bool bypass; + if (WARN_ON(map->cache_type == REGCACHE_NONE)) + return -EINVAL; + BUG_ON(!map->cache_ops); map->lock(map->lock_arg);