Message ID | 20230613112240.3361-1-tiwai@suse.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp477565vqr; Tue, 13 Jun 2023 04:43:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6H7pouw8qDVpOR3P0tqAA6Q+lgPtutdX6XKXox+IAoGBk1ZzoQrh/UfXsXl04Ksjr524bL X-Received: by 2002:a05:6512:503:b0:4eb:1527:e2a7 with SMTP id o3-20020a056512050300b004eb1527e2a7mr5607672lfb.45.1686656619232; Tue, 13 Jun 2023 04:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686656619; cv=none; d=google.com; s=arc-20160816; b=FPQzSx5jZqe++iEs3RPlLPT4v6uSLp5Tnhiwa2f041OaIubwF2D5c6KZXWiyE0aIAK rUlOMHsBDW2RmCmbQGSjbGBlx72cD8Hm90FQ2oZnwBGUCTqzjgp7j+WR6wBLrzcH69hd +ZbMtphkMtlZ8G0awdrZXBr41eZbxfRzZg9dkUbTobJug7Ytr4DVi4FA9xet66YoS8e0 P35a+jkHlylhNzpEUclt3RlakBE6zIkJJY0SufuY1RhnynpdX3Ktu91x/sH5OSf4tzM3 417QmfBJhw4wkIm+qRUpmMtH2b/NLud6R/gMlIMtvAHDtScXGyKpczpPYVnWTVvE/+pS 9SIg== 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=sO60fsV+XdP0/uve4cp5yDDKZqVuceLf/J7QE90gvx4=; b=MfcM96aQVqlYpMiwTwDF66CQuwk5knPIOgKQyN2VOe+obsKyFQUsGW3HsIDEORk6p6 Jlio85MOugBkkZrkplatmp3EQ1Gu6P29iyzVOZHP3aSJzhI66aF2Eojq93Si8sDWPEld v3fdzXkUNJAmJTpy3kF3APxJPjg9o9NTcs6ss4xpx5FwZ+Mjq8vDlkVQjyPgxiS0efKM dQJIBNYVqWRQdjf3Oamjqd1OixWujS03BR0nawAQLOnYfPE8NLjUqWORGAnF6rfaxioE OK89avEYEUdqhBbK+fygQY04AdjEMwkvszkGY+TNVXJVlwQfIqj8KYZG2Sx4hVgbdSHp tNeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ejablnhw; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020aa7cb90000000b005183ce42dafsi3172868edt.597.2023.06.13.04.43.14; Tue, 13 Jun 2023 04:43:39 -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=@suse.de header.s=susede2_rsa header.b=ejablnhw; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242004AbjFMLYE (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Tue, 13 Jun 2023 07:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239702AbjFMLXt (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 13 Jun 2023 07:23:49 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 793E01FC3 for <linux-kernel@vger.kernel.org>; Tue, 13 Jun 2023 04:23:26 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9611F1FD8F; Tue, 13 Jun 2023 11:22:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686655362; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=sO60fsV+XdP0/uve4cp5yDDKZqVuceLf/J7QE90gvx4=; b=ejablnhwvL4lTGlWKUz3ffv4cDRlSuI9FS31tOH+oWSfCENaycQFl4IN5rPjKR0KWtl2zf Qikby3IYbqxRff4+pFPs+hSL0eLCPHC1E0sdMQXoQJ9Os38jX8xHJS4n8mzQ74A+J9Q2QN sYQafm6AO/SkpgIm1drAKldyAmshZwk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686655362; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=sO60fsV+XdP0/uve4cp5yDDKZqVuceLf/J7QE90gvx4=; b=XjSaphVlBL6b0B4XsnfWafGKd/gGG/alhSDI7S2B9X0E+Jwai6Pwq7wfPwxH1/hBtxsgTG HBZ9YplLhokcUeDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7109013483; Tue, 13 Jun 2023 11:22:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Lb22GoJRiGS5EAAAMHmgww (envelope-from <tiwai@suse.de>); Tue, 13 Jun 2023 11:22:42 +0000 From: Takashi Iwai <tiwai@suse.de> To: Mark Brown <broonie@kernel.org> Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2] regmap: regcache: Don't sync read-only registers Date: Tue, 13 Jun 2023 13:22:40 +0200 Message-Id: <20230613112240.3361-1-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,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: <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?1768587650988635274?= X-GMAIL-MSGID: =?utf-8?q?1768587650988635274?= |
Series |
[v2] regmap: regcache: Don't sync read-only registers
|
|
Commit Message
Takashi Iwai
June 13, 2023, 11:22 a.m. UTC
regcache_maple_sync() tries to sync all cached values no matter
whether it's writable or not. OTOH, regache_sync_val() does care the
wrtability and returns -EIO for a read-only register. This results in
an error message like:
snd_hda_codec_realtek hdaudioC0D0: Unable to sync register 0x2f0009. -5
and the sync loop is aborted incompletely.
This patch adds the writable register check to regcache_sync_val() for
addressing the bug above.
Note that, although we may add the check in the caller side
(regcache_maple_sync()), here we put in regcache_sync_val(), so that a
similar case like this can be avoided in future.
Fixes: f033c26de5a5 ("regmap: Add maple tree based register cache")
Link: https://lore.kernel.org/r/877cs7g6f1.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/base/regmap/regcache.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Tue, 13 Jun 2023 13:22:40 +0200, Takashi Iwai wrote: > regcache_maple_sync() tries to sync all cached values no matter > whether it's writable or not. OTOH, regache_sync_val() does care the > wrtability and returns -EIO for a read-only register. This results in > an error message like: > snd_hda_codec_realtek hdaudioC0D0: Unable to sync register 0x2f0009. -5 > and the sync loop is aborted incompletely. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next Thanks! [1/1] regmap: regcache: Don't sync read-only registers commit: 44e46572f0bae431a6092e3cfd2f47bff8b8d18c 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 029564695dbb..97c681fcf9f6 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -284,6 +284,9 @@ static bool regcache_reg_needs_sync(struct regmap *map, unsigned int reg, { int ret; + if (!regmap_writeable(map, reg)) + return false; + /* If we don't know the chip just got reset, then sync everything. */ if (!map->no_sync_defaults) return true;