From patchwork Mon Jun 17 13:03:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 806769 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9C114C27C79 for ; Mon, 17 Jun 2024 13:05:05 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6E09CDEC; Mon, 17 Jun 2024 15:04:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6E09CDEC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1718629503; bh=uc8wdHZiLzWn8eJSKz2w46aTnoymKmEOQTD+XqijcNc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=tbgOYPybRR2Yjp/pFdHHT/N+bzlEhD7+YrnY6wIgXaxXGY3mlKT1Gb1gMeis/Vjni 7KvkkYK5LV9CJ3n/HBdfbl2iO+/xy3TwItNgiHrknjEaB6+nkmoxU89x9qC/IuB6ay YIXX44UTZVtqjvMizxK4HydQ40BlfK6O9vjB6mUs= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 29348F8023A; Mon, 17 Jun 2024 15:04:34 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1DC64F805E1; Mon, 17 Jun 2024 15:04:30 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 93517F804F2; Mon, 17 Jun 2024 15:03:56 +0200 (CEST) Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 566FAF8016E for ; Mon, 17 Jun 2024 15:03:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 566FAF8016E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=FFySYTii Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-57c60b13a56so5133287a12.0 for ; Mon, 17 Jun 2024 06:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718629415; x=1719234215; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iu6ddlV0v3h5uXrvH+gS9VZsH+jfrjvNQ9t7e1CssRA=; b=FFySYTiiAd76e+Aqz29bzh67WfkHMmS2/Ff57/yB795bARo/WDXMAvX2/hW6voIGSL vdrxAnX3D9lKh+RcVk9UfRPnFYN3RHYfyiPjvjrkjZK5TunioHdsjRNFCN7kyJyBPJXG x5ZjRF8QAzvTGGzc8Q2A7QgNvTCVdna6EamUvvAIlnpK92PLjROPxMDLZIONr3t0eXWm OMutPkYYPrvQOON0I2mDYGm1pMk3gLE4lx1RpXeJfumCTEhaejdMQBwlhLjy8TV8NJ8o KU5JjWdjrciuNpMWpXvuqH1mg+k3FByWo/kmWTMPudeSTHmKHIHBVVNINQNTLXTsoI4w v0jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718629415; x=1719234215; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iu6ddlV0v3h5uXrvH+gS9VZsH+jfrjvNQ9t7e1CssRA=; b=Nu1G9RWV64ueRUzGGgO1wUmi1hm0zfH4D9BPI51HzRQgXmJc3JrOMfRrkKtKovJeAF dE3qt38fa7jkKXzIQTOqw9QAGOeCJSsnEelS74LmqMriapa+DUZYxvamUNkO3FNaYM3M i/a9INbdmQyvexsE9ESukGpXQCDsAvI5MLsK369HAfmKcWLG7MubEGMCupYqPCivebYh 9MU/8ORGeZoIWpOLQe/xsCCCRPosaJX2Aeeaga1qcxXZ+YDq+YyiLrpRT8ZmflrHi8H3 OwySBMrDBOC+61fZlXZwsVql9g2AS10R5iugzjU+z7kKYIRyBE8uwkfUf1N0Ealnx3Kk ogZA== X-Forwarded-Encrypted: i=1; AJvYcCWAU1P1266cp4CFllLykYJBChi+SWFhmeNkHl+8Zbkw9w8BBImGASA3IbNATvZw+8bm6YjaqwVBp8hLHNUEmlcWXUAwUcKnH17vInY= X-Gm-Message-State: AOJu0YxgzSDBxM9wbAqHugcvph+23N346BvXaEcgCzgW0rispPL9FIet C5vulU1KatodbgJvOtRptCKILLmZBlkgkBfFqwdLca8YkVp+Et9WGg2IQcrtkk4= X-Google-Smtp-Source: AGHT+IHUNni8AOLm/9P2UblMUUEc9IpqI2ijdEam/5ZmmPsfGDtdOofoplS92A83e6uVXMfUnxfkog== X-Received: by 2002:a50:cc88:0:b0:57c:6a71:e62e with SMTP id 4fb4d7f45d1cf-57cbd67f3cemr6395349a12.23.1718629415088; Mon, 17 Jun 2024 06:03:35 -0700 (PDT) Received: from [127.0.1.1] ([78.10.207.147]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72daa67sm6404349a12.38.2024.06.17.06.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 06:03:34 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 17 Jun 2024 15:03:19 +0200 Subject: [PATCH 1/6] ASoC: Constify of_phandle_args in snd_soc_dai_driver MIME-Version: 1.0 Message-Id: <20240617-n-asoc-const-auto-selectable-formats-v1-1-8004f346ee38@linaro.org> References: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> In-Reply-To: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Banajit Goswami , Cezary Rojewski , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=883; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=uc8wdHZiLzWn8eJSKz2w46aTnoymKmEOQTD+XqijcNc=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmcDQfFrlQ7abVRm3aNe8Kkl9L6AnbPjX6Y+7s7 DYZjCHDS7iJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZnA0HwAKCRDBN2bmhouD 10OYEACBZaQnC3nQIQco5nBJ8EikBNDkW/UcZU1og4FTRcbp49NVM6dFadb/k3/UZiat/5ZpaEq zsS2SII+bSFc0pkj1KCS2/ExC1+YCJ8MQdraBAWAOjH+oLOzomr5AoJi0EHVUnwna4KAkDmOqJ6 sZJlvKBFT5RO7JARzHJcQF5PbYZqNHdhjylzgGpMpbU004tward7+b8CIIIxfZQ0CEgRlZNYDxq GrxNQNuGYku2ZCEVD19+BVieHkWapsKKBb/i4VLf3ubPG4ajioK4HW/LOpCWazXHWf8fQUkm+wG oN4fspmO64ts3Z/UMSj8MC9d9Gp2gV2Vh7pwPk60392PqJAhckFIxFSb7jSA23axzglAaL2POiu +0nVAPDeMRMDusjP+eC4YTWgz2vOlGNOCEOzhsK5ZWHiLhdLGthsPQPGrDc7Vappth96fI+XBmI Y3weq2AWK7tLyDaeqoVF8eVJXL79LNq1JKnhDthxIeoCZ/3uZz5uU3bTrMLh113Kmpt33DO3t44 fSt6jsKQ2uMJEYxDJiRH1fQACXqQUpeM1ItArx6Cwc4SPje6WIiRbmPOReOyLrgtss1x5/LnrXJ 3gpAibBpSPjAg9thRJuMKNw9M+RfdYyQN6axgpnAZvd0cZjwE5xavkzExTwqawMW12HMJTPXVJb cxilbMW0MQ12miA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: WRCGFAXBFBBVLW4XTATWMA4RQKPZUDU3 X-Message-ID-Hash: WRCGFAXBFBBVLW4XTATWMA4RQKPZUDU3 X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ASoC core code does not modify contents of 'of_phandle_args' in 'struct snd_soc_dai_driver', so the pointer can be made as a pointer to const. This makes code safer, serves as clear annotation of core's intentions and allows putting pointed structures in rodata (if ever applicable). Signed-off-by: Krzysztof Kozlowski --- include/sound/soc-dai.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 279223c4ef5e..8b2ae7b71965 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -413,7 +413,7 @@ struct snd_soc_dai_driver { unsigned int id; unsigned int base; struct snd_soc_dobj dobj; - struct of_phandle_args *dai_args; + const struct of_phandle_args *dai_args; /* ops */ const struct snd_soc_dai_ops *ops; From patchwork Mon Jun 17 13:03:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 804900 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5EA7C2BA15 for ; Mon, 17 Jun 2024 13:05:55 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CDA8F847; Mon, 17 Jun 2024 15:05:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CDA8F847 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1718629553; bh=omsR+8Ap/pgl+yJ8epRiXzyiO4DMItCTdftfE6hvy4I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=QmqAKBoqMeGq71MuQwY8Xa33de9Cscmr5V4AVs3p2wialNLCcWINmaMEt6sMZhqr5 5Y+7Q0MfJILqC6FG1VK92HpgCSgHRUzgzBgu7X5PP/yVidz/3fRxm56zbVKh7HKN+i bu9Er5G1RhZZzIn6NOb6Sljmgnl8ivLUtJDrzvdg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D51E1F8062F; Mon, 17 Jun 2024 15:04:47 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 35640F8062F; Mon, 17 Jun 2024 15:04:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 694FAF805C0; Mon, 17 Jun 2024 15:04:18 +0200 (CEST) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5FAC0F8016E for ; Mon, 17 Jun 2024 15:03:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5FAC0F8016E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=YhyrMHl7 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-57cc1c00ba6so3391850a12.1 for ; Mon, 17 Jun 2024 06:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718629416; x=1719234216; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Lsy72X1hfcrIv1RUuI2dLQNfHKs4L1jXhq7QBcalSW0=; b=YhyrMHl7NuRW/WV2y5sg9M5cCa+T11OQjCMI9rXrp7pPjMRI2+CiEIYYm5hgYc7zR7 J18QL0j2sGOCtJSymeEXhQfXMTcVbEF4AMxfuSFyxQmINMjwPN9ZJmEZEmfpyk6Caf0R U/oQj+Bvk45walYCv/RkKiJjDIqe3t83pMjKMlma7FwM8V7/XDyDYMe4HczBhgNAHXH+ WrREF95SR11Eu7uGogO7+UVw/9m0YjRLQSIDyRq5GUNiqKPDcqfMWOC8LEnHnBQ0Z2qc Z/n2xiInOnwngKDyu9dnM5JKUqbLiBmx4JXRLJ1Ir0MdNnkiaXz+iSOztEfK1ewHO+PK nNBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718629416; x=1719234216; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lsy72X1hfcrIv1RUuI2dLQNfHKs4L1jXhq7QBcalSW0=; b=Rp2fpju7uiLxugqkILEw4Nks0SV5O9+uHOukY2FIyl0bPdeaXkMIHPYzPEXCpm2v7g 1URYSlJHtasFwDn9KEkBZiVGCyjPcSikcqcIgnd98UVjpTBZKxMNS9u8AOQoKiAXRksJ aUSp+wvzyO0uCMu9oGgEUkgrtK3c/2DLQknQgl6iC4kAAA0sM1wP7mMTDKfM8mFbiNCZ Tv4holcyPJJiY2XCJshmWlpBn9HiTPOg/5moII43TBaI0boTZu1uaqfi8zAqTf7Lw8+h PRvkDgkgdlehg+DySaR9GWNxEzqm8cXPHue7Jz6pMPC60OaFeZFz0K/3eNHO3qosVQk8 gihA== X-Forwarded-Encrypted: i=1; AJvYcCX3yIo5k55dqWFrWh7aJ0AGalhfreqpUTHnr2W7t7qg6V2iMQuVydBXFzSr034XOSYZbcFGiW5jdhohd8hS6iOMPEodCZ5JRqyKkx8= X-Gm-Message-State: AOJu0YxfkG5keJnCJ4Sy5bYJ11YKgQQZ//RcT6XEwA1UYfv2u1Y96nWX qJhSXvqtP/j7/o6wYvEIWLdg3Iybaow2IOdQW6YaobuKEkvvkWhW4Kl2ghEeFAY= X-Google-Smtp-Source: AGHT+IEI2XIgoT75h7Br+R9UPixD8KUgoWs/OqjcRXJjfTldGZCA0rliZmucMT0rRgFW1nfE8SfbEA== X-Received: by 2002:a50:8752:0:b0:57a:2309:c1e1 with SMTP id 4fb4d7f45d1cf-57cbd68ef64mr6670421a12.23.1718629416521; Mon, 17 Jun 2024 06:03:36 -0700 (PDT) Received: from [127.0.1.1] ([78.10.207.147]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72daa67sm6404349a12.38.2024.06.17.06.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 06:03:35 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 17 Jun 2024 15:03:20 +0200 Subject: [PATCH 2/6] ASoC: Constify of_phandle_args in snd_soc_dai_link_component MIME-Version: 1.0 Message-Id: <20240617-n-asoc-const-auto-selectable-formats-v1-2-8004f346ee38@linaro.org> References: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> In-Reply-To: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Banajit Goswami , Cezary Rojewski , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=847; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=omsR+8Ap/pgl+yJ8epRiXzyiO4DMItCTdftfE6hvy4I=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmcDQgtgcSzA+EJVFaCjgKa6XsvslogGH3FKDhC x0BhuH7NruJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZnA0IAAKCRDBN2bmhouD 1yXWD/4q/WLTFuKY8TnmWYhhWz7Agk+LgxO8M5bKRbWEfAq/vHP3RXcfUJqf/1pGw2mzaI0ma3A 2SeA460FgsXpYCe8mtzVXyK7qom2vGauqQf6cr647nVRyswwjvmBvFJvbLG7gYIVqd7MR2LcaiD fT9Ij/FWEkgg/wx+dbkdfe3RBnUDBUovKVdmm0bCkaVVEcJ2xKEKHfgahiJsl5QfUKEZba8Py4m yq5h6sUqp0B9nHEeI3nqiXqrxfpEVwtLa36sLIaTiKxJr8fZD6IbJzdj0RLpfc5KjCUHUS10Gps W1DFDdVBgs4+cjPSFOFuWpdsjEqJPVUvdqUtfFVMN/BCKhAQh9tlzyfA1LEqUwMuoWbG2LtIb27 nHBiek2zflKpj6HmIE/IUMiL+PU2mV84nXhC/na2XHsKBdgf4mw4H4jCIa6BgXhQRlF0S4Y7Itf A5G4krXG5u5oRiclhtF82cAVhHTfHWC/HIzxq/dSsEvTCxInYYJVNGbN/JUdCmZhP1M7k80k8j1 d2+YBSxO6/Y91bX32KnysxmN+w3oWFByAMrZZt+SxY/e8yHeTNVouW9alwbGN/xXNQ+LS8bte9i 23lUwC64C1+NkpIvn1+gzUGYGt5BWR9OoJZTiO1jqXU6r5B7c9qtxsLXCKgqL1Fok2Yg82EyV36 ljUJn0yU1qclZiQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: FY37UKUE5MG2BEKS2QUFGJKSSSIFAYIV X-Message-ID-Hash: FY37UKUE5MG2BEKS2QUFGJKSSSIFAYIV X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ASoC core code does not modify contents of 'of_phandle_args' in 'struct snd_soc_dai_link_component', so the pointer can be made as a pointer to const. This makes code safer, serves as clear annotation of core's intentions and allows putting pointed structures in rodata (if ever applicable). Signed-off-by: Krzysztof Kozlowski --- include/sound/soc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 33671437ee89..f02a51694ab4 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -675,7 +675,7 @@ struct snd_soc_dai_link_component { const char *name; struct device_node *of_node; const char *dai_name; - struct of_phandle_args *dai_args; + const struct of_phandle_args *dai_args; }; /* From patchwork Mon Jun 17 13:03:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 804901 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1553C2BA15 for ; Mon, 17 Jun 2024 13:05:23 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D91EDDE5; Mon, 17 Jun 2024 15:05:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D91EDDE5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1718629521; bh=VX3jXIVo7OD/d5slhyQ2JOKwHTUTWscqWdeqAmuzMjo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=RsbrLfUUFQiOkJ93DRYrQfj9Naxuw9DTzHPV18BuDb2EkAcDs3842gxTIC+C4Sc3Z zDjCKRvSXN27ofNq3Y9ImJJsjFXDsXwKl4MygwgbO/padWpmZVu21uFXZs64+koA+g CrwmsG3d+JDNPTWYRsspBJot4uPBCjajzlZ+okN8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id AE7D7F805F6; Mon, 17 Jun 2024 15:04:39 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C2ABBF805D6; Mon, 17 Jun 2024 15:04:36 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C280CF80578; Mon, 17 Jun 2024 15:04:06 +0200 (CEST) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 08F0CF80269 for ; Mon, 17 Jun 2024 15:03:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 08F0CF80269 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=TGjt4F2H Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-57cc1c00ba6so3391884a12.1 for ; Mon, 17 Jun 2024 06:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718629418; x=1719234218; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fwNKttZIaknYU/p94hFjfo07QErQbfojBQEzYo9fbrg=; b=TGjt4F2Ho+SlIHaP99h3jPjTg4bjiu8nHqsBsBTOLtb0BsidyMZMYZX/vA9hQ17iIR aGOFjcVIne3+RR3jaLh2+5DXVeaG8DwtTvDn12JunpLqxP+4vDjLZJOv/VSTE7Ftr18X r5dPmdCENyd4m5f5qTcaE72Xy32yG0Fkb6nXiQhfp5Y41jh37y0cE/bUAaee9BtWzw3y 1s0sdtDdmuKjf/a1g76NdSWQCokxjst8s+pZ9F5e2pG1zoXHpWMp9OFRiZB4X+J1PVU3 73caW1sOQKwI++cCPLUv/MsETVPc2SXGbn7NucS/rs3g+Kz4Z5sKkWzxQQVR0DARvn3e FkUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718629418; x=1719234218; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fwNKttZIaknYU/p94hFjfo07QErQbfojBQEzYo9fbrg=; b=CiEdx/+wE7vi7qwZk7oIpGBbVUJlYlOMkt5PUtVjmzm9Mia4/IveJaXUJWyeoDtszc kZPHBNrjRn3c4fArZpBnfh9GyLZVHB26XB9wRPNwWpTSrJ3bhdNMB49GNEk1Lz73j9MW F5OlpAWSJp0vDxN6j1YUtrEkVf2vZfkH12BBOTJ4MMoXjtaxx56BV7Y+la7zvBaAaAQr G+fFW2IegiNHRJEeq7rWklR0iEcWC0bxfo6xVE7vEr3ACvljHg8IbF4+RnaQ6BdvnWnK 9IjcE9nLQVGgf+ug7kV8f9TFJwz/7LTJHT1W5fXZNYzuZ2MWOdE0E58q0OpgydYeVXY7 fGTw== X-Forwarded-Encrypted: i=1; AJvYcCXlAQ9Xdsvg4XtQtoscRUyzL5eVksagBOtKDuKnKc9u9zGXh0Cq9h26c7IlzC43ztoiP5gPAWKUvKqEwEcax48j9XYEpbDBySYIV1o= X-Gm-Message-State: AOJu0YyTJnE7M7jcm+zpjE4XPuBa7IPRE9RDcLwpjT8/eCTKC5kCg4By KlBDlwxXR3rB1EN+9Gfj1yGk/aOOCNfqan2/KS98Y9A7uCXNQOfrNXHbvlggTHQ= X-Google-Smtp-Source: AGHT+IGgIBqh4uX9KfwxMcqwBDu9/iljNkN52lahHkwBIMERJ+qxU+nzE6Q+fwxKPK6bcXLvEdngQw== X-Received: by 2002:a05:6402:520d:b0:57c:c166:ba6 with SMTP id 4fb4d7f45d1cf-57cc1660fc5mr8196252a12.19.1718629417877; Mon, 17 Jun 2024 06:03:37 -0700 (PDT) Received: from [127.0.1.1] ([78.10.207.147]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72daa67sm6404349a12.38.2024.06.17.06.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 06:03:37 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 17 Jun 2024 15:03:21 +0200 Subject: [PATCH 3/6] ASoC: Constify passed data to core function MIME-Version: 1.0 Message-Id: <20240617-n-asoc-const-auto-selectable-formats-v1-3-8004f346ee38@linaro.org> References: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> In-Reply-To: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Banajit Goswami , Cezary Rojewski , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=10634; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=VX3jXIVo7OD/d5slhyQ2JOKwHTUTWscqWdeqAmuzMjo=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmcDQgQXTMvfUT6nWM0gX6VPGbU5CLT5yZyfavk 4fmzmaMEliJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZnA0IAAKCRDBN2bmhouD 18PsD/9tVUjfZHP3IfXinCHf2bRIh89VoXu9w0uu7NTZ8tbgj5oZZCsUT6Wt4qA1ldHiAqDp/67 w4T8cnfgDK93AqWEwXmYjH/7JpvT9CQJXMGBvlcdp76fozDvCTlr9EN09YvUpJKXbqRk3CXAMni lyT7i8Qa+pPyLtEBQi9wLuoybRHWO+65WG8BtUalzqvZnynl5EW9Qa6LpkcRFwWabCnIaCcKaw7 KbgPnXYuFlFIeR2U92Qq+B0xsoWi2sudv5S4YhZlui2LDVQ4eyFb3CZLvnSrXlyRUG4HfLbe0FZ SIPHoQmcjs3D/o2XmscYqh4SZGWjNCArktO+iEtAak0ACEwGTUczkyh+pafDnxExhdrYSLoEY1W uhQ8YsYujHplkcZKifqm2tTaWaFAKo+KAzGHEJbrgkB44iv7a5WCGR7FQFD+TNr9CO2LWuaajTr Tw87FYfyitME6BkAwLlTkEPEXl3D51tlht4zwyrP0A8+JNvJ2SdX2YVDV/Sn4m59Jg5ftB4yVgE oczn0b4AkKft9vRi/DRALGxyKam7tP+hWE+yWgCzIEI7gt56YiZsSD7kcvONaGv/I6UzgSgD0V5 FE1hBpcsSjDyPV9RDSL13gPXiI/coFR9Y0qVJXutxooSSpbp5VR0WIy0g6xAeqLKHRZB+mqZA+A MXEAVzUUjPNbjPQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: A4UM2CUAR5YOU4VRKXA5QKI7AZBXXJJL X-Message-ID-Hash: A4UM2CUAR5YOU4VRKXA5QKI7AZBXXJJL X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Several ASoC functions receive pointers to data which is not modified, e.g. pointers to 'snd_soc_dai', 'snd_soc_pcm_runtime', 'snd_pcm_hw_params' and 'snd_soc_dai_link'. All these pointers can be made as a pointer to const. This makes code safer, serves as clear annotation of function's intentions (no ownership passed to the function, no modifications) and allows putting pointed structures in rodata (if ever applicable). Signed-off-by: Krzysztof Kozlowski --- include/sound/soc-dai.h | 18 ++++++++++-------- include/sound/soc.h | 17 +++++++++-------- sound/soc/soc-core.c | 4 ++-- sound/soc/soc-dai.c | 8 ++++---- sound/soc/soc-utils.c | 8 ++++---- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 8b2ae7b71965..dccda9f1b160 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -180,8 +180,8 @@ int snd_soc_dai_set_pll(struct snd_soc_dai *dai, int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio); /* Digital Audio interface formatting */ -int snd_soc_dai_get_fmt_max_priority(struct snd_soc_pcm_runtime *rtd); -u64 snd_soc_dai_get_fmt(struct snd_soc_dai *dai, int priority); +int snd_soc_dai_get_fmt_max_priority(const struct snd_soc_pcm_runtime *rtd); +u64 snd_soc_dai_get_fmt(const struct snd_soc_dai *dai, int priority); int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, @@ -202,7 +202,7 @@ int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot); -int snd_soc_dai_is_dummy(struct snd_soc_dai *dai); +int snd_soc_dai_is_dummy(const struct snd_soc_dai *dai); int snd_soc_dai_hw_params(struct snd_soc_dai *dai, struct snd_pcm_substream *substream, @@ -218,7 +218,7 @@ void snd_soc_dai_suspend(struct snd_soc_dai *dai); void snd_soc_dai_resume(struct snd_soc_dai *dai); int snd_soc_dai_compress_new(struct snd_soc_dai *dai, struct snd_soc_pcm_runtime *rtd, int num); -bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream); +bool snd_soc_dai_stream_valid(const struct snd_soc_dai *dai, int stream); void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link); void snd_soc_dai_action(struct snd_soc_dai *dai, int stream, int action); @@ -232,7 +232,7 @@ static inline void snd_soc_dai_deactivate(struct snd_soc_dai *dai, { snd_soc_dai_action(dai, stream, -1); } -int snd_soc_dai_active(struct snd_soc_dai *dai); +int snd_soc_dai_active(const struct snd_soc_dai *dai); int snd_soc_pcm_dai_probe(struct snd_soc_pcm_runtime *rtd, int order); int snd_soc_pcm_dai_remove(struct snd_soc_pcm_runtime *rtd, int order); @@ -271,7 +271,7 @@ int snd_soc_dai_compr_get_metadata(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, struct snd_compr_metadata *metadata); -const char *snd_soc_dai_name_get(struct snd_soc_dai *dai); +const char *snd_soc_dai_name_get(const struct snd_soc_dai *dai); struct snd_soc_dai_ops { /* DAI driver callbacks */ @@ -518,7 +518,8 @@ static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai, void *play snd_soc_dai_dma_data_set_capture(dai, capture); } -static inline unsigned int snd_soc_dai_tdm_mask_get(struct snd_soc_dai *dai, int stream) +static inline unsigned int snd_soc_dai_tdm_mask_get(const struct snd_soc_dai *dai, + int stream) { return dai->stream[stream].tdm_mask; } @@ -529,7 +530,8 @@ static inline void snd_soc_dai_tdm_mask_set(struct snd_soc_dai *dai, int stream, dai->stream[stream].tdm_mask = tdm_mask; } -static inline unsigned int snd_soc_dai_stream_active(struct snd_soc_dai *dai, int stream) +static inline unsigned int snd_soc_dai_stream_active(const struct snd_soc_dai *dai, + int stream) { /* see snd_soc_dai_action() for setup */ return dai->stream[stream].active; diff --git a/include/sound/soc.h b/include/sound/soc.h index f02a51694ab4..a8e66bbf932b 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -534,10 +534,10 @@ static inline int snd_soc_set_dmi_name(struct snd_soc_card *card, /* Utility functions to get clock rates from various things */ int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); -int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params); +int snd_soc_params_to_frame_size(const struct snd_pcm_hw_params *params); int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots); -int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms); -int snd_soc_tdm_params_to_bclk(struct snd_pcm_hw_params *params, +int snd_soc_params_to_bclk(const struct snd_pcm_hw_params *parms); +int snd_soc_tdm_params_to_bclk(const struct snd_pcm_hw_params *params, int tdm_width, int tdm_slots, int slot_multiple); /* set runtime hw params */ @@ -837,7 +837,8 @@ struct snd_soc_dai_link { #endif }; -static inline int snd_soc_link_num_ch_map(struct snd_soc_dai_link *link) { +static inline int snd_soc_link_num_ch_map(const struct snd_soc_dai_link *link) +{ return max(link->num_cpus, link->num_codecs); } @@ -1299,7 +1300,7 @@ struct soc_enum { #endif }; -static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc) +static inline bool snd_soc_volsw_is_stereo(const struct soc_mixer_control *mc) { if (mc->reg == mc->rreg && mc->shift == mc->rshift) return false; @@ -1311,7 +1312,7 @@ static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc) return true; } -static inline unsigned int snd_soc_enum_val_to_item(struct soc_enum *e, +static inline unsigned int snd_soc_enum_val_to_item(const struct soc_enum *e, unsigned int val) { unsigned int i; @@ -1326,7 +1327,7 @@ static inline unsigned int snd_soc_enum_val_to_item(struct soc_enum *e, return 0; } -static inline unsigned int snd_soc_enum_item_to_val(struct soc_enum *e, +static inline unsigned int snd_soc_enum_item_to_val(const struct soc_enum *e, unsigned int item) { if (!e->values) @@ -1401,7 +1402,7 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np, snd_soc_daifmt_clock_provider_from_bitmap( \ snd_soc_daifmt_parse_clock_provider_as_bitmap(np, prefix)) -int snd_soc_get_stream_cpu(struct snd_soc_dai_link *dai_link, int stream); +int snd_soc_get_stream_cpu(const struct snd_soc_dai_link *dai_link, int stream); int snd_soc_get_dlc(const struct of_phandle_args *args, struct snd_soc_dai_link_component *dlc); int snd_soc_of_get_dlc(struct device_node *of_node, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 3ab6626ad680..724fe1f033b5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -297,7 +297,7 @@ static int snd_soc_is_matching_dai(const struct snd_soc_dai_link_component *dlc, return 0; } -const char *snd_soc_dai_name_get(struct snd_soc_dai *dai) +const char *snd_soc_dai_name_get(const struct snd_soc_dai *dai) { /* see snd_soc_is_matching_dai() */ if (dai->driver->name) @@ -3430,7 +3430,7 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np, } EXPORT_SYMBOL_GPL(snd_soc_daifmt_parse_clock_provider_raw); -int snd_soc_get_stream_cpu(struct snd_soc_dai_link *dai_link, int stream) +int snd_soc_get_stream_cpu(const struct snd_soc_dai_link *dai_link, int stream) { /* * [Normal] diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 03afd5efb24c..55d1a5a099df 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -134,7 +134,7 @@ int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) } EXPORT_SYMBOL_GPL(snd_soc_dai_set_bclk_ratio); -int snd_soc_dai_get_fmt_max_priority(struct snd_soc_pcm_runtime *rtd) +int snd_soc_dai_get_fmt_max_priority(const struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *dai; int i, max = 0; @@ -166,7 +166,7 @@ int snd_soc_dai_get_fmt_max_priority(struct snd_soc_pcm_runtime *rtd) * modes. This will mean that sometimes fewer formats * are reported here than are supported by set_fmt(). */ -u64 snd_soc_dai_get_fmt(struct snd_soc_dai *dai, int priority) +u64 snd_soc_dai_get_fmt(const struct snd_soc_dai *dai, int priority) { const struct snd_soc_dai_ops *ops = dai->driver->ops; u64 fmt = 0; @@ -471,7 +471,7 @@ int snd_soc_dai_compress_new(struct snd_soc_dai *dai, * * Returns true if the DAI supports the indicated stream type. */ -bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int dir) +bool snd_soc_dai_stream_valid(const struct snd_soc_dai *dai, int dir) { struct snd_soc_pcm_stream *stream = snd_soc_dai_get_pcm_stream(dai, dir); @@ -528,7 +528,7 @@ void snd_soc_dai_action(struct snd_soc_dai *dai, } EXPORT_SYMBOL_GPL(snd_soc_dai_action); -int snd_soc_dai_active(struct snd_soc_dai *dai) +int snd_soc_dai_active(const struct snd_soc_dai *dai) { int stream, active; diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index 20135a8359bf..11ba89c6b83c 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c @@ -21,7 +21,7 @@ int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots) } EXPORT_SYMBOL_GPL(snd_soc_calc_frame_size); -int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params) +int snd_soc_params_to_frame_size(const struct snd_pcm_hw_params *params) { int sample_size; @@ -40,7 +40,7 @@ int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots) } EXPORT_SYMBOL_GPL(snd_soc_calc_bclk); -int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params) +int snd_soc_params_to_bclk(const struct snd_pcm_hw_params *params) { int ret; @@ -79,7 +79,7 @@ EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk); * Return: bclk frequency in Hz, else a negative error code if params format * is invalid. */ -int snd_soc_tdm_params_to_bclk(struct snd_pcm_hw_params *params, +int snd_soc_tdm_params_to_bclk(const struct snd_pcm_hw_params *params, int tdm_width, int tdm_slots, int slot_multiple) { if (!tdm_slots) @@ -211,7 +211,7 @@ static struct snd_soc_dai_driver dummy_dai = { .ops = &dummy_dai_ops, }; -int snd_soc_dai_is_dummy(struct snd_soc_dai *dai) +int snd_soc_dai_is_dummy(const struct snd_soc_dai *dai) { if (dai->driver == &dummy_dai) return 1; From patchwork Mon Jun 17 13:03:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 804902 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D908CC2BA15 for ; Mon, 17 Jun 2024 13:04:54 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8AA7A845; Mon, 17 Jun 2024 15:04:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8AA7A845 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1718629492; bh=oC0pfgVa3Dlx6z7hG0aXQvQ0Zxw02RemJzxb8+JzjIA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=nh7GgrXGLh6w+OjxJOjeYGxoOAhmFaFF/GjYR2E7Vop98cR6VRpFArFJ5mRuD0tpK AW+aJuu7aLDi2OXFcR/BrBj2qC25ZozACwNxTN1/fmA1JiR3QSc5amYzTjGMp4rHt2 bIWa9KzRPX/45Cs/32gQJFmb++yI1Xp/JIq5bgWo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C8378F805BA; Mon, 17 Jun 2024 15:04:11 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 660B8F805BD; Mon, 17 Jun 2024 15:04:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E1372F80587; Mon, 17 Jun 2024 15:03:55 +0200 (CEST) Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 846B0F801EB for ; Mon, 17 Jun 2024 15:03:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 846B0F801EB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ebI9zZv5 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-57c83100bd6so5244127a12.3 for ; Mon, 17 Jun 2024 06:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718629419; x=1719234219; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=hXtYDqlssObtluhwd5yYfudjspyFdWITZQVCGqmtTl4=; b=ebI9zZv5Jo0II9JcmvHFWMDY47NO/QrA2iAQsLqAHoYRzXL6tSZ8bKL2lY+TwSeSFz +PFOQCJOtqR6bH4dAj+yYQ27GRyepKJdFcRFJ/STlxOoaXFnQ2Czu5sUji1KHTLwUdA2 c3cIZWF7rWpl1lW9Agmv8GfgoGzfi1P+tD1e42PzqyfZXj144ZYnO8i/eawnVQxFmMiJ diAhvEEipZj93AtNT7+WSnneGTPP8xCR7RNN0N/ASxeMZZD/T3W6wFxRqznfYeNmKs18 feMQnv03cIxrPhqTLY1E1UMru6XWktdITWum+sbAHvJSwkePGYtRvG3uI6xZvIcFG98x o3ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718629419; x=1719234219; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hXtYDqlssObtluhwd5yYfudjspyFdWITZQVCGqmtTl4=; b=BH2TTHsWrEI+Hr1oy4rRz4o/j57uJooP9kEMBURT9IQjdTdV6eRo3vvtDmxm5uWc1K wGS9JjLMZmf4y4yvT6Ac77sIE3rKRXg1Jjy6IfjEKdYWn3J9kCGEC34cpKOo7jIFkAwO IrZebZBpOe0MldYGUTl3QWguaD0Gj/WmrstfwZc4FCy5Fx0jsluSSOOMRCjVmLyH6e6u jjHAzaxO+379DyoYhtGBT7Oj4dCHNvUNWt7lbxe1NiAjc7iTPBpSZJI/j8kqYIjUknlU mF4sWcgsEi3SIEslmeeCzKeu8VqQqP5d8RGW2LGWeI3Wqr9n6lsdaIjM6D3xXdp9YdF+ XTeA== X-Forwarded-Encrypted: i=1; AJvYcCXM9o1xTsexKCNTNG3CvR6a2W/3txWerfxm/k5D2wPeKeXAnBtR30aRbM4LcLftJ91Bi/hx1sq2pVGP+knfPHGALn0efmbZW1CRp5Y= X-Gm-Message-State: AOJu0Ywu2SN1neMx5LUUsiW19s3R9uUV7vR8GjxJ5XFO++nWnyd1DQnq gkeKHZ+7c3gZRYndSZeKYnd85hT/7fT4KIsDNkJmEyrtDV37HZiYlwrR43lF8pA= X-Google-Smtp-Source: AGHT+IEaoNxxPiL1V9qAIPqtvGf7T8Fbc2bl94L6pFSRARPNikz+7tsmf13GahUrnRzW8iYLJeAUBg== X-Received: by 2002:a50:d793:0:b0:57c:ab22:18a8 with SMTP id 4fb4d7f45d1cf-57cbd651ceemr5891279a12.7.1718629419361; Mon, 17 Jun 2024 06:03:39 -0700 (PDT) Received: from [127.0.1.1] ([78.10.207.147]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72daa67sm6404349a12.38.2024.06.17.06.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 06:03:38 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 17 Jun 2024 15:03:22 +0200 Subject: [PATCH 4/6] ASoC: Constify DAI passed to get_channel_map MIME-Version: 1.0 Message-Id: <20240617-n-asoc-const-auto-selectable-formats-v1-4-8004f346ee38@linaro.org> References: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> In-Reply-To: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Banajit Goswami , Cezary Rojewski , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5852; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=oC0pfgVa3Dlx6z7hG0aXQvQ0Zxw02RemJzxb8+JzjIA=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmcDQhZuPcn9ycaEh5vyXfhKSTEwcApSHfOOgdW 25ck4WYxLmJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZnA0IQAKCRDBN2bmhouD 19WrD/9V0R1cp/MPvW47yAqk0nllwL/C2Pr4G0NMN0Q+vspSHXfzVxM/L2H5DM9CFGGP62GAj7S QF732eixnRp80gLfuEus2r9lU+V6X/ml2amoLnGT44cAOkWnMKUkpxznzLLB7h82tNO2nv7VWFD IeLEoZ2QsgTwGaX2OZNlcfFbseN/4XgRXmXSg1yoVyZIMnqcVH8V5wH6JyQhE+oZ4Gdp3xtvMWO QA5SGFFitEFNg+ThMHAn4H42opusXekUhBo+olBE9ITJlu+GVKn/EnEywhuIWbIdkEgbOglOrh6 bCAD3AfKSRVyWR3uaaEBaVtpozUoOYoQOphVtMgNZSPsHSb8K7wqYIQa8rmc106xEMNIHdoAOpF zFgaSAnE2dZDXiB2DKvXZdUucFkiIal8DdOZmm/TDKjHWCXLzk/k6ieZMCrSJ4kkvYYM9iInMIr ENakyrKoJa2K0S3+ddn5/ROVDgP7i70OMZhqUJIVGv7y3xpdyuzdy2uirPuAvrJjdjFqqjLvfSI +Exl+BZfTshQ5dFT4i6cH6iDJ/p+CCIL49B7B4gsxxmecQBtUAOmpEr4Dc78HA/SHIDmPfAmpH3 VTvCmQf0+yfwSzHwgoH1kFNCK2DN+YM3n5fKLiO1ohQBDJrzoR1eNvmIONEO9y2K60arvDtUZpo 4vAcuxBe3YAQ/bw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: QKYKZLQKSS2SGNXDLN7DLXRPUEZ3BJQJ X-Message-ID-Hash: QKYKZLQKSS2SGNXDLN7DLXRPUEZ3BJQJ X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: get_channel_map() is supposed to obtain map of channels without modifying the state of the given DAI, so make the pointer to 'struct snd_soc_dai' as pointing to const. Signed-off-by: Krzysztof Kozlowski --- include/sound/soc-dai.h | 4 ++-- sound/soc/codecs/lpass-rx-macro.c | 2 +- sound/soc/codecs/lpass-tx-macro.c | 2 +- sound/soc/codecs/lpass-va-macro.c | 2 +- sound/soc/codecs/lpass-wsa-macro.c | 2 +- sound/soc/codecs/wcd9335.c | 2 +- sound/soc/codecs/wcd934x.c | 2 +- sound/soc/soc-dai.c | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index dccda9f1b160..e9751cc94f8c 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -198,7 +198,7 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, int direction); -int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, +int snd_soc_dai_get_channel_map(const struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot); @@ -307,7 +307,7 @@ struct snd_soc_dai_ops { int (*set_channel_map)(struct snd_soc_dai *dai, unsigned int tx_num, const unsigned int *tx_slot, unsigned int rx_num, const unsigned int *rx_slot); - int (*get_channel_map)(struct snd_soc_dai *dai, + int (*get_channel_map)(const struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot); int (*set_tristate)(struct snd_soc_dai *dai, int tristate); diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index dfb7e4c69683..723d460daa1e 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -1648,7 +1648,7 @@ static int rx_macro_hw_params(struct snd_pcm_substream *substream, return 0; } -static int rx_macro_get_channel_map(struct snd_soc_dai *dai, +static int rx_macro_get_channel_map(const struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot) { diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c index c98b0b747a92..209c12ec16dd 100644 --- a/sound/soc/codecs/lpass-tx-macro.c +++ b/sound/soc/codecs/lpass-tx-macro.c @@ -1167,7 +1167,7 @@ static int tx_macro_hw_params(struct snd_pcm_substream *substream, return 0; } -static int tx_macro_get_channel_map(struct snd_soc_dai *dai, +static int tx_macro_get_channel_map(const struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot) { diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c index 6eceeff10bf6..832648b362ef 100644 --- a/sound/soc/codecs/lpass-va-macro.c +++ b/sound/soc/codecs/lpass-va-macro.c @@ -892,7 +892,7 @@ static int va_macro_hw_params(struct snd_pcm_substream *substream, return 0; } -static int va_macro_get_channel_map(struct snd_soc_dai *dai, +static int va_macro_get_channel_map(const struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot) { diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c index 6ce309980cd1..1e19c2b28a4f 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -992,7 +992,7 @@ static int wsa_macro_hw_params(struct snd_pcm_substream *substream, return 0; } -static int wsa_macro_get_channel_map(struct snd_soc_dai *dai, +static int wsa_macro_get_channel_map(const struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot) { diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index 42a99978fe5a..fc0ab00a253f 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -2014,7 +2014,7 @@ static int wcd9335_set_channel_map(struct snd_soc_dai *dai, return 0; } -static int wcd9335_get_channel_map(struct snd_soc_dai *dai, +static int wcd9335_get_channel_map(const struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot) { diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index fcad2c9fba55..b5a929659dc8 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -1960,7 +1960,7 @@ static int wcd934x_set_channel_map(struct snd_soc_dai *dai, return 0; } -static int wcd934x_get_channel_map(struct snd_soc_dai *dai, +static int wcd934x_get_channel_map(const struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot) { diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 55d1a5a099df..0c3a834e504d 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -11,7 +11,7 @@ #include #define soc_dai_ret(dai, ret) _soc_dai_ret(dai, __func__, ret) -static inline int _soc_dai_ret(struct snd_soc_dai *dai, +static inline int _soc_dai_ret(const struct snd_soc_dai *dai, const char *func, int ret) { /* Positive, Zero values are not errors */ @@ -327,7 +327,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_channel_map); * @rx_slot: pointer to an array which imply the RX slot number channel * 0~num-1 uses */ -int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, +int snd_soc_dai_get_channel_map(const struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot) { From patchwork Mon Jun 17 13:03:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 804899 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93F73C41513 for ; Mon, 17 Jun 2024 13:06:26 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 868CD845; Mon, 17 Jun 2024 15:06:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 868CD845 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1718629584; bh=6t3ZkqcNeoQQb/+n2YWFMbCwguXnWksaQugNhpxF2Qo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jgUWoS75mNi23GqYXsOlX3HlH/YqegPybk8fwS9FkkU9txMh581ZMOOO8bvdvKKmD Qn3NKnTbjo/KesLr5+HfgC6eBtA2H0xjjTWHT2AyTkSAYJECMnNZblHQ7M5kuzRlmJ tDjn2serpqPowPkCygDNJg6iZgB5KAgsTQT8jXyw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id F2BB9F80683; Mon, 17 Jun 2024 15:04:50 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 479AFF80694; Mon, 17 Jun 2024 15:04:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D0150F805E8; Mon, 17 Jun 2024 15:04:31 +0200 (CEST) Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B8062F804D6 for ; Mon, 17 Jun 2024 15:03:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B8062F804D6 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=rfxCpRfq Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-57ccd1111b0so1162583a12.3 for ; Mon, 17 Jun 2024 06:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718629421; x=1719234221; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ZTDFr+Cm8nDhokWGI5gZCj0FJzBUQBkkvhzHWESthf0=; b=rfxCpRfqHK1T8OcJWZd14Ast8Z2aUIwk+bbtAk4YQLjIlwpxjCa2xHTrT86dfbncrE eNpQU4v28rkMQuAJI0lm8+JSRFCS1Yf+rY8gCDowyNN4B83mWXs7xbEfqwrFepdAho9P uqu7l+wz4hcFUFoQlkoqVLn1M6Y/xrS53vagJg7Gyf1LonKyRixK6ZSss6JpWMB2wQQA Hpu+zluMeTjld6i8pO//ybGw+CIoS8AUoZ4gIL1i4pdS7ViN8XCcQhBZnUCnrGmweWxh Gnfy7GFv0z3FR9ZH0+kcgr87rIxxhSAIucb6yqK3XlZeYfTWwOkEydrKEFpxHoefCZpl cVXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718629421; x=1719234221; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZTDFr+Cm8nDhokWGI5gZCj0FJzBUQBkkvhzHWESthf0=; b=aBbqWnLJmCnCFNez7TlpKXlnBLDyRhmdMbDHOxhseW0M1H77DAqAENMXaKyJCfgzTk j1+AO/ZGdW+q+4Mz80q3f4ODb8kQD6h5KQxc+WNaUKNQ3A1NCwofZgIDyvOf67lDSXJf TZq143DCn6KgjLOJcm8d0kzc0PLjerGXx7jCA9V/yiVT8XxQZTrEJF8gN5LxMjSszqeE F5e6sOweeAVkH78UtX5JyjfEM+qR8kzUoM9wxa2jGcaUU008oVnkPLzHgL3JUByK8T9V dK2yVruABd0Xblqol/Y+cYIDD29tAsee7NpzmWIdSrbv4NGZM569oHp2vYygkeOACrIg MZgQ== X-Forwarded-Encrypted: i=1; AJvYcCXfDZqBXyuedUHNDtxPMw+NTRx8KcXQ3HqTq26p6SWSHLv5ZBYA+Uw2bwMELoCZkZGZEjQRJq6YsWIXmjmmj8e/vsssv5EIMB8QCIk= X-Gm-Message-State: AOJu0YzVX9OxYtaxVNh20cf4iZZWDTL5saVAYWjCIAotxxOlLmkokQKL XyLS9fuq2FSLtbgfBm1ffTSnC55uWqt2JU3uRjjXfRz7QGPeF+pbcJZnVrFgYb4= X-Google-Smtp-Source: AGHT+IG0uo6xbwCVLGemxh8QyVdwKLSreFz59C2NpY1GizeXqWOynGBerO7GobcCbP+4hBGajbjtkQ== X-Received: by 2002:a50:d48e:0:b0:57c:8e57:c3f0 with SMTP id 4fb4d7f45d1cf-57cbd685122mr7587945a12.16.1718629420843; Mon, 17 Jun 2024 06:03:40 -0700 (PDT) Received: from [127.0.1.1] ([78.10.207.147]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72daa67sm6404349a12.38.2024.06.17.06.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 06:03:40 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 17 Jun 2024 15:03:23 +0200 Subject: [PATCH 5/6] ASoC: Constify return of snd_soc_dai_get_pcm_stream() MIME-Version: 1.0 Message-Id: <20240617-n-asoc-const-auto-selectable-formats-v1-5-8004f346ee38@linaro.org> References: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> In-Reply-To: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Banajit Goswami , Cezary Rojewski , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6826; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=6t3ZkqcNeoQQb/+n2YWFMbCwguXnWksaQugNhpxF2Qo=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmcDQi7eqb6NCoOY1F4T3SR0rHmp1JLBzjzFZAV RyLBDlw2vCJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZnA0IgAKCRDBN2bmhouD 10zJD/0f8jAVU8xwRZB3dmHz6NbBZYEs6J97frvD4lszp15M1r2Nj9ltmNlVz2SkyA91uxRE6tQ JqLUjxdsx1ZT4mGBkH+kKn8+3b2U9KHa94WwoxU8f1qzlqiZH5J6Gnf43vheTlJlBHjRPHpswrH WSm0AT5yrsNHWqcL0GOcqU6M/PosUm9E8GisLC9VyAv2rj9mmGyECBu1pmbrPmLII9SpqRUfoTx pJNFAvbxwArTES3/2q/uhU1xNfk87XjEB6B8VCgf4gfvtXCjJ6sOwS6sOUcWYe1sl4iY1e1tqqQ 67FniMGKICaYNQR2Y8qtpGNRIGxRsMPI7cu1aJaGUirPxRfAI9KBl3GoJeNj4EWDm7E7SFFSSWj 5Jllwk6HVm/7eeQAqRMahY/aR2mIKOvEDGOn/s4dUppyFeniXbShPtb0UrdjZHWSjSaOB7d7vTd lVMJHm8naCLbYnIC9irS7xN+LJ/mxEdeRmwwnfW1CgZ78YPJRe20a9c7YUXBwCiDL0lHlk6I8XB 62uEI5KyNlpB+hZ9PO2Dv4gaxAGK1g+iCyqm9aNeoRzfaghDQrIZg5gm8ifWqSjBLMEeHQXWANF FRvxsaQSCGLLBfQh3bsgNCC8XzlXuzeeX2aMgQIoFNr23B5q6N2VtMCNOallLX8LFk9BIk9euNi scz/N+b7Bn3Z/zg== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: 2EDLULTI2ME2BX36NKLLIFS7SSQOK5NC X-Message-ID-Hash: 2EDLULTI2ME2BX36NKLLIFS7SSQOK5NC X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Returned 'struct snd_soc_pcm_stream' by snd_soc_dai_get_pcm_stream() is not modified by the users, so it can be changed as pointer to const. This is a necessary step towards making the 'dai->driver' a pointer to const. Signed-off-by: Krzysztof Kozlowski --- include/sound/soc-dai.h | 2 +- sound/soc/intel/avs/pcm.c | 4 ++-- sound/soc/soc-dai.c | 2 +- sound/soc/soc-pcm.c | 26 +++++++++++++------------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index e9751cc94f8c..bbb72ad4c951 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -473,7 +473,7 @@ struct snd_soc_dai { unsigned int probed:1; }; -static inline struct snd_soc_pcm_stream * +static inline const struct snd_soc_pcm_stream * snd_soc_dai_get_pcm_stream(const struct snd_soc_dai *dai, int stream) { return (stream == SNDRV_PCM_STREAM_PLAYBACK) ? diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index 88e711875004..c76b86254a8b 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -341,7 +341,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn { struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_soc_pcm_stream *stream_info; + const struct snd_soc_pcm_stream *stream_info; struct hdac_ext_stream *link_stream; struct hdac_ext_link *link; struct avs_dma_data *data; @@ -637,7 +637,7 @@ static int avs_dai_fe_hw_free(struct snd_pcm_substream *substream, struct snd_so static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_soc_pcm_stream *stream_info; + const struct snd_soc_pcm_stream *stream_info; struct avs_dma_data *data; struct hdac_ext_stream *host_stream; unsigned int format_val; diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 0c3a834e504d..9e47053419c1 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -473,7 +473,7 @@ int snd_soc_dai_compress_new(struct snd_soc_dai *dai, */ bool snd_soc_dai_stream_valid(const struct snd_soc_dai *dai, int dir) { - struct snd_soc_pcm_stream *stream = snd_soc_dai_get_pcm_stream(dai, dir); + const struct snd_soc_pcm_stream *stream = snd_soc_dai_get_pcm_stream(dai, dir); /* If the codec specifies any channels at all, it supports the stream */ return stream->channels_min; diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 711b2f49ed88..bad823718ae4 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -504,7 +504,7 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream) unsigned int bits = 0, cpu_bits = 0; for_each_rtd_codec_dais(rtd, i, codec_dai) { - struct snd_soc_pcm_stream *pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream); + const struct snd_soc_pcm_stream *pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream); if (pcm_codec->sig_bits == 0) { bits = 0; @@ -514,7 +514,7 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream) } for_each_rtd_cpu_dais(rtd, i, cpu_dai) { - struct snd_soc_pcm_stream *pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream); + const struct snd_soc_pcm_stream *pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream); if (pcm_cpu->sig_bits == 0) { cpu_bits = 0; @@ -538,7 +538,7 @@ static void soc_pcm_hw_init(struct snd_pcm_hardware *hw) } static void soc_pcm_hw_update_rate(struct snd_pcm_hardware *hw, - struct snd_soc_pcm_stream *p) + const struct snd_soc_pcm_stream *p) { hw->rates = snd_pcm_rate_mask_intersect(hw->rates, p->rates); @@ -551,20 +551,20 @@ static void soc_pcm_hw_update_rate(struct snd_pcm_hardware *hw, } static void soc_pcm_hw_update_chan(struct snd_pcm_hardware *hw, - struct snd_soc_pcm_stream *p) + const struct snd_soc_pcm_stream *p) { hw->channels_min = max(hw->channels_min, p->channels_min); hw->channels_max = min(hw->channels_max, p->channels_max); } static void soc_pcm_hw_update_format(struct snd_pcm_hardware *hw, - struct snd_soc_pcm_stream *p) + const struct snd_soc_pcm_stream *p) { hw->formats &= p->formats; } static void soc_pcm_hw_update_subformat(struct snd_pcm_hardware *hw, - struct snd_soc_pcm_stream *p) + const struct snd_soc_pcm_stream *p) { hw->subformats &= p->subformats; } @@ -583,8 +583,8 @@ int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd, { struct snd_soc_dai *codec_dai; struct snd_soc_dai *cpu_dai; - struct snd_soc_pcm_stream *codec_stream; - struct snd_soc_pcm_stream *cpu_stream; + const struct snd_soc_pcm_stream *codec_stream; + const struct snd_soc_pcm_stream *cpu_stream; unsigned int cpu_chan_min = 0, cpu_chan_max = UINT_MAX; int i; @@ -1712,7 +1712,7 @@ static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream) hw->formats &= formats; for_each_rtd_cpu_dais(fe, i, dai) { - struct snd_soc_pcm_stream *cpu_stream; + const struct snd_soc_pcm_stream *cpu_stream; /* * Skip CPUs which don't support the current stream @@ -1750,7 +1750,7 @@ static void dpcm_runtime_setup_be_format(struct snd_pcm_substream *substream) for_each_dpcm_be(fe, stream, dpcm) { struct snd_soc_pcm_runtime *be = dpcm->be; - struct snd_soc_pcm_stream *codec_stream; + const struct snd_soc_pcm_stream *codec_stream; int i; for_each_rtd_codec_dais(be, i, dai) { @@ -1787,7 +1787,7 @@ static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream) for_each_dpcm_be(fe, stream, dpcm) { struct snd_soc_pcm_runtime *be = dpcm->be; - struct snd_soc_pcm_stream *cpu_stream; + const struct snd_soc_pcm_stream *cpu_stream; struct snd_soc_dai *dai; int i; @@ -1809,7 +1809,7 @@ static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream) * DAIs connected to a single CPU DAI, use CPU DAI's directly */ if (be->dai_link->num_codecs == 1) { - struct snd_soc_pcm_stream *codec_stream = snd_soc_dai_get_pcm_stream( + const struct snd_soc_pcm_stream *codec_stream = snd_soc_dai_get_pcm_stream( snd_soc_rtd_to_codec(be, 0), stream); soc_pcm_hw_update_chan(hw, codec_stream); @@ -1835,7 +1835,7 @@ static void dpcm_runtime_setup_be_rate(struct snd_pcm_substream *substream) for_each_dpcm_be(fe, stream, dpcm) { struct snd_soc_pcm_runtime *be = dpcm->be; - struct snd_soc_pcm_stream *pcm; + const struct snd_soc_pcm_stream *pcm; struct snd_soc_dai *dai; int i; From patchwork Mon Jun 17 13:03:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 806768 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97CD1C27C79 for ; Mon, 17 Jun 2024 13:05:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DEA2793A; Mon, 17 Jun 2024 15:05:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DEA2793A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1718629536; bh=t1pfuj6KVvbLIvCe/7uLuam0l8+uLeVGQbLwoJtYOoU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=hzWEopAt4JJzWFmaBsOHrb2DWlyhEserdcxkQ7GrTVxRWUH2jtWqmG9RxAQyV28o1 IiI4boesl8Y09iLFYrIXilZb27hlfN6BEQ9YdY7C8ILgCAxX1vg9mki0Wkhfs+sQcF fxJIi1ZHKuOLyzSojBH4+xuGchbaHHwcMpmn0F5k= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 47160F80617; Mon, 17 Jun 2024 15:04:45 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3F50EF80608; Mon, 17 Jun 2024 15:04:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2AF32F80587; Mon, 17 Jun 2024 15:04:08 +0200 (CEST) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0159DF80154 for ; Mon, 17 Jun 2024 15:03:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0159DF80154 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=vbLo8h04 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a6ef64b092cso523439766b.1 for ; Mon, 17 Jun 2024 06:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718629422; x=1719234222; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8Jjsxg83yDBynROnukCqxVpZWsAhK7YKWQUi0g3IwVg=; b=vbLo8h04uxc6kyVn3Y0z8nMVGeN0rrfJQjX6oD0ecHxsiUJEb6T8SNWiU53UdmLLIZ xYUy101F1ootM/B59eMuOZTWVmFg/GX3+0B+UAHncTisTNrsMafDEP3LTQMANF3A+rpX huYt+BbjPc9w4s2p7wvz+3rV+xKcEbM3S2dW/oP4uqUiHoLuuF60ZkpRwQ2DNsNzrKKg E1gxd8Il/+e2x1cM/2M5EB4sfu+cW/3lJdmQa13sqgFZYC9xbNdmAn912yLEp/+oTmiJ UKAXTr8U7OtkmSCu2ps1VbaS6K0zZoYrvKHggXp5AXU8/hjrCJvVfTrCFwxYioVjWvCt TcpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718629422; x=1719234222; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8Jjsxg83yDBynROnukCqxVpZWsAhK7YKWQUi0g3IwVg=; b=W5+nb8TP99hBhZi6tpFz9jEpDiujC6be0VSf5CUGKp/+bMriU8wVdBlVrvlFvD4jdC dMk+BihnsNRne4Rk8sSpUQ4TvVnhEO5BDSuek3PLfhgT0irX9cjrC+Kdrxe2B2qcY4PZ ctZhSRD3CrKbB+huqhT8s3VbsogJimYHUUt5zm2dNIE2pnr3KK3cA3nyUNCeicSEXegt 2cl6APvTGL0odtEfTfzdt6L7cqSiMNEifKitaMy79vNLNHBz/X4oGDUG7+cw2Z0lZw+Y zgQzjdo3CgZaL9GDWAaJZJLlVBmaeAwBa8kqv5iAJVfDFUKly4w2BQPM351WF6BZf1Ab Qp1Q== X-Forwarded-Encrypted: i=1; AJvYcCUGs7i9kuh9/9gEj2i5hJBhWQqthpwDl9VUMFzl5Ww/cwxorQbKZ2cZD30tUW/gWCNRQZoDQxz10wX7nhZ+xA4DwejTyMvDZotMsvE= X-Gm-Message-State: AOJu0YxoqFwe5xW/LV4653zE6IzIlHxTG48ROqi2+ARJR8ltUdMg5UJz r0eo6ahYSN0Pewc722mxWrILLscUaKe9I1iKVNI87idbsHsVqEMraG1ntZPdjho= X-Google-Smtp-Source: AGHT+IHxFIGbMKiomDDLiUlqvxSJuE8E8yc0Q5eLstEjkRUInd4amrOMmgw5O7yl2zWNO8kXeIXMcQ== X-Received: by 2002:a17:906:7fda:b0:a6f:173d:36b9 with SMTP id a640c23a62f3a-a6f60cef626mr624278066b.16.1718629422302; Mon, 17 Jun 2024 06:03:42 -0700 (PDT) Received: from [127.0.1.1] ([78.10.207.147]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72daa67sm6404349a12.38.2024.06.17.06.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 06:03:41 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 17 Jun 2024 15:03:24 +0200 Subject: [PATCH 6/6] ALSA: Cleanup trailing white-spaces MIME-Version: 1.0 Message-Id: <20240617-n-asoc-const-auto-selectable-formats-v1-6-8004f346ee38@linaro.org> References: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> In-Reply-To: <20240617-n-asoc-const-auto-selectable-formats-v1-0-8004f346ee38@linaro.org> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Banajit Goswami , Cezary Rojewski , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=27231; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=t1pfuj6KVvbLIvCe/7uLuam0l8+uLeVGQbLwoJtYOoU=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmcDQj7GbDiQ+OBCaHLiN6Im1kLT8emHhLTQPWy etkaEJr/niJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZnA0IwAKCRDBN2bmhouD 15fcD/9bZu2gXq97yhhAQjudvJ+6D4YuUeP7m0IS04krE5/7KOexG+1+dZz5Ozr8PfOFoW+v9w4 pdt2q2skPIKItN7X3h7m/qVachcfjlPWarrmNsd9KtIssL+ZuhjJfisiiXWVeNQ7XQSOyI+YG6n Z5ZqR91WJoBa9P5D4+2a9uhclQVakr3VkIn6Xy8McO1s3tkW6e2wLAfKRQJ1IbMvrnUSw8cANMH nFWsIp5hxKK+dZg0SEt3QiHeMVHTtOuYvDzLeIRilgq0A54oPtdNzSW8ZwKjLkNDRUGKEF9sSGX 1dEChlfi28LV6hhmwj0ovu915701YzjY14+yqGlaacc4fYIIr1Vp9nCrIwFt+WCr/GojKqAjtkH c/terRBaiZGCqPs/mhg6vJuCFNSoSqCsKkcWDK2ql3OVwqCuwVufZKfOHqH9yLy+Ck9vEBHzic9 MwjyvlMxMtTBv34ybu9OQvaH4fYQckh1Ft2uxmKH9gPWfiz+uWzVbnYbX6zJ+xWrn7LXJiQ7Bf1 W0dJZfR7beACcM6RHdAH5lfK0Zm/51mgQFn5OBIiKgqEaChKHqZGsOA3jHNc5fey5dyhsSrcCr1 tvCD2aJ6JoJ1eHFdBNcDa4McbnmvZDrow5AjdOyoFNIv/c7D/RKtXyzKgQlmC/qpoNe6O7EFEKU QCyHVuDG3mr38QA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: 7J4VRVWOU6YQIP5H5YLKVA23ROMUXX5Z X-Message-ID-Hash: 7J4VRVWOU6YQIP5H5YLKVA23ROMUXX5Z X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Remove trailing white-spaces. No functional changes. Signed-off-by: Krzysztof Kozlowski --- sound/core/control_compat.c | 2 +- sound/core/device.c | 4 +-- sound/core/hwdep.c | 10 +++--- sound/core/init.c | 3 +- sound/core/memalloc.c | 2 +- sound/core/memory.c | 2 +- sound/core/pcm.c | 22 ++++++------- sound/core/pcm_compat.c | 2 +- sound/core/pcm_lib.c | 41 ++++++++++++------------ sound/core/pcm_misc.c | 2 +- sound/core/pcm_native.c | 76 ++++++++++++++++++++++----------------------- sound/core/seq_device.c | 2 +- 12 files changed, 83 insertions(+), 85 deletions(-) diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c index 934bb945e702..27bd813d47ff 100644 --- a/sound/core/control_compat.c +++ b/sound/core/control_compat.c @@ -387,7 +387,7 @@ static int snd_ctl_elem_add_compat(struct snd_ctl_file *file, break; } return snd_ctl_elem_add(file, data, replace); -} +} enum { SNDRV_CTL_IOCTL_ELEM_LIST32 = _IOWR('U', 0x10, struct snd_ctl_elem_list32), diff --git a/sound/core/device.c b/sound/core/device.c index b57d80a17052..e28260dde831 100644 --- a/sound/core/device.c +++ b/sound/core/device.c @@ -130,7 +130,7 @@ EXPORT_SYMBOL_GPL(snd_device_disconnect); void snd_device_free(struct snd_card *card, void *device_data) { struct snd_device *dev; - + if (snd_BUG_ON(!card || !device_data)) return; dev = look_for_dev(card, device_data); @@ -190,7 +190,7 @@ int snd_device_register_all(struct snd_card *card) { struct snd_device *dev; int err; - + if (snd_BUG_ON(!card)) return -ENXIO; list_for_each_entry(dev, &card->devices, list) { diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 09200df2932c..7c61d5467bf5 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -53,7 +53,7 @@ static ssize_t snd_hwdep_read(struct file * file, char __user *buf, struct snd_hwdep *hw = file->private_data; if (hw->ops.read) return hw->ops.read(hw, buf, count, offset); - return -ENXIO; + return -ENXIO; } static ssize_t snd_hwdep_write(struct file * file, const char __user *buf, @@ -62,7 +62,7 @@ static ssize_t snd_hwdep_write(struct file * file, const char __user *buf, struct snd_hwdep *hw = file->private_data; if (hw->ops.write) return hw->ops.write(hw, buf, count, offset); - return -ENXIO; + return -ENXIO; } static int snd_hwdep_open(struct inode *inode, struct file * file) @@ -174,7 +174,7 @@ static int snd_hwdep_info(struct snd_hwdep *hw, struct snd_hwdep_info __user *_info) { struct snd_hwdep_info info; - + memset(&info, 0, sizeof(info)); info.card = hw->card->number; strscpy(info.id, hw->id, sizeof(info.id)); @@ -190,7 +190,7 @@ static int snd_hwdep_dsp_status(struct snd_hwdep *hw, { struct snd_hwdep_dsp_status info; int err; - + if (! hw->ops.dsp_status) return -ENXIO; memset(&info, 0, sizeof(info)); @@ -207,7 +207,7 @@ static int snd_hwdep_dsp_load(struct snd_hwdep *hw, struct snd_hwdep_dsp_image *info) { int err; - + if (! hw->ops.dsp_load) return -ENXIO; if (info->index >= 32) diff --git a/sound/core/init.c b/sound/core/init.c index b9b708cf980d..000843e87844 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -708,7 +708,7 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src, int len, loops; bool is_default = false; char *id; - + copy_valid_id_string(card, src, nid); id = card->id; @@ -1019,7 +1019,6 @@ int __init snd_card_info_init(void) * * Return: Zero otherwise a negative error code. */ - int snd_component_add(struct snd_card *card, const char *component) { char *ptr; diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index f901504b5afc..87c0be5c76b4 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -2,7 +2,7 @@ /* * Copyright (c) by Jaroslav Kysela * Takashi Iwai - * + * * Generic memory allocators */ diff --git a/sound/core/memory.c b/sound/core/memory.c index 2d2d0094c897..8705f20529dd 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) by Jaroslav Kysela - * + * * Misc memory accessors */ diff --git a/sound/core/pcm.c b/sound/core/pcm.c index dc37f3508dc7..7c22ab40d4ed 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -137,7 +137,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card, case SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE: { int val; - + if (get_user(val, (int __user *)arg)) return -EFAULT; control->preferred_subdevice[SND_CTL_SUBDEV_PCM] = val; @@ -229,7 +229,7 @@ EXPORT_SYMBOL_GPL(snd_pcm_format_name); #define TSTAMP(v) [SNDRV_PCM_TSTAMP_##v] = #v #define ACCESS(v) [SNDRV_PCM_ACCESS_##v] = #v #define START(v) [SNDRV_PCM_START_##v] = #v -#define SUBFORMAT(v) [SNDRV_PCM_SUBFORMAT_##v] = #v +#define SUBFORMAT(v) [SNDRV_PCM_SUBFORMAT_##v] = #v static const char * const snd_pcm_stream_names[] = { STREAM(PLAYBACK), @@ -249,7 +249,7 @@ static const char * const snd_pcm_state_names[] = { }; static const char * const snd_pcm_access_names[] = { - ACCESS(MMAP_INTERLEAVED), + ACCESS(MMAP_INTERLEAVED), ACCESS(MMAP_NONINTERLEAVED), ACCESS(MMAP_COMPLEX), ACCESS(RW_INTERLEAVED), @@ -257,7 +257,7 @@ static const char * const snd_pcm_access_names[] = { }; static const char * const snd_pcm_subformat_names[] = { - SUBFORMAT(STD), + SUBFORMAT(STD), SUBFORMAT(MSBITS_MAX), SUBFORMAT(MSBITS_20), SUBFORMAT(MSBITS_24), @@ -388,14 +388,14 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry, snd_iprintf(buffer, "access: %s\n", snd_pcm_access_name(runtime->access)); snd_iprintf(buffer, "format: %s\n", snd_pcm_format_name(runtime->format)); snd_iprintf(buffer, "subformat: %s\n", snd_pcm_subformat_name(runtime->subformat)); - snd_iprintf(buffer, "channels: %u\n", runtime->channels); - snd_iprintf(buffer, "rate: %u (%u/%u)\n", runtime->rate, runtime->rate_num, runtime->rate_den); - snd_iprintf(buffer, "period_size: %lu\n", runtime->period_size); - snd_iprintf(buffer, "buffer_size: %lu\n", runtime->buffer_size); + snd_iprintf(buffer, "channels: %u\n", runtime->channels); + snd_iprintf(buffer, "rate: %u (%u/%u)\n", runtime->rate, runtime->rate_num, runtime->rate_den); + snd_iprintf(buffer, "period_size: %lu\n", runtime->period_size); + snd_iprintf(buffer, "buffer_size: %lu\n", runtime->buffer_size); #if IS_ENABLED(CONFIG_SND_PCM_OSS) if (substream->oss.oss) { snd_iprintf(buffer, "OSS format: %s\n", snd_pcm_oss_format_name(runtime->oss.format)); - snd_iprintf(buffer, "OSS channels: %u\n", runtime->oss.channels); + snd_iprintf(buffer, "OSS channels: %u\n", runtime->oss.channels); snd_iprintf(buffer, "OSS rate: %u\n", runtime->oss.rate); snd_iprintf(buffer, "OSS period bytes: %lu\n", (unsigned long)runtime->oss.period_bytes); snd_iprintf(buffer, "OSS periods: %u\n", runtime->oss.periods); @@ -496,7 +496,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) struct snd_info_entry *entry; char name[16]; - sprintf(name, "pcm%i%c", pcm->device, + sprintf(name, "pcm%i%c", pcm->device, pstr->stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c'); entry = snd_info_create_card_entry(pcm->card, name, pcm->card->proc_root); @@ -690,7 +690,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) prev = substream; } return 0; -} +} EXPORT_SYMBOL(snd_pcm_new_stream); static int _snd_pcm_new(struct snd_card *card, const char *id, int device, diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index a42ec7f5a1da..59cb9a49ff21 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c @@ -232,7 +232,7 @@ static int snd_pcm_status_user_compat64(struct snd_pcm_substream *substream, /* both for HW_PARAMS and HW_REFINE */ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream, - int refine, + int refine, struct snd_pcm_hw_params32 __user *data32) { struct snd_pcm_hw_params *data __free(kfree) = NULL; diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 6f73b3c2c205..8c099407c8ce 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -509,7 +509,7 @@ void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, { struct snd_pcm_str *stream = &pcm->streams[direction]; struct snd_pcm_substream *substream; - + for (substream = stream->substream; substream != NULL; substream = substream->next) substream->ops = ops; } @@ -524,7 +524,7 @@ EXPORT_SYMBOL(snd_pcm_set_ops); void snd_pcm_set_sync(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; - + runtime->sync.id32[0] = substream->pcm->card->number; runtime->sync.id32[1] = -1; runtime->sync.id32[2] = -1; @@ -536,7 +536,7 @@ EXPORT_SYMBOL(snd_pcm_set_sync); * Standard ioctl routine */ -static inline unsigned int div32(unsigned int a, unsigned int b, +static inline unsigned int div32(unsigned int a, unsigned int b, unsigned int *r) { if (b == 0) { @@ -800,7 +800,7 @@ void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, /** * snd_interval_ratnum - refine the interval value * @i: interval to refine - * @rats_count: number of ratnum_t + * @rats_count: number of ratnum_t * @rats: ratnum_t array * @nump: pointer to store the resultant numerator * @denp: pointer to store the resultant denominator @@ -855,7 +855,7 @@ int snd_interval_ratnum(struct snd_interval *i, } t.min = div_down(best_num, best_den); t.openmin = !!(best_num % best_den); - + result_num = best_num; result_diff = best_diff; result_den = best_den; @@ -967,7 +967,7 @@ static int snd_interval_ratden(struct snd_interval *i, } t.min = div_down(best_num, best_den); t.openmin = !!(best_num % best_den); - + best_num = best_den = best_diff = 0; for (k = 0; k < rats_count; ++k) { unsigned int num; @@ -1255,7 +1255,7 @@ EXPORT_SYMBOL(snd_pcm_hw_constraint_integer); * @var: hw_params variable to apply the range * @min: the minimal value * @max: the maximal value - * + * * Apply the min/max range constraint to an interval parameter. * * Return: Positive if the value is changed, zero if it's not changed, or a @@ -1279,8 +1279,7 @@ static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params, { struct snd_pcm_hw_constraint_list *list = rule->private; return snd_interval_list(hw_param_interval(params, rule->var), list->count, list->list, list->mask); -} - +} /** * snd_pcm_hw_constraint_list - apply a list of constraints to a parameter @@ -1288,7 +1287,7 @@ static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params, * @cond: condition bits * @var: hw_params variable to apply the list constraint * @l: list - * + * * Apply the list of constraints to an interval parameter. * * Return: Zero if successful, or a negative error code on failure. @@ -1359,7 +1358,7 @@ static int snd_pcm_hw_rule_ratnums(struct snd_pcm_hw_params *params, * * Return: Zero if successful, or a negative error code on failure. */ -int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, +int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, const struct snd_pcm_hw_constraint_ratnums *r) @@ -1393,7 +1392,7 @@ static int snd_pcm_hw_rule_ratdens(struct snd_pcm_hw_params *params, * * Return: Zero if successful, or a negative error code on failure. */ -int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, +int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, const struct snd_pcm_hw_constraint_ratdens *r) @@ -1437,7 +1436,7 @@ static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params, * * Return: Zero if successful, or a negative error code on failure. */ -int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, +int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, unsigned int cond, unsigned int width, unsigned int msbits) @@ -1471,7 +1470,7 @@ int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, unsigned long step) { - return snd_pcm_hw_rule_add(runtime, cond, var, + return snd_pcm_hw_rule_add(runtime, cond, var, snd_pcm_hw_rule_step, (void *) step, var, -1); } @@ -1487,7 +1486,7 @@ static int snd_pcm_hw_rule_pow2(struct snd_pcm_hw_params *params, struct snd_pcm }; return snd_interval_list(hw_param_interval(params, rule->var), ARRAY_SIZE(pow2_sizes), pow2_sizes, 0); -} +} /** * snd_pcm_hw_constraint_pow2 - add a hw constraint power-of-2 rule @@ -1501,7 +1500,7 @@ int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var) { - return snd_pcm_hw_rule_add(runtime, cond, var, + return snd_pcm_hw_rule_add(runtime, cond, var, snd_pcm_hw_rule_pow2, NULL, var, -1); } @@ -1644,8 +1643,8 @@ static int _snd_pcm_hw_param_first(struct snd_pcm_hw_params *params, * * Return: The minimum, or a negative error code on failure. */ -int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm, - struct snd_pcm_hw_params *params, +int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm, + struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, int *dir) { int changed = _snd_pcm_hw_param_first(params, var); @@ -1690,7 +1689,7 @@ static int _snd_pcm_hw_param_last(struct snd_pcm_hw_params *params, * * Return: The maximum, or a negative error code on failure. */ -int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm, +int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, int *dir) { @@ -1975,7 +1974,7 @@ static int wait_for_avail(struct snd_pcm_substream *substream, case SNDRV_PCM_STATE_DRAINING: if (is_playback) err = -EPIPE; - else + else avail = 0; /* indicate draining */ goto _endloop; case SNDRV_PCM_STATE_OPEN: @@ -2000,7 +1999,7 @@ static int wait_for_avail(struct snd_pcm_substream *substream, *availp = avail; return err; } - + typedef int (*pcm_transfer_f)(struct snd_pcm_substream *substream, int channel, unsigned long hwoff, struct iov_iter *iter, unsigned long bytes); diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c index 5588b6a1ee8b..ec0872fb7736 100644 --- a/sound/core/pcm_misc.c +++ b/sound/core/pcm_misc.c @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - + #include #include #include diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 521ba56392a0..13abcd5c37ba 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -1152,7 +1152,7 @@ static int snd_pcm_channel_info(struct snd_pcm_substream *substream, { struct snd_pcm_runtime *runtime; unsigned int channel; - + channel = info->channel; runtime = substream->runtime; scoped_guard(pcm_stream_lock_irq, substream) { @@ -1171,7 +1171,7 @@ static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream, { struct snd_pcm_channel_info info; int res; - + if (copy_from_user(&info, _info, sizeof(info))) return -EFAULT; res = snd_pcm_channel_info(substream, &info); @@ -1280,7 +1280,7 @@ static int snd_pcm_action_single(const struct action_ops *ops, snd_pcm_state_t state) { int res; - + res = ops->pre_action(substream, state); if (res < 0) return res; @@ -1450,7 +1450,7 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, struct snd_pcm_runtime *runtime = substream->runtime; snd_pcm_trigger_tstamp(substream); runtime->hw_ptr_jiffies = jiffies; - runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / + runtime->hw_ptr_buffer_jiffies = (runtime->buffer_size * HZ) / runtime->rate; __snd_pcm_set_state(runtime, state); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && @@ -2191,7 +2191,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime; int result = 0; - + if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; runtime = substream->runtime; @@ -2431,7 +2431,7 @@ static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params, return snd_interval_list(hw_param_interval(params, rule->var), snd_pcm_known_rates.count, snd_pcm_known_rates.list, hw->rates); -} +} static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) @@ -2444,7 +2444,7 @@ static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, t.openmax = 0; t.integer = 1; return snd_interval_refine(hw_param_interval(params, rule->var), &t); -} +} static int snd_pcm_hw_rule_subformats(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) @@ -2506,98 +2506,98 @@ static int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream) SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, snd_pcm_hw_rule_sample_bits, NULL, - SNDRV_PCM_HW_PARAM_FORMAT, + SNDRV_PCM_HW_PARAM_FORMAT, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, snd_pcm_hw_rule_mul, NULL, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_TIME, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_BUFFER_TIME, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, snd_pcm_hw_rule_muldivk, (void*) 1000000, SNDRV_PCM_HW_PARAM_PERIOD_TIME, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, snd_pcm_hw_rule_mul, NULL, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, snd_pcm_hw_rule_muldivk, (void*) 1000000, SNDRV_PCM_HW_PARAM_BUFFER_TIME, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, snd_pcm_hw_rule_muldivk, (void*) 8, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, snd_pcm_hw_rule_muldivk, (void*) 8, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) @@ -2661,7 +2661,7 @@ static int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, snd_pcm_hw_rule_buffer_bytes_max, substream, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1); if (err < 0) @@ -2675,7 +2675,7 @@ static int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) } if (!(hw->rates & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))) { - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_pcm_hw_rule_rate, hw, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) @@ -3022,7 +3022,7 @@ static int snd_pcm_delay(struct snd_pcm_substream *substream, return err; } - + static inline int snd_pcm_hwsync(struct snd_pcm_substream *substream) { return snd_pcm_delay(substream, NULL); @@ -3041,7 +3041,7 @@ static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) return -EFAULT; if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct snd_pcm_mmap_control))) - return -EFAULT; + return -EFAULT; status = runtime->status; control = runtime->control; if (sync_ptr.flags & SNDRV_PCM_SYNC_PTR_HWSYNC) { @@ -3185,7 +3185,7 @@ static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg) { struct snd_pcm_runtime *runtime = substream->runtime; int arg; - + if (get_user(arg, _arg)) return -EFAULT; if (arg < 0 || arg > SNDRV_PCM_TSTAMP_TYPE_LAST) @@ -3417,7 +3417,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, { snd_pcm_uframes_t *frames = arg; snd_pcm_sframes_t result; - + if (substream->runtime->state == SNDRV_PCM_STATE_DISCONNECTED) return -EBADFD; @@ -3641,7 +3641,7 @@ static vm_fault_t snd_pcm_mmap_status_fault(struct vm_fault *vmf) { struct snd_pcm_substream *substream = vmf->vma->vm_private_data; struct snd_pcm_runtime *runtime; - + if (substream == NULL) return VM_FAULT_SIGBUS; runtime = substream->runtime; @@ -3679,7 +3679,7 @@ static vm_fault_t snd_pcm_mmap_control_fault(struct vm_fault *vmf) { struct snd_pcm_substream *substream = vmf->vma->vm_private_data; struct snd_pcm_runtime *runtime; - + if (substream == NULL) return VM_FAULT_SIGBUS; runtime = substream->runtime; @@ -3771,7 +3771,7 @@ static vm_fault_t snd_pcm_mmap_data_fault(struct vm_fault *vmf) unsigned long offset; struct page * page; size_t dma_bytes; - + if (substream == NULL) return VM_FAULT_SIGBUS; runtime = substream->runtime; @@ -3906,9 +3906,9 @@ EXPORT_SYMBOL(snd_pcm_mmap_data); static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area) { struct snd_pcm_file * pcm_file; - struct snd_pcm_substream *substream; + struct snd_pcm_substream *substream; unsigned long offset; - + pcm_file = file->private_data; substream = pcm_file->substream; if (PCM_RUNTIME_CHECK(substream)) diff --git a/sound/core/seq_device.c b/sound/core/seq_device.c index 654d620d0199..25e72b275410 100644 --- a/sound/core/seq_device.c +++ b/sound/core/seq_device.c @@ -234,7 +234,7 @@ int snd_seq_device_new(struct snd_card *card, int device, const char *id, put_device(&dev->dev); return err; } - + if (result) *result = dev;