From patchwork Fri Mar 10 07:39:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 67253 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp737018wrd; Thu, 9 Mar 2023 23:48:39 -0800 (PST) X-Google-Smtp-Source: AK7set/kHH61o0U7EqwQ7HVJaOl98l8UNmV3PzzEB5kAl0DD2Tdve3CZeloGseh0yC2MkK2++1rS X-Received: by 2002:a17:902:e5d2:b0:19a:75b8:f50c with SMTP id u18-20020a170902e5d200b0019a75b8f50cmr30797000plf.31.1678434518745; Thu, 09 Mar 2023 23:48:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678434518; cv=none; d=google.com; s=arc-20160816; b=no3KW7nh5UffePigskxtf8jgH/ngzLhWF77ThIeLXrhA3Zu5sS8sJ7JuaQoUFpNRlu qBRewNOtVSXy/L2rAJmn1PYM404gf0M1VRSKfguLCM/Loj+kGAk1+KERdsAmDnLO/Y1m SMc6eKZSkCEKSFnuPwxiPuTcN1qQuuKzocq1MJbRANP1aQ2dOnatg2Fmncy9szoZhMEt LVFwomJyVAM8FJ4z+Wv9hPcp3cYGrJC1L7LfHLEX0bTktGFs1dIIKzfBb9SQDuczuw3K zYhmLU1D2ga6lhyKXQFb0jAS0xapETGkBirfWxWFLFAn0MtQiVdq1zQSlmaqnSioE/ol RJgw== 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=RVir8PNcQqVGvCKOviPPrwuzapNZGlD3K49gWLW3WRM=; b=r6xDOWnHXlitMiWWlsd13AStvvmcGUpH4i68NJEM9AopX6PnqVowU+pJXWxUJc8jw3 Rzpzl91uQdpuHToUCMB6nfrb3w3nPtir29WubLwooYrQgi6U4dPLuygwoDgEWMWzhmiB q3D715ffs5EBv4b9vlZFeVdqr58Y2jj2NUShCGZEWIyh6b8GkhkiR1vPM2qAL0BdAT5J GD2gPftgCjpaKaMDAJVqQrXZ5uU8dupsQg03yim5Zcga5SdbidIbVm45fuEbVtrQOHch qYDdiedh7EtXDVLTb9golyuM4BO2JnpzGEn8i8x3UFWuXEcJNZbc6JyraU8Ss+uaEFwr rN0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=YKYxce8p; dkim=pass header.i=@tq-group.com header.s=key1 header.b=k5Lm6vTr; 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 e13-20020a170902cf4d00b0019aa9ef4f47si1485486plg.443.2023.03.09.23.48.24; Thu, 09 Mar 2023 23:48:38 -0800 (PST) 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=YKYxce8p; dkim=pass header.i=@tq-group.com header.s=key1 header.b=k5Lm6vTr; 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 S230171AbjCJHja (ORCPT + 99 others); Fri, 10 Mar 2023 02:39:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230199AbjCJHjW (ORCPT ); Fri, 10 Mar 2023 02:39:22 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AC61F2C2A for ; Thu, 9 Mar 2023 23:39:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678433959; x=1709969959; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=RVir8PNcQqVGvCKOviPPrwuzapNZGlD3K49gWLW3WRM=; b=YKYxce8pmuvV3NLlVTWNvNQz0Izu8XMzHPq/jUiTDeykPd88eIvMmA7p eg8C4lbLRcUyN4eXvE8JKb3VHNiGNtVlFk/fofx0DqG9skQKhEfF8quPm 3rf+mSSmmRLywQEHvdwDERK97175UX3qAoJFMwy/s4kbT0TfzktES6KJQ pnmQOnEBvPpCI80dc7XH9JihwTNaSA1YL6zLVbQtTdBww+oQZOTFG18Yw nimxMMWr5SPrmeFCZVOOIj0p90yO+XKYMoOC/UnR3yxYy5p43DiGVVfc7 DakfiPwnmAfxEiBEqIAHx8D13+VS7WWYU1CS+E1HOHKx0V6PbwHK2KZWb A==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29596580" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 10 Mar 2023 08:39:17 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 10 Mar 2023 08:39:17 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 10 Mar 2023 08:39: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=1678433957; x=1709969957; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=RVir8PNcQqVGvCKOviPPrwuzapNZGlD3K49gWLW3WRM=; b=k5Lm6vTrEVwK6Pr6smcQcDMz1ugMIjfmp36LKcwZI4gwSx2z+UjZp6/1 7lSsmcrQNutaVB50ftsuLrW9ago+5rXL4vUktb5IaeiS874j6x0/m8M7C EtdMF9nToxxcLAQ/evEdut3UuSQ4GiTSRtcAm/txOywdZ8DhSIWziq9+o JQHYI4cCMWhEAQNZpHQWxloS9Sgm7IemTNqXXF5skcAI4HbLbvCBEA+Wn 6vSnaSietokZfxhab+r5g4zmhdkvi5RurDJwrlvQEWhuLLEI4Nqmj9hLY B/9X6hkeyoBMn4O4j6+N1bV4UwqT7xXDP5VUTqdCmxLClKzUSV/XCng0o Q==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29596578" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 10 Mar 2023 08:39:17 +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 16E92280056; Fri, 10 Mar 2023 08:39:17 +0100 (CET) From: Alexander Stein To: Mark Brown , Greg Kroah-Hartman , "Rafael J . Wysocki" Cc: Alexander Stein , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] regmap: cache: Do not panic for REGCACHE_NONE regmap Date: Fri, 10 Mar 2023 08:39:10 +0100 Message-Id: <20230310073911.3470892-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,URIBL_BLOCKED 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?1759966154037914904?= X-GMAIL-MSGID: =?utf-8?q?1759966154037914904?= Most regcache operations do check for REGCACHE_NONE, before ensuring doing BUG_ON(!map->cache_ops). The missing regcache_sync* functions panic on REGCACHE_NONE regmaps instead. Add an early return for non-cached ones. Signed-off-by: Alexander Stein --- 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 362e043e26d8..b61763dbfc68 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 (map->cache_type == REGCACHE_NONE) + return 0; + 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 (map->cache_type == REGCACHE_NONE) + return 0; + BUG_ON(!map->cache_ops); map->lock(map->lock_arg); From patchwork Fri Mar 10 07:39: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: 67252 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp736498wrd; Thu, 9 Mar 2023 23:46:36 -0800 (PST) X-Google-Smtp-Source: AK7set+EN3jvJ1RtBb0g/19TT3D+sccfaevkIbdFPqUd411u4v43JzoxNfSk3JzwfoI1UaGX0ytJ X-Received: by 2002:a17:90b:1891:b0:234:a9df:db9b with SMTP id mn17-20020a17090b189100b00234a9dfdb9bmr1459972pjb.13.1678434395762; Thu, 09 Mar 2023 23:46:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678434395; cv=none; d=google.com; s=arc-20160816; b=JKg8IhyIORzZZkqMFbEqjLe0XqEzpnRKFgHji6CRnuQdxvqqdLCnQEyfFdKF23xhCK 6rUZ4lb0PC1UNV/ct+u+iIv0BfF9W9X9H2WsT+BMvOf33H/u7YNFuCks+mnaiM1xtF0+ UgzMBkI4+MzkRjIbRZpXsLG4HB1JxH4RkjJ+zUtrv6EpUcROABhlZvABtW9bFQ0Ww1Hd og2VFQZkcWnT7or5877tB9sPLE1rDsywnAIpfdJklMZwMDf3ud1cF85duZzWsQLrWUAf bjjaZsOBIqv+BxKOzwzGfNJcp7P1zedh9s2pnznOkOpcFFZoBqM5oL/wcZ0vukmyTj07 X3Wg== 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=2rW9oMWvY+NquKDnF5bLOq8e5GEMLalpiu7hkMsEjBo=; b=D4wLK24wXRJVaf2qDRkRYctUPi5li/+1alXXue3ZFjdJLvS8uAxI5VJhNqNsun4iIT 6PppNo0Y5Q1t7Rkk7K165HBouUsLWF8g9+UeX29htenBuqlQOCEcqLNaJb8706QLjz8B q+WhQu0xfTDVWiOoU2vWLCH5xdVmfyrlrRh/KJ5P4i+vQGlyKmQIupbLRUfg7CuX1zcn jJIiWUvQZ4I9r4f3WgOswBboaR4UQfJszjJAxSGVbrT9oPeBneHbBk7Ruy4f76+bazpY TQ9ILj7jxMWdeo78ob0fkQ13oMEY7BfiDE86rL7feuy5eyv6oW9duG4gBNcrtyOQCqvk Qp6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=YAUb3NyW; dkim=pass header.i=@tq-group.com header.s=key1 header.b=SIBj3YJi; 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 v5-20020a17090abb8500b00225c981fee5si2022209pjr.112.2023.03.09.23.46.21; Thu, 09 Mar 2023 23:46:35 -0800 (PST) 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=YAUb3NyW; dkim=pass header.i=@tq-group.com header.s=key1 header.b=SIBj3YJi; 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 S230201AbjCJHjm (ORCPT + 99 others); Fri, 10 Mar 2023 02:39:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbjCJHjd (ORCPT ); Fri, 10 Mar 2023 02:39:33 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3F84F31F1 for ; Thu, 9 Mar 2023 23:39:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678433962; x=1709969962; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2rW9oMWvY+NquKDnF5bLOq8e5GEMLalpiu7hkMsEjBo=; b=YAUb3NyWooQ+Vd/AvUw1iFoWUUTzk9L2Xu+1OioGmfCOg6pUwsn2V4z/ 3SsNzCVyfZOPlDycwZlhVbiYm0aGbwHvMoKdZRyJpm9EjrrWSoIgLLBCG OfvCcv+jEg7XVw8fQT3QXglYx3vp4wZRgAA113JwKIen75aPVx5UIMSFA HyxJY0MboXYCEOR1jSysq7QhS3UhcpjPECCvIM4eVYTGeJRcGKBIlSf6P T7+ADdyHHMd7Tb0LD4JqgPh/AnHqpwe3Sn2Zbr5kgZ63xP3RK0JoJIL4v wjZcm2HTMOodYxxmH4NvPSzi8yleF3F9mKeaI9GpQBLNWlR7SMsM6PGHR g==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29596581" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 10 Mar 2023 08:39:17 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 10 Mar 2023 08:39:17 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 10 Mar 2023 08:39: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=1678433957; x=1709969957; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2rW9oMWvY+NquKDnF5bLOq8e5GEMLalpiu7hkMsEjBo=; b=SIBj3YJi06VcVu0A2UxJudDjWg6BIt+nAcCugGlvS7a3WVzAvmecpR06 iek8vpUKKQZaE2TpjpXKxYK9zThKulMnwA2sVUy4+47TMFj4poa39hHek DrwPg6Isn9N7bOLt3qF0nmUP5r2GK38PJjIRufvwzuUtgMDxGeValG2fS BYeThnSXyXrbFkxs54o0DfLjOoaU4NOx0k7mE+HN0ReU9i7wFb3Q5AZMH 3WXSvNEF47GT/HSTpZoTF3kC3vQ6+CqpCZ8aUviEFibGeHVtBJkyOVsZN eZELXPP3H1xm9e2cR5Kx1DV7ycfAWDhSo8tKcVju2Dx3iPKRkpi913Q1C w==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29596579" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 10 Mar 2023 08:39:17 +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 33D7D280072; Fri, 10 Mar 2023 08:39:17 +0100 (CET) From: Alexander Stein To: Mark Brown , Greg Kroah-Hartman , "Rafael J . Wysocki" Cc: Alexander Stein , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] regmap: cache: Fix return value Date: Fri, 10 Mar 2023 08:39:11 +0100 Message-Id: <20230310073911.3470892-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230310073911.3470892-1-alexander.stein@ew.tq-group.com> References: <20230310073911.3470892-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,URIBL_BLOCKED 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?1759966025105502627?= X-GMAIL-MSGID: =?utf-8?q?1759966025105502627?= 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 --- This warning popped up while initially returning ENOSYS in patch 1. But I'm wondering if returning 0 for regcache_write is correct or not. This might be a follow-up patch though. 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 b61763dbfc68..c13f5f8872ac 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);