Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp734205rwb; Wed, 28 Sep 2022 08:26:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4syoiXaUV/IzU7rQpL4ScDSjyo2KaVtFM2ipbYVzHxN/j4PriT4ZCSqGNz+G9gdcBxe3q1 X-Received: by 2002:a17:90b:1648:b0:203:c8d3:99b0 with SMTP id il8-20020a17090b164800b00203c8d399b0mr11194891pjb.54.1664378811440; Wed, 28 Sep 2022 08:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664378811; cv=none; d=google.com; s=arc-20160816; b=nElKrStwsYDDsd3UpJsW3RYKdPKOrhJRb38FNY04mWDGe0VRQGOJEWO1Wy6TijdLPP TwGw/AZ+rDT+hSauBtpXeb6wB5N1yoFu/pfRu5KCZNbAYDcw7G7DyOOLkv59e/+vPI7c 0APbjuhXse5LG6yT54G9rYvGUaEPaK4m+5ehhslSzecWxtAG7/yGll+eHSgHZqSgNbDf D/cytWwv9bm/uFXApsH4kT8spSbT972Ujj2HyEouJ1aG7nC2p+zEtKH6xAgfyXeZC3WF IqHPf3wqrFkF5H1GywvS7h9w/9vt44YhBxwtjNy2HIPpztVDHBR6T3kl2PutAwOSTUyU f+pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Q+cs3I3CTPRp/GQt+JhJ7+k5YmvZd/Cy4Io+oF5+Bks=; b=CTIIGGwEMJQ9ol/ojDNDyrK587M//ZDyCYqfD6YfyHf35kGM5mSaKiKxzfwY/ZpFKl EBhQc7lTKLv+8BB3BQaIJpdF0FkcD0K9oMNOAbIDczBTB7VTEANrOXU0/CSg8kTSVw77 pdYOpdrSoN14m2LRvmKx778LRQJ2anppsuW52/v9eFtXYuWcD5sr6XoMp8qVW41twqSy kmkxBprCtsfJs03FkBAK9QH086quJt8UhBKmA1Q4NzKawcCXPCaheaKsKKBuAu8YwQaF kYeJSQURoFw49SZUS+0CyJqPthuWO34RCkRIYEW38uAD4UHL2JyvgjMLPkj9Xz1sy3dh Zqrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb1-20020a17090b4a4100b00202b66eaf44si2953766pjb.0.2022.09.28.08.26.39; Wed, 28 Sep 2022 08:26:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234519AbiI1O4s (ORCPT + 99 others); Wed, 28 Sep 2022 10:56:48 -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 X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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,