From patchwork Mon Mar 13 07:18:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 68648 Return-Path: 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 + 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 ); 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 ; 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 To: Mark Brown , Greg Kroah-Hartman , "Rafael J . Wysocki" Cc: Alexander Stein , 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 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: 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?= 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 --- 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(+) 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); From patchwork Mon Mar 13 07:18:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 68651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1051940wrd; Mon, 13 Mar 2023 00:52:18 -0700 (PDT) X-Google-Smtp-Source: AK7set94o4x//zm1j22j30qEvQb+rwWBVtAXpCP2qXDmPo/kn104UdDYU3aXRibqdMdH3eg5N4OM X-Received: by 2002:a05:6a21:6da5:b0:cc:46bd:39b0 with SMTP id wl37-20020a056a216da500b000cc46bd39b0mr36305746pzb.56.1678693937888; Mon, 13 Mar 2023 00:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678693937; cv=none; d=google.com; s=arc-20160816; b=EHspkXOvc/GeeJTTmPedaLeaESb/W9YUbNUWLdT5fUJLDBrBK/Ty/0glNwRaLSrRiF efnwkGBlA8w7Q9e7C6hlwZ4cDdX9xsm3R762DhS+r/b3Cm7nGsfCkwyDYMstuccXT6QQ vQA06FzKNz1AglFHOqYHHPczHaXDn9YBtxuQjePI3ppyWqYlW6uoYSxC2hJ1UxRtC/We 00hTU8CCBGMF+4FEPylZgk4OmTiWOfCEHlT0COTxsKi9z6jR98FFEJMmipCNh19M6Ggp vTqTYWzdLcuAHTTNqKOCKbCnyfQdt4SiO7XBAhQDnMi7lSl+/HxLmIBRNGcd2EzVeM9T 5/Ug== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=UTvS6bH+xEecuSdoABqAcL5lGczgRjF8mO/bWBDGeaE=; b=CmzRN1iFnfjDbWUw30Jh99UGfRfYebCeycBpiueltZbCGV4ZbbcCsXSdJxVZlhS1tY pscqm2kgpyYLg0ZzymTt3b8LcvWC7hp7CCjNSWUJeXSs+zHeg2H9tuKoEn5WmjJ7W5d6 wuD+/zkL/FCqit+akR48JStLtaTQgDKzSVG/+7QCPvixIj4LmTY8gmPJ0lKn+X9BwFwH EEe5gHIVTtt1mg3cNHPjTBd4lKntnmVqgbaRW6xBBptLoiw8Qd3W3WhJVGVY4hFQ8QTZ sHeC2GBezAeSH92ZuNq6brEXXZHUEuyld9yML0sOTUNaozadVhSiNJL2WbbPCiywRnOo 3GBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=SFNpZxUh; dkim=pass header.i=@tq-group.com header.s=key1 header.b=fsr+qiQS; 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 z127-20020a623385000000b005e80be65733si5784467pfz.35.2023.03.13.00.52.03; Mon, 13 Mar 2023 00:52:17 -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=SFNpZxUh; dkim=pass header.i=@tq-group.com header.s=key1 header.b=fsr+qiQS; 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 S230000AbjCMHSo (ORCPT + 99 others); Mon, 13 Mar 2023 03:18:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbjCMHSe (ORCPT ); Mon, 13 Mar 2023 03:18:34 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AE6322A03 for ; Mon, 13 Mar 2023 00:18:22 -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=1678691902; x=1710227902; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UTvS6bH+xEecuSdoABqAcL5lGczgRjF8mO/bWBDGeaE=; b=SFNpZxUhHAyS2pk02GecwqVPkpDcQI9bc4h9jvIq4z9iX+KpkXZB9xfW 7bw9qdlRtu+cwXoWBQ9uJlQGvFItkp+thKe2oIe4skXNpI+0RTXJk/VM7 ChMy1t8VJtA2oubzAttH6WJltHlssXggV8UUh5rpluTNVhXQVG3v6/Jwx /Spwzl6D79mMYaoUZjoXm3H+RSx5JzxVJoaf9aQG2d0rd7/legu1YH/k9 WMwWmV3GfO3wBCgje5gV3B6k3Q/+cI+xTLw+SdcUSfR+dgH5s0PYTewbX 7r4SEQq97XyZ1PiZ2SgGyA57P3E4MIcQISvymntNkHBpK8//PtcwuQrx9 A==; X-IronPort-AV: E=Sophos;i="5.98,256,1673910000"; d="scan'208";a="29633087" 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:17 +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:17 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Mon, 13 Mar 2023 08:18:17 +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=1678691897; x=1710227897; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UTvS6bH+xEecuSdoABqAcL5lGczgRjF8mO/bWBDGeaE=; b=fsr+qiQSRvzHVr4IDA/vBWxzbhf8RZHSk8osvCbXUKn9JxnRlC2lkLbB +PGoWzQfJFdno935egoKYSzLJqXKrx9rzLF4jEPlaPEflYqKu4Xi//vCa q1ud6fgy3zm7necnjaRFGH1NYGq2MoxfJBNR9CzyL7lseyyJrYR4pNTDX I9jwkF+UlFOeYwPeroQEo0rf6fANaTusPUsU+LwId0cxDYtmiLsMQG6Hg 2ybG+3jze8bTQ1nR/aN69Cd18CoN9zShArZLmW0TNFucsDG2t/yCKBvop N605p3BSREskRA++RZEBpwBDUZ+1u3x3N2niZxnTzbMnQiZZsDCOW3TMR w==; X-IronPort-AV: E=Sophos;i="5.98,256,1673910000"; d="scan'208";a="29633086" 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 BCF27280072; Mon, 13 Mar 2023 08:18:16 +0100 (CET) From: Alexander Stein To: Mark Brown , Greg Kroah-Hartman , "Rafael J . Wysocki" Cc: Alexander Stein , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] regmap: cache: Fix return value Date: Mon, 13 Mar 2023 08:18:12 +0100 Message-Id: <20230313071812.13577-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230313071812.13577-1-alexander.stein@ew.tq-group.com> References: <20230313071812.13577-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760238174484242577?= X-GMAIL-MSGID: =?utf-8?q?1760238174484242577?= checkpatch.pl warned: WARNING: ENOSYS means 'invalid syscall nr' and nothing else Align the return value to regcache_drop_region(). Signed-off-by: Alexander Stein --- drivers/base/regmap/regcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 8031007b4887d..0482cf1c3231b 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -242,7 +242,7 @@ int regcache_read(struct regmap *map, int ret; if (map->cache_type == REGCACHE_NONE) - return -ENOSYS; + return -EINVAL; BUG_ON(!map->cache_ops);