From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E43C4C2BB41 for ; Tue, 16 Aug 2022 10:41:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234985AbiHPKlU (ORCPT ); Tue, 16 Aug 2022 06:41:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235130AbiHPKkq (ORCPT ); Tue, 16 Aug 2022 06:40:46 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 315B272EE9 for ; Tue, 16 Aug 2022 02:57:33 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A3AC91F915; Tue, 16 Aug 2022 09:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1660643852; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=M1SOZrFtZgyUILmqZcdztPD9F6caqP4ow9VeTx29XMo=; b=fBIXOCfp0Klku8r2hQ6QCSV3AziC+vB+ACo/S304D481jHm+hvvIF12KB3m8dr8La81E+a yhbUb/LnlP1HlcEHoSFNiycwa+vnxjKupioTSnd9AE2I/oxXuZNq+efbToNUCD3P3979Pg FEfqa0WdynG1oNh5gK0JNPRr+Kdn3C8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1660643852; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=M1SOZrFtZgyUILmqZcdztPD9F6caqP4ow9VeTx29XMo=; b=X0eW7EZdiEc5uT1GvwcOlws/zvgFg0lmrQs6qMTcboODGF6g1ico1T9b0YkW/uXALF3eDr 6KHguu1cP+4TC8Aw== 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 5E03C1345B; Tue, 16 Aug 2022 09:57:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id L7nTFQxq+2K1CAAAMHmgww (envelope-from ); Tue, 16 Aug 2022 09:57:32 +0000 Date: Tue, 16 Aug 2022 11:57:31 +0200 Message-ID: <87wnb8y0hg.wl-tiwai@suse.de> From: Takashi Iwai To: zhaoxiao Cc: perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, lgirdwood@gmail.com, peter.ujfalusi@linux.intel.com, yung-chuan.liao@linux.intel.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, daniel.baluta@nxp.com, broonie@kernel.org, guennadi.liakhovetski@linux.intel.com, sound-open-firmware@alsa-project.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ASoC: intel: Replace scnprintf() calls with sysfs_emit_at() In-Reply-To: <20220816085502.25295-1-zhaoxiao@uniontech.com> References: <20220816085502.25295-1-zhaoxiao@uniontech.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 16 Aug 2022 10:55:02 +0200, zhaoxiao wrote: > > 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. Well, the function you've changed isn't used for sysfs at all... Takashi > > Signed-off-by: zhaoxiao > --- > sound/soc/sof/intel/hda.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c > index 6d4ecbe14adf..917d639671a7 100644 > --- a/sound/soc/sof/intel/hda.c > +++ b/sound/soc/sof/intel/hda.c > @@ -574,7 +574,7 @@ static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, const char *le > chip = get_chip_info(sdev->pdata); > for (i = 0; i < HDA_EXT_ROM_STATUS_SIZE; i++) { > value = snd_sof_dsp_read(sdev, HDA_DSP_BAR, chip->rom_status_reg + i * 0x4); > - len += scnprintf(msg + len, sizeof(msg) - len, " 0x%x", value); > + len += sysfs_emit_at(msg, len, " 0x%x", value); > } > > dev_printk(level, sdev->dev, "extended rom status: %s", msg); > -- > 2.20.1 >