From patchwork Tue Sep 27 11:51:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhangsongyi.cgel@gmail.com X-Patchwork-Id: 12990504 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 0D9ADC07E9D for ; Tue, 27 Sep 2022 11:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=P41fvlHTh3FIU1bBFRPllADSz1b1x6L1URiNOYBQ8dQ=; b=18FQtj4gP7viow nE7ksI9BsmDQksLovEK05pPMJ9AICGcOofb4xASD+VYUuEmg4QmvE8sWqzBSjVos/dyH/QZovDNnS 2Ighm7Xmq4IbCqw5jtPPGENGs7bNK0tki2WIRcfPjUpb3adxMXez20QqVqPL5+mvg0pBYqVXMhUG6 XYfW2JKcm7J77MUJOdoRE8J6L8Ew2mPLanEl5MAAqTvW+ERaKTzrc8Gaq0vDc6cufPjpr2K82Z9gU b+nQbN0eyWKuWjAsdlulrdMsbJs9ZmJHj2L1PN0dgXjGz7UnZfkBBoUiLTGpi+wBPdA+L9lzeEsz8 XOuZYfmOxd9RxUIKv1rg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1od97s-00AL8B-M0; Tue, 27 Sep 2022 11:51:48 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1od97p-00AL6k-Rr for linux-arm-kernel@lists.infradead.org; Tue, 27 Sep 2022 11:51:47 +0000 Received: by mail-pl1-x644.google.com with SMTP id b21so8847500plz.7 for ; Tue, 27 Sep 2022 04:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=U3lfCgccZacgh+TSQp+9xE8hshjr/70Enldq2FxBY+w=; b=Q7AJCtV730cNB/lIe5AnV8hTEOSgJhMMEcD+T1teyqBhN6omTkVLiZS6+pjD9OxRMV ONdWXf6sQMLHAqT0BSYCb8Iigr+IsrTlCJUMe+mEU124ZqG72/HzSd+T+mfILlCDrJUF 12PycQ/5M1ohE9z7S2Nwb0GPCPtkrU1ZdhKW9WrjQYhwVO9WddzbyFLX3FZQ0isDO0DW JmKWGM6xsUr7qDwJ9tiPHYx4LOX3qlNNIcD7kNvq4Jyd6a82/jXe7NRHw/UKTdPKyK1U vVXVywFdjqYzRbpBODF36q/f1SwgGC32nFvDIxhH0etw5bI6sj6nvYGYIesEk/+ehFyo pDJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=U3lfCgccZacgh+TSQp+9xE8hshjr/70Enldq2FxBY+w=; b=qECkrlGGr+Gs7TFLtEXA5TqQfgqEoCVZmnFCGKrj5xWujUtaRCopgaRN9XNrJBe3Eg euocyyL3/OVLlq5SPJ+m1bUbW3BMHj55tBDqU39+cgZjLnh2QLF9bXwrOltXogthLtI3 aDTBB+U95YR4QHdXmLBp6QIXChjF/eGNa/pf18YcqT0qvpRWCTxUJzvVTolJAY1940UZ cAD7QZ4jMc9GysngbXsI8REoXvjsAy1wVec2sRNT2KVDBEdm2GYDCD2f9e12KDLZftvN L6yqWDt8jSOTa6JrQH6UTXKaUybI270IinAjZQI7XaQYATw38kA2uWv4TjlsXDoiWzfC UDrg== X-Gm-Message-State: ACrzQf0LzvekEhX1O52L0EZKelrCN8CO36nX9nWI7keOufbtRHtxmIJC pyeUCvkqpg10Dgk32B392uM= X-Google-Smtp-Source: AMsMyM5GDaN4YQyjR2a5Pfl9SmuWMx4BnJch/7YRntadhPPMcchhZkKvZl6ewsgyBCxKmQUuhQiWQw== X-Received: by 2002:a17:902:864a:b0:179:f56e:ee7b with SMTP id y10-20020a170902864a00b00179f56eee7bmr1094045plt.45.1664279502395; Tue, 27 Sep 2022 04:51:42 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id fu1-20020a17090ad18100b001fd6066284dsm1247893pjb.6.2022.09.27.04.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 04:51:42 -0700 (PDT) From: zhangsongyi.cgel@gmail.com X-Google-Original-From: zhang.songyi@zte.com.cn To: mathieu.poirier@linaro.org 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 Subject: [PATCH linux-next] coresight: use sysfs_emit() to instead of scnprintf() Date: Tue, 27 Sep 2022 11:51:36 +0000 Message-Id: <20220927115136.259926-1-zhang.songyi@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220927_045145_922895_D0511C28 X-CRM114-Status: GOOD ( 11.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: James Clark --- drivers/hwtracing/coresight/coresight-stm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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,