From patchwork Mon Aug 1 17:01:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 594723 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 73C8CC19F2A for ; Mon, 1 Aug 2022 17:03:56 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B962B868; Mon, 1 Aug 2022 19:03:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B962B868 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659373434; bh=XN/lm9YZWkaCNSA/mf1JejcISdkUWTuxUSUE2AFdHDo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EY1YP9S7vClmRI7oW+ticsX47OCx4/fFSfF3QHU+kGtKpDCrGVAADCdVjUeBr3VUI Pm3TGLOpG9IdJd+ymxbjhNU093CjU8JTnCw0VJzxXXYtcp92Wq4PsEDehQ8UQyUONV ITkpS1AVtl8y6QIMzSKK2NYsdd5lh20gfMc8jjuA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 008F5F80567; Mon, 1 Aug 2022 19:01:30 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0362EF8014B; Mon, 1 Aug 2022 19:01:25 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BD089F8014B for ; Mon, 1 Aug 2022 19:01:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BD089F8014B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="1+D4iby2"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="nEuX7x41" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9B50420539; Mon, 1 Aug 2022 17:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659373271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W0jiXwCV7NxumJXtba9YynsD3POSNwpn5An/jRQzfdA=; b=1+D4iby2l6H5wnREutuAI2FvLAQ5dTV9EIYaS+I58OiylGrv3MTdEZBKBcxzscLxBkKSOu HUQPF3YXANeYafMEttDxUhb6cI0xyj2qe5MeAEGGE+WI8vnV4EuqCvTvremQcbODbguImo RZK2IEJcSYhnAvCLmnIN8H+SCEm69xk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659373271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W0jiXwCV7NxumJXtba9YynsD3POSNwpn5An/jRQzfdA=; b=nEuX7x41ACtywk2/QXK604BXKJxJ1YbDgA5mGe9swzPFkh9qW3acjR27riIrTxdeMBqam5 PofY9itnNXS3RBDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6D6BE13ADF; Mon, 1 Aug 2022 17:01:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EH/8GdcG6GKJHAAAMHmgww (envelope-from ); Mon, 01 Aug 2022 17:01:11 +0000 From: Takashi Iwai To: Mark Brown Subject: [PATCH 1/8] ASoC: cs43130: Replace scnprintf() with sysfs_emit() Date: Mon, 1 Aug 2022 19:01:01 +0200 Message-Id: <20220801170108.26340-2-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220801170108.26340-1-tiwai@suse.de> References: <20220801170108.26340-1-tiwai@suse.de> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Lucas Tanure , Cezary Rojewski , Ranjani Sridharan , Pierre-Louis Bossart , Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" sysfs_emit() is a new helper to simplify the sysfs string output. Replace the open-code straightforwardly with this new helper. Signed-off-by: Takashi Iwai --- sound/soc/codecs/cs43130.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c index ca4d47cc9c91..06c6ad3ca2b7 100644 --- a/sound/soc/codecs/cs43130.c +++ b/sound/soc/codecs/cs43130.c @@ -1666,10 +1666,9 @@ static int cs43130_show_dc(struct device *dev, char *buf, u8 ch) struct cs43130_private *cs43130 = i2c_get_clientdata(client); if (!cs43130->hpload_done) - return scnprintf(buf, PAGE_SIZE, "NO_HPLOAD\n"); + return sysfs_emit(buf, "NO_HPLOAD\n"); else - return scnprintf(buf, PAGE_SIZE, "%u\n", - cs43130->hpload_dc[ch]); + return sysfs_emit(buf, "%u\n", cs43130->hpload_dc[ch]); } static ssize_t hpload_dc_l_show(struct device *dev, @@ -1705,8 +1704,8 @@ static int cs43130_show_ac(struct device *dev, char *buf, u8 ch) if (cs43130->hpload_done && cs43130->ac_meas) { for (i = 0; i < ARRAY_SIZE(cs43130_ac_freq); i++) { - tmp = scnprintf(buf + j, PAGE_SIZE - j, "%u\n", - cs43130->hpload_ac[i][ch]); + tmp = sysfs_emit_at(buf, j, "%u\n", + cs43130->hpload_ac[i][ch]); if (!tmp) break; @@ -1715,7 +1714,7 @@ static int cs43130_show_ac(struct device *dev, char *buf, u8 ch) return j; } else { - return scnprintf(buf, PAGE_SIZE, "NO_HPLOAD\n"); + return sysfs_emit(buf, "NO_HPLOAD\n"); } } From patchwork Mon Aug 1 17:01:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 594724 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 D1668C00144 for ; Mon, 1 Aug 2022 17:03:27 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2A59983D; Mon, 1 Aug 2022 19:02:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2A59983D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659373406; bh=mSCEgwgwqUm+T5Kzsb4eL82dDVYjvhHiuR9WQKdFVl4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=PRdDmklOPfhgnsy2IMTCt986OSX6Ebf3RcllrebG6tqgyFfPodexXy9smwBOKVq7U BPblKhOkLLMGOLHOQAop6Q/9eQoNum5TOxzwK0BfQV63lLDpQoQhxy+yGgqTq9Emkr a2nzLvMMcxJ+g36oPC1XUvY4etBNorsYASn9E6mY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CEC0EF80558; Mon, 1 Aug 2022 19:01:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E7649F80246; Mon, 1 Aug 2022 19:01:25 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 80CD6F80539 for ; Mon, 1 Aug 2022 19:01:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 80CD6F80539 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="v03Wvzn/"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="LkR0gpHg" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id CEA13342B1; Mon, 1 Aug 2022 17:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659373271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fs+hVbf6ds8PX7hHZ+c2gnIARgFFrL2+rz25aWMfyys=; b=v03Wvzn/3dRep2TxtcFen2ZJJ7Of3xk8MufGJkT5KT0wr6tjYIpfNs1RtrYWyaxBmnpCHA 7xsDf8dB9w44RWk0Jnnska1aPoAuAIvhGqukYrdNpcMDQLd98mNwSNCqNSGzJJNDNKINFo qSo8jwy9cpXp/M9nZGPEO4egjnPTT4o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659373271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fs+hVbf6ds8PX7hHZ+c2gnIARgFFrL2+rz25aWMfyys=; b=LkR0gpHggdRsqsMLs38TeK3iwWATw9E14Xl1QUZYGETxyAypYAPqToHPlKwuLlynKiWjqn m5/i2aJoB8AoqyDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9DE2113AAE; Mon, 1 Aug 2022 17:01:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kJLQJdcG6GKJHAAAMHmgww (envelope-from ); Mon, 01 Aug 2022 17:01:11 +0000 From: Takashi Iwai To: Mark Brown Subject: [PATCH 2/8] ASoC: tlv320aic26: Replace sprintf() with sysfs_emit() Date: Mon, 1 Aug 2022 19:01:02 +0200 Message-Id: <20220801170108.26340-3-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220801170108.26340-1-tiwai@suse.de> References: <20220801170108.26340-1-tiwai@suse.de> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Lucas Tanure , Cezary Rojewski , Ranjani Sridharan , Pierre-Louis Bossart , Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" For sysfs outputs, it's safer to use a new helper, sysfs_emit(), instead of the raw sprintf() & co. This patch replaces the sprintf() usage straightforwardly with a new helper, sysfs_emit(). Signed-off-by: Takashi Iwai --- sound/soc/codecs/tlv320aic26.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c index 8bae4b475068..e5dfb3d752a3 100644 --- a/sound/soc/codecs/tlv320aic26.c +++ b/sound/soc/codecs/tlv320aic26.c @@ -271,7 +271,7 @@ static ssize_t keyclick_show(struct device *dev, freq = (125 << ((val >> 8) & 0x7)) >> 1; len = 2 * (1 + ((val >> 4) & 0xf)); - return sprintf(buf, "amp=%x freq=%iHz len=%iclks\n", amp, freq, len); + return sysfs_emit(buf, "amp=%x freq=%iHz len=%iclks\n", amp, freq, len); } /* Any write to the keyclick attribute will trigger the keyclick event */ From patchwork Mon Aug 1 17:01:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 594872 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 52CB9C00144 for ; Mon, 1 Aug 2022 17:02:40 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 834CC161F; Mon, 1 Aug 2022 19:01:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 834CC161F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659373358; bh=55V1BvmMetu/7vDDZXOuK1uxhRk4c6TcJvPK9doQihI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=T3Wi+aFZS3J3LXg4ZyBlgMEwoZuEijQ3ekBG+zsp97K/t/M6Wc4ASq0s1gwCYKncc 4C75VEnNbcaHNmu/TnFRRfTRF5+Ao6dmObaOvWYwgfsu6d1mAq3RNQvYe7QQOSMjvh L/A/98WVV5Ce/odMc+27JbQX/1WZ86k41hGdoJiU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2DD10F80548; Mon, 1 Aug 2022 19:01:21 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9F2BFF80152; Mon, 1 Aug 2022 19:01:18 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 36198F8013D for ; Mon, 1 Aug 2022 19:01:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 36198F8013D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="gDKc14HS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="81XI/GS4" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0E5282067B; Mon, 1 Aug 2022 17:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659373272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=536i7ilnn05TJs+Ne4ryRe3yjGFHU0oVRyL0R3gDG00=; b=gDKc14HSOU67YzHjOjFM5SVwEshLzhWK8iM/fUB2waUzv0WX+HR+ssfh4CEvdcp19aAnxZ CDloJicyGzebWoFP8Krqa9Pi551EKy+95AziSmFVoBLyH2yAMwcSI7WaqW4WMTSBexJCjz g6EY4PobktdmGj4HJ1f3YLOcN50ia2I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659373272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=536i7ilnn05TJs+Ne4ryRe3yjGFHU0oVRyL0R3gDG00=; b=81XI/GS4HLuhdJf2Hqc/SIHeAUTf9Er6cWrLkn7ib0Ja0s1qf4G2SFQL7a1Hto3SpMdk30 yma6MbC68IWNNFAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D3F6B13AAE; Mon, 1 Aug 2022 17:01:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uHONMtcG6GKJHAAAMHmgww (envelope-from ); Mon, 01 Aug 2022 17:01:11 +0000 From: Takashi Iwai To: Mark Brown Subject: [PATCH 3/8] ASoC: Intel: sst: Replace sprintf() with sysfs_emit() Date: Mon, 1 Aug 2022 19:01:03 +0200 Message-Id: <20220801170108.26340-4-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220801170108.26340-1-tiwai@suse.de> References: <20220801170108.26340-1-tiwai@suse.de> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Lucas Tanure , Cezary Rojewski , Ranjani Sridharan , Pierre-Louis Bossart , Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" For sysfs outputs, it's safer to use a new helper, sysfs_emit(), instead of the raw sprintf() & co. This patch replaces those usages straightforwardly with a new helper, sysfs_emit(). Signed-off-by: Takashi Iwai --- sound/soc/intel/atom/sst/sst.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c index 160b50f479fb..a0d29510d2bc 100644 --- a/sound/soc/intel/atom/sst/sst.c +++ b/sound/soc/intel/atom/sst/sst.c @@ -242,11 +242,11 @@ static ssize_t firmware_version_show(struct device *dev, if (ctx->fw_version.type == 0 && ctx->fw_version.major == 0 && ctx->fw_version.minor == 0 && ctx->fw_version.build == 0) - return sprintf(buf, "FW not yet loaded\n"); + return sysfs_emit(buf, "FW not yet loaded\n"); else - return sprintf(buf, "v%02x.%02x.%02x.%02x\n", - ctx->fw_version.type, ctx->fw_version.major, - ctx->fw_version.minor, ctx->fw_version.build); + return sysfs_emit(buf, "v%02x.%02x.%02x.%02x\n", + ctx->fw_version.type, ctx->fw_version.major, + ctx->fw_version.minor, ctx->fw_version.build); } From patchwork Mon Aug 1 17:01:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 594726 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 859D0C19F2B for ; Mon, 1 Aug 2022 17:02:12 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C1A9A84B; Mon, 1 Aug 2022 19:01:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C1A9A84B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659373330; bh=ypySvKtCf+TxYVIV9PpSNw0p33pizvbXVZLYedbBN3g=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=HByO/2gK8WnFkfAEvQMd9Syn5sO7Y61zfet9ofwbJPb3M/N+ElsM24/K+b8jSIrTC uPT/XjpuDnFfTSGUCHCKg41PO5tpdGe9gSksA6KulI0C0aggwszQikZkHVlZvRAw0V 1Er35OIiCPa6I8cXopczOw410nYb31qVElUD5lD8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 244A1F80543; Mon, 1 Aug 2022 19:01:20 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9227FF80548; Mon, 1 Aug 2022 19:01:18 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 67CC3F80152 for ; Mon, 1 Aug 2022 19:01:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 67CC3F80152 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="A951s+rK"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="KS1JFctl" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 411B8339A8; Mon, 1 Aug 2022 17:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659373272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6pQRaGdAiXFFrvhmr0AhRRCAvJVzQ+qLTKFysaN889g=; b=A951s+rKD/A/rV7pVlHbCx3eGmQlDnu9GT/jWWVhAyAmk08zfTBalN9NMmkOkeVzJn7eTe p9F99SN0XhJjvfR/oC2B3kDuamKTwFwvbXRnjM0J/PFti8Kk3uDp+yzrr5DcZK6NkEnVH6 uzp8E/ZFh3csMu41f8GTisBuQdLDfEU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659373272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6pQRaGdAiXFFrvhmr0AhRRCAvJVzQ+qLTKFysaN889g=; b=KS1JFctlQ61PbazA+7g7GimtQtpSMToR3Ay793M6SNd2a2dgXKJLD6eReZUZWcYyfrnUFd FWEvC0URJOfe/cAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 10D7413ADF; Mon, 1 Aug 2022 17:01:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OGNSA9gG6GKJHAAAMHmgww (envelope-from ); Mon, 01 Aug 2022 17:01:12 +0000 From: Takashi Iwai To: Mark Brown Subject: [PATCH 4/8] ASoC: Intel: catpt: Replace sprintf() with sysfs_emit() Date: Mon, 1 Aug 2022 19:01:04 +0200 Message-Id: <20220801170108.26340-5-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220801170108.26340-1-tiwai@suse.de> References: <20220801170108.26340-1-tiwai@suse.de> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Lucas Tanure , Cezary Rojewski , Ranjani Sridharan , Pierre-Louis Bossart , Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" For sysfs outputs, it's safer to use a new helper, sysfs_emit(), instead of the raw sprintf() & co. This patch replaces those usages straightforwardly with a new helper, sysfs_emit(). Signed-off-by: Takashi Iwai Acked-by: Cezary Rojewski --- sound/soc/intel/catpt/sysfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/intel/catpt/sysfs.c b/sound/soc/intel/catpt/sysfs.c index 1bdbcc04dc71..9b6d2d93a2e7 100644 --- a/sound/soc/intel/catpt/sysfs.c +++ b/sound/soc/intel/catpt/sysfs.c @@ -27,8 +27,8 @@ static ssize_t fw_version_show(struct device *dev, if (ret) return CATPT_IPC_ERROR(ret); - return sprintf(buf, "%d.%d.%d.%d\n", version.type, version.major, - version.minor, version.build); + return sysfs_emit(buf, "%d.%d.%d.%d\n", version.type, version.major, + version.minor, version.build); } static DEVICE_ATTR_RO(fw_version); @@ -37,7 +37,7 @@ static ssize_t fw_info_show(struct device *dev, { struct catpt_dev *cdev = dev_get_drvdata(dev); - return sprintf(buf, "%s\n", cdev->ipc.config.fw_info); + return sysfs_emit(buf, "%s\n", cdev->ipc.config.fw_info); } static DEVICE_ATTR_RO(fw_info); From patchwork Mon Aug 1 17:01:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 594870 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 13555C00144 for ; Mon, 1 Aug 2022 17:03:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 50CAD163C; Mon, 1 Aug 2022 19:02:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 50CAD163C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659373419; bh=62kRVi47VP39fc4UM0vDJdSlVJ6prrw2pwQ+5HKlYFc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ojMTPj+t13gTZbaGznUDz9gpfJmey1sqR3euXji4pf+UVEiJ+eDyW2NHBaGA9T0Wg 8GwDOidHNBp23VMI2c1cPpvNfqTYPa2W/BEb9vQdM55KdIXiwV9dHXFDocIaS12yvp rrQ1fv0zud7Wt1OuANMnwPVviDpbKtYqG5oZOT9A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 71E39F8055C; Mon, 1 Aug 2022 19:01:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1E8AAF804FF; Mon, 1 Aug 2022 19:01:25 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 15F31F802DB for ; Mon, 1 Aug 2022 19:01:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 15F31F802DB Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="urGT69B6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="ZfU366yC" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7C285344D3; Mon, 1 Aug 2022 17:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659373272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ea4zw7Zh6YgY3V1kPtjXOZ+zT5Gg/ukKFYk9CWFVyNs=; b=urGT69B6qz4Ov3jgHQzbgOpg15gyOyvsI4QHFOVqq7KM6+Vkfy5GvwuPJ0lyrV7+YQDaHW nkc4lFexJgf1azAsp27DZn5LJ3se0UspRoBztN+0opfNXyZoOirCi3Q+hLlehPNpXewBv+ IRNEctr+QTcSCAMUGAn3bsWkdxyeCww= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659373272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ea4zw7Zh6YgY3V1kPtjXOZ+zT5Gg/ukKFYk9CWFVyNs=; b=ZfU366yC1Qdhcx/Qh5LpPZPz/97dlmA8yUT3zu6HpzIzoEt/Coqc8ErFHzkJMqkxp5QP4/ ARFXYLxvp0CMxECA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4266613AAE; Mon, 1 Aug 2022 17:01:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yNdGD9gG6GKJHAAAMHmgww (envelope-from ); Mon, 01 Aug 2022 17:01:12 +0000 From: Takashi Iwai To: Mark Brown Subject: [PATCH 5/8] ASoC: Intel: skylake: Replace sprintf() with sysfs_emit() Date: Mon, 1 Aug 2022 19:01:05 +0200 Message-Id: <20220801170108.26340-6-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220801170108.26340-1-tiwai@suse.de> References: <20220801170108.26340-1-tiwai@suse.de> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Lucas Tanure , Cezary Rojewski , Ranjani Sridharan , Pierre-Louis Bossart , Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" For sysfs outputs, it's safer to use a new helper, sysfs_emit(), instead of the raw sprintf() & co. This patch replaces those usages straightforwardly with a new helper, sysfs_emit(). Signed-off-by: Takashi Iwai Acked-by: Cezary Rojewski --- sound/soc/intel/skylake/skl-nhlt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c index deb7b820325e..e617b4c335a4 100644 --- a/sound/soc/intel/skylake/skl-nhlt.c +++ b/sound/soc/intel/skylake/skl-nhlt.c @@ -61,7 +61,7 @@ static ssize_t platform_id_show(struct device *dev, nhlt->header.oem_revision); skl_nhlt_trim_space(platform_id); - return sprintf(buf, "%s\n", platform_id); + return sysfs_emit(buf, "%s\n", platform_id); } static DEVICE_ATTR_RO(platform_id); From patchwork Mon Aug 1 17:01:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 594722 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 97F7AC00144 for ; Mon, 1 Aug 2022 17:04:29 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C1C05164E; Mon, 1 Aug 2022 19:03:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C1C05164E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659373467; bh=8dhR7VJYR4XTYpOSUZKCQmcXstgpWkPl+twIh26P7jM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=GfMUKRRde0uJ4d5+qq+vFKg82x44dB2OJpiPy9x9iWFRHwQZTrn58r4vshWYxtnT2 lnETEpKOZpzUy7QoIl34bxheIkcRhHAAfeWfFSepidzTDyaoNdHkS7QuOteYt4I9rM xj7ZD6Tray+Fj1Ypks/WTpbJdH5ilxM478Q5h9f4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 67A4AF80588; Mon, 1 Aug 2022 19:01:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 65F66F80589; Mon, 1 Aug 2022 19:01:31 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BDB94F8013D for ; Mon, 1 Aug 2022 19:01:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BDB94F8013D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="E1ZDdyC/"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="VVJAl8Gs" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AABDF20684; Mon, 1 Aug 2022 17:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659373272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=flm3EAid1FyYWaoC5b48xbvqyVtFEOLFTTsVO4ZK0tM=; b=E1ZDdyC/SxzGUbL3x7PVM4IJv1BVUw0w+QECRf1lAWM284/pdZSvADY0B22JwnS2Xe50pK xuIvv73I4jPZfGu3idzNSY3TnK3MedOzp/rRX+6M+W4YwaX15QKszeqMUnow2KdXx4HfAI KMU34qKFZKm4HFnWfMwY3jILIiX4F0M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659373272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=flm3EAid1FyYWaoC5b48xbvqyVtFEOLFTTsVO4ZK0tM=; b=VVJAl8Gs07h7CS9SDCcHRP1LaCP5/gqDkDyDSMbjCzI6MS1mVE5aqibYMk7C0yyoc+Nf+9 jsjmZk9eX4z/pvAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 73B3813ADF; Mon, 1 Aug 2022 17:01:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oEKOG9gG6GKJHAAAMHmgww (envelope-from ); Mon, 01 Aug 2022 17:01:12 +0000 From: Takashi Iwai To: Mark Brown Subject: [PATCH 6/8] ASoC: core: Replace sprintf() with sysfs_emit() Date: Mon, 1 Aug 2022 19:01:06 +0200 Message-Id: <20220801170108.26340-7-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220801170108.26340-1-tiwai@suse.de> References: <20220801170108.26340-1-tiwai@suse.de> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Lucas Tanure , Cezary Rojewski , Ranjani Sridharan , Pierre-Louis Bossart , Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" For sysfs outputs, it's safer to use a new helper, sysfs_emit(), instead of the raw sprintf() & co. This patch replaces the sprintf() usage straightforwardly with a new helper, sysfs_emit(). Signed-off-by: Takashi Iwai --- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e824ff1a9fc0..e020ab49cfb1 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -72,7 +72,7 @@ static ssize_t pmdown_time_show(struct device *dev, { struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); - return sprintf(buf, "%ld\n", rtd->pmdown_time); + return sysfs_emit(buf, "%ld\n", rtd->pmdown_time); } static ssize_t pmdown_time_store(struct device *dev, From patchwork Mon Aug 1 17:01:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 594871 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 8117DC00144 for ; Mon, 1 Aug 2022 17:03:10 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C9A671631; Mon, 1 Aug 2022 19:02:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C9A671631 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659373388; bh=GF2QP21J/sZcZbf15TuHgWOWDdLdI1V1SMJjdycHwx8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DnDkqG+PGztqGA+zb2bVsI98QfdAjLcTn2hQN/GrIZPtU+V6Sj0daruelcfFLoM0/ gSCHEZ8KRCxAgy8h93vu0hNWHo9Wohq/C5BtAkuar/MIlxi/VAi48e5o2lmGwbisvH CrP4nw0ywp8zXdlbOrUNs0eHKg9NF0ksvrv2LVQM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 46B39F804FF; Mon, 1 Aug 2022 19:01:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D5FCEF8023B; Mon, 1 Aug 2022 19:01:25 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 118EEF8023B for ; Mon, 1 Aug 2022 19:01:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 118EEF8023B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="uqYATj1l"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="fV4D150M" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DD0F820698; Mon, 1 Aug 2022 17:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659373272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RByTkaSkFxB6Oc+eZ7noHkFk+wzRN4aritCQ7cW14V0=; b=uqYATj1l56300CMTqM1iZVGIT4m9VZKzY+L6Ik5SCjW76IVc4incQUKV+iLMQDiWXkdZhQ EjPHKRcTpsYQ3ZlHDKnKWnPQww7gv5p1IvIzVHVdATfiAHIZz0pX9cTnofX0fAQtNjPqWR +mx1163wAVrgDH2UIRfC4Ox5NuSM0Ew= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659373272; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RByTkaSkFxB6Oc+eZ7noHkFk+wzRN4aritCQ7cW14V0=; b=fV4D150MLUUAaGYVs30eFK6SwhfK00T4SGioGOf3NsNcCti5XyieehINjGEwmUzmFGnxy6 Tq+b3mabF7tWw6DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id ADCC013AAE; Mon, 1 Aug 2022 17:01:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +JOuKdgG6GKJHAAAMHmgww (envelope-from ); Mon, 01 Aug 2022 17:01:12 +0000 From: Takashi Iwai To: Mark Brown Subject: [PATCH 7/8] ASoC: DAPM: Replace sprintf() calls with sysfs_emit_at() Date: Mon, 1 Aug 2022 19:01:07 +0200 Message-Id: <20220801170108.26340-8-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220801170108.26340-1-tiwai@suse.de> References: <20220801170108.26340-1-tiwai@suse.de> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Lucas Tanure , Cezary Rojewski , Ranjani Sridharan , Pierre-Louis Bossart , Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" For sysfs outputs, it's safer to use a new helper, sysfs_emit(), instead of the raw sprintf() & co. This patch replaces the open-code with a new helper, sysfs_emit_at(), by passing the string offset. Signed-off-by: Takashi Iwai --- sound/soc/soc-dapm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index b05231414c1d..73b8bd452ca7 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2386,11 +2386,10 @@ int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm, EXPORT_SYMBOL_GPL(snd_soc_dapm_mixer_update_power); static ssize_t dapm_widget_show_component(struct snd_soc_component *cmpnt, - char *buf) + char *buf, int count) { struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(cmpnt); struct snd_soc_dapm_widget *w; - int count = 0; char *state = "not set"; /* card won't be set for the dummy component, as a spot fix @@ -2423,7 +2422,7 @@ static ssize_t dapm_widget_show_component(struct snd_soc_component *cmpnt, case snd_soc_dapm_pinctrl: case snd_soc_dapm_clock_supply: if (w->name) - count += sprintf(buf + count, "%s: %s\n", + count += sysfs_emit_at(buf, count, "%s: %s\n", w->name, w->power ? "On":"Off"); break; default: @@ -2445,7 +2444,7 @@ static ssize_t dapm_widget_show_component(struct snd_soc_component *cmpnt, state = "Off"; break; } - count += sprintf(buf + count, "PM State: %s\n", state); + count += sysfs_emit_at(buf, count, "PM State: %s\n", state); return count; } @@ -2463,7 +2462,7 @@ static ssize_t dapm_widget_show(struct device *dev, for_each_rtd_codec_dais(rtd, i, codec_dai) { struct snd_soc_component *cmpnt = codec_dai->component; - count += dapm_widget_show_component(cmpnt, buf + count); + count = dapm_widget_show_component(cmpnt, buf, count); } mutex_unlock(&rtd->card->dapm_mutex); From patchwork Mon Aug 1 17:01:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 594869 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 12153C00144 for ; Mon, 1 Aug 2022 17:04:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 529FD1630; Mon, 1 Aug 2022 19:03:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 529FD1630 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659373459; bh=EsuAK2Py9IEdekhK8r4IurU8YmKVytrd94RzVmRqM+A=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=MeSv5TApoILQVcAKUCVEOsn5ytsOzXrRLkhuTGIDUMzlbB+b0we5EKvintMi8aBSN fjR73h5uGQ4M+gAeUN1GWARWvNugV3ozWarW+Cjc/6LmWOafXUHkApyWj/5R++G2JX t+vrqU9XpoiOL26hRyjspzKE9wljm/V2eM+CbK5k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E0EFDF8057C; Mon, 1 Aug 2022 19:01:30 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 99C4AF804FF; Mon, 1 Aug 2022 19:01:27 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 59627F804FA for ; Mon, 1 Aug 2022 19:01:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 59627F804FA Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ByE01QfT"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="6+W6s/y8" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1D918206D7; Mon, 1 Aug 2022 17:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659373273; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DHdO/a3WKOwt9nY5QGWELProlniXPv17HHwPIiMxhpM=; b=ByE01QfT06SLGCa81rS6Fdvc9j5LzS4tkhSz/t0MF8yn9q/p+47Rn4dZvMLLgXSd6pmxQu LPJLfNoGaFLJzRh99fGXD3GcaVA64vx9AD/ihRcgOlqTN2z3NTH7ET5DjsOYiLl26udwZ2 f9udZ/dUtwJ3HAzFojiCjQD1syy2SRo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659373273; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DHdO/a3WKOwt9nY5QGWELProlniXPv17HHwPIiMxhpM=; b=6+W6s/y8dLPjmT2ximuLw1Dzm9RgigdILN0IHC7/GIM4+8rD8D/gUXXvipcFm/faCHjxoJ i29tOpqu6E1WI2DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E09E913ADF; Mon, 1 Aug 2022 17:01:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id METTNdgG6GKJHAAAMHmgww (envelope-from ); Mon, 01 Aug 2022 17:01:12 +0000 From: Takashi Iwai To: Mark Brown Subject: [PATCH 8/8] ASoC: omap: Replace sprintf() with sysfs_emit() Date: Mon, 1 Aug 2022 19:01:08 +0200 Message-Id: <20220801170108.26340-9-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220801170108.26340-1-tiwai@suse.de> References: <20220801170108.26340-1-tiwai@suse.de> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Lucas Tanure , Cezary Rojewski , Ranjani Sridharan , Pierre-Louis Bossart , Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" For sysfs outputs, it's safer to use a new helper, sysfs_emit(), instead of the raw sprintf() & co. This patch replaces the open code with new helpers, sysfs_emit() and sysfs_emit_at(), with the proper string offset. Signed-off-by: Takashi Iwai Acked-by: Peter Ujfalusi --- sound/soc/ti/omap-mcbsp-st.c | 6 +++--- sound/soc/ti/omap-mcbsp.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sound/soc/ti/omap-mcbsp-st.c b/sound/soc/ti/omap-mcbsp-st.c index 7e8179cae92e..8163f453bf36 100644 --- a/sound/soc/ti/omap-mcbsp-st.c +++ b/sound/soc/ti/omap-mcbsp-st.c @@ -244,10 +244,10 @@ static ssize_t st_taps_show(struct device *dev, spin_lock_irq(&mcbsp->lock); for (i = 0; i < st_data->nr_taps; i++) - status += sprintf(&buf[status], (i ? ", %d" : "%d"), - st_data->taps[i]); + status += sysfs_emit_at(buf, status, (i ? ", %d" : "%d"), + st_data->taps[i]); if (i) - status += sprintf(&buf[status], "\n"); + status += sysfs_emit_at(buf, status, "\n"); spin_unlock_irq(&mcbsp->lock); return status; diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c index c4ac1f30b9fe..0b377bb7737f 100644 --- a/sound/soc/ti/omap-mcbsp.c +++ b/sound/soc/ti/omap-mcbsp.c @@ -517,7 +517,7 @@ static ssize_t prop##_show(struct device *dev, \ { \ struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); \ \ - return sprintf(buf, "%u\n", mcbsp->prop); \ + return sysfs_emit(buf, "%u\n", mcbsp->prop); \ } \ \ static ssize_t prop##_store(struct device *dev, \ @@ -560,11 +560,11 @@ static ssize_t dma_op_mode_show(struct device *dev, for (s = &dma_op_modes[i]; i < ARRAY_SIZE(dma_op_modes); s++, i++) { if (dma_op_mode == i) - len += sprintf(buf + len, "[%s] ", *s); + len += sysfs_emit_at(buf, len, "[%s] ", *s); else - len += sprintf(buf + len, "%s ", *s); + len += sysfs_emit_at(buf, len, "%s ", *s); } - len += sprintf(buf + len, "\n"); + len += sysfs_emit_at(buf, len, "\n"); return len; }