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 3C581C32771 for ; Wed, 28 Sep 2022 14:56:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234309AbiI1O4t (ORCPT ); Wed, 28 Sep 2022 10:56:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234528AbiI1O4d (ORCPT ); Wed, 28 Sep 2022 10:56:33 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1AE46895E4 for ; Wed, 28 Sep 2022 07:56:22 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 662F4153B; Wed, 28 Sep 2022 07:56:28 -0700 (PDT) Received: from [10.57.0.129] (unknown [10.57.0.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CA6593F73D; Wed, 28 Sep 2022 07:56:19 -0700 (PDT) Message-ID: Date: Wed, 28 Sep 2022 15:56:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH linux-next] coresight: use sysfs_emit() to instead of scnprintf() Content-Language: en-US To: zhangsongyi.cgel@gmail.com Cc: suzuki.poulose@arm.com, mike.leach@linaro.org, leo.yan@linaro.org, alexander.shishkin@linux.intel.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org, zhang songyi , Zeal Robot , Mathieu Poirier References: <20220927115136.259926-1-zhang.songyi@zte.com.cn> From: James Clark In-Reply-To: <20220927115136.259926-1-zhang.songyi@zte.com.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/09/2022 12:51, zhangsongyi.cgel@gmail.com wrote: > From: zhang songyi > > Follow the advice of the Documentation/filesystems/sysfs.rst and show() > should only use sysfs_emit() or sysfs_emit_at() when formatting the value > to be returned to user space. > > Reported-by: Zeal Robot > Signed-off-by: zhang songyi > --- > drivers/hwtracing/coresight/coresight-stm.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > Reviewed-by: James Clark > diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c > index 463f449cfb79..3a1b07217932 100644 > --- a/drivers/hwtracing/coresight/coresight-stm.c > +++ b/drivers/hwtracing/coresight/coresight-stm.c > @@ -466,7 +466,7 @@ static ssize_t hwevent_enable_show(struct device *dev, > struct stm_drvdata *drvdata = dev_get_drvdata(dev->parent); > unsigned long val = drvdata->stmheer; > > - return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); > + return sysfs_emit(buf, "%#lx\n", val); > } > > static ssize_t hwevent_enable_store(struct device *dev, > @@ -495,7 +495,7 @@ static ssize_t hwevent_select_show(struct device *dev, > struct stm_drvdata *drvdata = dev_get_drvdata(dev->parent); > unsigned long val = drvdata->stmhebsr; > > - return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); > + return sysfs_emit(buf, "%#lx\n", val); > } > > static ssize_t hwevent_select_store(struct device *dev, > @@ -530,7 +530,7 @@ static ssize_t port_select_show(struct device *dev, > spin_unlock(&drvdata->spinlock); > } > > - return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); > + return sysfs_emit(buf, "%#lx\n", val); > } > > static ssize_t port_select_store(struct device *dev, > @@ -577,7 +577,7 @@ static ssize_t port_enable_show(struct device *dev, > spin_unlock(&drvdata->spinlock); > } > > - return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); > + return sysfs_emit(buf, "%#lx\n", val); > } > > static ssize_t port_enable_store(struct device *dev,