From patchwork Thu Oct 20 20:46:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej S. Szmigiero" X-Patchwork-Id: 443 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp316064wrr; Thu, 20 Oct 2022 13:48:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40tnlSxQdbwYfTK5zJ4C6k3FJk5flOysS0jDS2M8DhAw29A3CXIPj4fclPiMmqCczLdm7k X-Received: by 2002:a17:907:3f91:b0:78e:2fdc:92a3 with SMTP id hr17-20020a1709073f9100b0078e2fdc92a3mr11797037ejc.770.1666298914349; Thu, 20 Oct 2022 13:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666298914; cv=none; d=google.com; s=arc-20160816; b=jd2SOQa81XHhVw+85zNVL0Fv2oSM0kA6YqtFTs07l+vtzoYMq7UuzI+P1egPJuTaHz 3NbIVcd9Rm/mI/SL2r4f4nr3q1VTDJ4lwJ+EHk0iu/aMJCFr4AFUmiGHuYJr11lQ1489 vP+oWBh1BPci3R1DD5Hr7eIPkxy5jfWE2Zgl188Dis0vODpAEnxzXVRGbxPYt1JDdfdS a5vmEOSkERgdlJEOxsEZC73gbFRM76t6A3xWfjwIhxpREhkzvOVHvU80ljS9fYEZ18/Z 2o6AULmXkwqzTIXuO9u78cK2IdXkIgFONWvBpeDotdyClEh/A0fFQUDw6PNI+iy2u/V+ L4BA== 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; bh=JEXVa4iDyBou+KfiZpoT6xnh2pLn5IeNQXtOmvNWpBU=; b=VMQ5GWud3zMcgv/YPS+UprjcOMrzX8Sc94Z5NYvomXG5P94eYsNNcLtn5N/kyx2cqb lYh6WqJ/7F4B3nM4yosTxgJUUakTjDM7mfnPz0MFmkKZz0Rq6QqVAkOPFSElmtkHvJYf MxfOKkv+5Throh86/oN2FE5Ylf04yC9RH975sm8qgXz2DI4t4XRIQL7jqvmIQMYb0+J6 +rf+C257mF4/LWXZen8cp/tPUwKtBeiNzbIBBfyt3CR5OWL3xOZnnQsIHgRDilM3OBj0 nLE28Spz3DqkKQCQFKaHSQ8alNEr4Dwb6kXYPhWaZWvCymNmO6x7filHQx63b3F9BXmV KnQA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb35-20020a1709071ca300b0078dce6e5cf8si15686276ejc.436.2022.10.20.13.48.10; Thu, 20 Oct 2022 13:48:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbiJTUrm (ORCPT + 99 others); Thu, 20 Oct 2022 16:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbiJTUrd (ORCPT ); Thu, 20 Oct 2022 16:47:33 -0400 Received: from vps-vb.mhejs.net (vps-vb.mhejs.net [37.28.154.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EB6A21F953 for ; Thu, 20 Oct 2022 13:47:21 -0700 (PDT) Received: from MUA by vps-vb.mhejs.net with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1olcQy-0007Uc-He; Thu, 20 Oct 2022 22:46:32 +0200 From: "Maciej S. Szmigiero" To: Jaroslav Kysela , Takashi Iwai Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/6] Fix direct renaming of hashed controls Date: Thu, 20 Oct 2022 22:46:20 +0200 Message-Id: X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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?1747241050636542782?= X-GMAIL-MSGID: =?utf-8?q?1747241050636542782?= From: "Maciej S. Szmigiero" I've noticed that some of mixer controls on my sound card seem to be partially broken on the 6.0 kernel - alsactl wasn't able to find them when restoring the mixer state. The issue was traced down to the recent addition of hashed controls lookup in commit c27e1efb61c5 ("ALSA: control: Use xarray for faster lookups"). Since that commit it is *not* enough to just directly update the control name field (like some of ALSA drivers were doing). Now the hash entries for the modified control have to be updated too. This patch set adds a snd_ctl_rename() function that takes care of doing this operation properly for callers that already have the relevant struct snd_kcontrol at hand and hold the control write lock (or simply haven't registered the card yet). These prerequisites hold true for all the call sites modified. The core controls change and the emu10k1 patch were runtime tested. Similar patches for other devices were only compile tested. include/sound/control.h | 1 + sound/core/control.c | 23 +++++++++++++++++++++++ sound/pci/ac97/ac97_codec.c | 32 ++++++++++++++++++++++++-------- sound/pci/ca0106/ca0106_mixer.c | 2 +- sound/pci/emu10k1/emumixer.c | 2 +- sound/pci/hda/patch_realtek.c | 2 +- sound/usb/mixer.c | 2 +- 7 files changed, 52 insertions(+), 12 deletions(-)