From nobody Sat Feb 7 21:15:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8635C77B7A for ; Thu, 25 May 2023 14:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241446AbjEYOAf (ORCPT ); Thu, 25 May 2023 10:00:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241197AbjEYOA3 (ORCPT ); Thu, 25 May 2023 10:00:29 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC6FDE49 for ; Thu, 25 May 2023 07:00:19 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34PBPhU2006105; Thu, 25 May 2023 09:00:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=I3l9dEf9Pxrt0iwsB+1r4Bv1ieTEMmtO3O+2uHhuyLc=; b=LjovRqGnqJBLgMnsb+RmNOQD7sbuLvL4avbkpPfOwJbdERZBaGjUvGtiuPgtqZ5t6KKm d1eH3bbHQloTje/fWpecbdxj+j2mD8PR+0A/nH8K769/KosJ7ggQHkInoptc7X72OQO8 Uwn/rCh54gQhiim3/i5EHxYBpJwgrlwU4Ep57jPssb7bG8/SsG2mqoRczVbyJtgND40n TR99g+ARvkSgw3BZgFUA0/DCOPovexzFmvsKOcq3hpGXbFbDQHkGHxtZDdaNh+5V6JEb 9utSVcSszXSf2Qo0jKOsWJLRfkQel16f30PTGbEBmjop/0PEM8wdDSKSwFIe7Qe2XCE9 nQ== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3qptmm6wbf-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 09:00:05 -0500 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 25 May 2023 09:00:03 -0500 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 25 May 2023 09:00:03 -0500 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.238.43]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 2591945; Thu, 25 May 2023 14:00:03 +0000 (UTC) From: Stefan Binding To: Jaroslav Kysela , Takashi Iwai CC: , , , Stefan Binding Subject: [PATCH RESEND v1 1/3] ALSA: hda: cs35l41: Clean up Firmware Load Controls Date: Thu, 25 May 2023 14:59:53 +0100 Message-ID: <20230525135955.2108140-2-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230525135955.2108140-1-sbinding@opensource.cirrus.com> References: <20230525135955.2108140-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: SDkSKi_mbC0gP72s9JAp318146wTbO-a X-Proofpoint-GUID: SDkSKi_mbC0gP72s9JAp318146wTbO-a X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Ensure Firmware Load control and Firmware Type control returns 1 when the value changes. Remove fw_mutex from firmware load control put, since it is unnecessary, and prevents any possibility of mutex inversion. Signed-off-by: Stefan Binding --- sound/pci/hda/cs35l41_hda.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index b5210abb5141f..d100189e15b83 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -835,34 +835,26 @@ static int cs35l41_fw_load_ctl_put(struct snd_kcontro= l *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct cs35l41_hda *cs35l41 =3D snd_kcontrol_chip(kcontrol); - unsigned int ret =3D 0; - - mutex_lock(&cs35l41->fw_mutex); =20 if (cs35l41->request_fw_load =3D=3D ucontrol->value.integer.value[0]) - goto err; + return 0; =20 if (cs35l41->fw_request_ongoing) { dev_dbg(cs35l41->dev, "Existing request not complete\n"); - ret =3D -EBUSY; - goto err; + return -EBUSY; } =20 /* Check if playback is ongoing when initial request is made */ if (cs35l41->playback_started) { dev_err(cs35l41->dev, "Cannot Load/Unload firmware during Playback\n"); - ret =3D -EBUSY; - goto err; + return -EBUSY; } =20 cs35l41->fw_request_ongoing =3D true; cs35l41->request_fw_load =3D ucontrol->value.integer.value[0]; schedule_work(&cs35l41->fw_load_work); =20 -err: - mutex_unlock(&cs35l41->fw_mutex); - - return ret; + return 1; } =20 static int cs35l41_fw_type_ctl_get(struct snd_kcontrol *kcontrol, @@ -881,8 +873,12 @@ static int cs35l41_fw_type_ctl_put(struct snd_kcontrol= *kcontrol, struct cs35l41_hda *cs35l41 =3D snd_kcontrol_chip(kcontrol); =20 if (ucontrol->value.enumerated.item[0] < HDA_CS_DSP_NUM_FW) { - cs35l41->firmware_type =3D ucontrol->value.enumerated.item[0]; - return 0; + if (cs35l41->firmware_type !=3D ucontrol->value.enumerated.item[0]) { + cs35l41->firmware_type =3D ucontrol->value.enumerated.item[0]; + return 1; + } else { + return 0; + } } =20 return -EINVAL; --=20 2.34.1 From nobody Sat Feb 7 21:15:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 687A5C77B7A for ; Thu, 25 May 2023 14:00:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241457AbjEYOAl (ORCPT ); Thu, 25 May 2023 10:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241296AbjEYOAa (ORCPT ); Thu, 25 May 2023 10:00:30 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1E73E4A for ; Thu, 25 May 2023 07:00:19 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34P8Mm6O016336; Thu, 25 May 2023 09:00:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=K1cH0ZtWLCX8sI+lF/y9e1IRq9QfXxo07nEhVezuoz8=; b=Ri4YGLK3FZa9c9GfrDkby/4rbuLaStJrwhynXGQAFAahKrJDEOKPlcnwDe2fqwFgNUF8 1G9rWJU3gXbHYKPaQpAsX7Oy4sKBPcT0gvzCdvFV1uypki79q0qRQnL7X9g67bCN3fpS QAZcWEi2THpSRpQr76ikxZo9VYqfuKHk2ovHHdeJtb4C/5+rpEA0pZxbIaD7njfn8Hnx EmVpb2TzgrhZIncTyl2mkqlB90vuRbNFVx4cNsdaAue/kwckxmAsgUvR3xnntbm3pCPb I5jv0nar1g7wdKEcRQD11SfYKkbtVR+YEmWUFhC0Y7SbhOcyajW9/lyv6CjHIAEazL5r Lg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3qsde8hsqk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 09:00:05 -0500 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 25 May 2023 09:00:03 -0500 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 25 May 2023 09:00:03 -0500 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.238.43]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 5A26E11D4; Thu, 25 May 2023 14:00:03 +0000 (UTC) From: Stefan Binding To: Jaroslav Kysela , Takashi Iwai CC: , , , Stefan Binding Subject: [PATCH RESEND v1 2/3] ALSA: hda: cs35l41: Fix endian conversions Date: Thu, 25 May 2023 14:59:54 +0100 Message-ID: <20230525135955.2108140-3-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230525135955.2108140-1-sbinding@opensource.cirrus.com> References: <20230525135955.2108140-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: pHXjP75wp6WerhLDKNYkfpBqR2QQBN9R X-Proofpoint-GUID: pHXjP75wp6WerhLDKNYkfpBqR2QQBN9R X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Found during static analysis, ensure variables are correct types before endian conversion. Signed-off-by: Stefan Binding --- sound/pci/hda/cs35l41_hda.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index d100189e15b83..b02462ae21f04 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -308,8 +308,8 @@ static int cs35l41_request_firmware_files(struct cs35l4= 1_hda *cs35l41, } =20 #if IS_ENABLED(CONFIG_EFI) -static int cs35l41_apply_calibration(struct cs35l41_hda *cs35l41, unsigned= int ambient, - unsigned int r0, unsigned int status, unsigned int checksum) +static int cs35l41_apply_calibration(struct cs35l41_hda *cs35l41, __be32 a= mbient, __be32 r0, + __be32 status, __be32 checksum) { int ret; =20 @@ -379,10 +379,10 @@ static int cs35l41_save_calibration(struct cs35l41_hd= a *cs35l41) =20 /* Calibration can only be applied whilst the DSP is not running */ ret =3D cs35l41_apply_calibration(cs35l41, - cpu_to_be32(cl->calAmbient), - cpu_to_be32(cl->calR), - cpu_to_be32(cl->calStatus), - cpu_to_be32(cl->calR + 1)); + (__be32)cpu_to_be32(cl->calAmbient), + (__be32)cpu_to_be32(cl->calR), + (__be32)cpu_to_be32(cl->calStatus), + (__be32)cpu_to_be32(cl->calR + 1)); } } vfree(data); @@ -745,7 +745,7 @@ static int cs35l41_runtime_resume(struct device *dev) =20 static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41) { - int halo_sts; + __be32 halo_sts; int ret; =20 ret =3D cs35l41_init_dsp(cs35l41); @@ -773,7 +773,7 @@ static int cs35l41_smart_amp(struct cs35l41_hda *cs35l4= 1) &halo_sts, sizeof(halo_sts)); =20 if (ret) { - dev_err(cs35l41->dev, "Timeout waiting for HALO Core to start. State: %d= \n", + dev_err(cs35l41->dev, "Timeout waiting for HALO Core to start. State: %u= \n", halo_sts); goto clean_dsp; } --=20 2.34.1 From nobody Sat Feb 7 21:15:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B9D2C7EE32 for ; Thu, 25 May 2023 14:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241450AbjEYOAi (ORCPT ); Thu, 25 May 2023 10:00:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241443AbjEYOA2 (ORCPT ); Thu, 25 May 2023 10:00:28 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71213E44 for ; Thu, 25 May 2023 07:00:19 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34P8Mm6P016336; Thu, 25 May 2023 09:00:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=6wz2vaNUW7aZwUs1r4Wrw1zVQNO/7hVTjslreqKkGKE=; b=KXx5GHEJEI67PDyzhvihgN06vrxfDxinV/ILLli7yUj4tFC5YZ1UAzRCRz+KcGVaJZDv f1hNMLXayHEuok1FW+Fl4Dc/bbhUNW7C/CjLr8pJz/Z2vd58uulg5aGNafD0IdrsBRLT hLdj0X0XkMDGVxUZ6VfoQYWAUpLF2T6xQeFfafICdvRzX7N+4fHEop1eUIciNjnwZpG8 SfrbZ0Ai24Nw6SKbTTme7H/QoXIoa/5j4oQ2p9dMkBAradaAMuxSHgJfxwsuiDXaDjCT UHRcZcxT5JKysfoVpif6CCenxHLHyiEsEPqxDT6fvEB9F8IOSSkMWIo5fA3PU4QHy8x/ fw== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3qsde8hsqk-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 09:00:06 -0500 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 25 May 2023 09:00:03 -0500 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 25 May 2023 09:00:03 -0500 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.238.43]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 8DE8815B4; Thu, 25 May 2023 14:00:03 +0000 (UTC) From: Stefan Binding To: Jaroslav Kysela , Takashi Iwai CC: , , , Stefan Binding Subject: [PATCH RESEND v1 3/3] ALSA: hda/realtek: Delete cs35l41 component master during free Date: Thu, 25 May 2023 14:59:55 +0100 Message-ID: <20230525135955.2108140-4-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230525135955.2108140-1-sbinding@opensource.cirrus.com> References: <20230525135955.2108140-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: nxDTKbOQ0DHagdHqVxAuRyG70FBAwcGv X-Proofpoint-GUID: nxDTKbOQ0DHagdHqVxAuRyG70FBAwcGv X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This ensures that the driver is properly cleaned up when freed. Signed-off-by: Stefan Binding --- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7b5f194513c7b..e3774903918fe 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6757,6 +6757,8 @@ static void cs35l41_generic_fixup(struct hda_codec *c= dc, int action, const char else spec->gen.pcm_playback_hook =3D comp_generic_playback_hook; break; + case HDA_FIXUP_ACT_FREE: + component_master_del(dev, &comp_master_ops); } } =20 --=20 2.34.1