Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp807452pxb; Wed, 3 Feb 2021 19:36:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUydYjy4aPtqohmZmYKsWZ8wXoXFIehpN2aSS9lqs2atWFsmkMo/D1MKWH/1SQt5+05JS2 X-Received: by 2002:a05:6402:149:: with SMTP id s9mr6197013edu.247.1612409763989; Wed, 03 Feb 2021 19:36:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612409763; cv=none; d=google.com; s=arc-20160816; b=KkHwAjR0vZB0vhypMn9h0YUt5cKpH++ibameIQzaX+k+C8CyBKLvC2+s6J+hCj3jDY pOyU1V+lsTY5tcYP0zOzCVkMlfJ6vsDaPF9i4JNOxiSQG2kjfg4Y4b3wZPm494Jt0ujh seJ6hoWhgjf+CwBICfGQbBqdsQ7gUDLnjXnJuwXqn6Px71ttvlNb8iLDfpOMv4YVmVYi 3OYc4byfVi28bofUpC655nMPmXi+lJ/CT1rDzsTpnh+FpPRnUnKZWW1vePz0M0vIojZ5 BtXsYsJsZl5fctU+6SB2yqMiIk81V9A8idk4VaRy4y35njSLT+3p0QETuwpnscWAljhR S2Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=fCV3B70gGz01wAbVxpxPL+XS7h/0nBL5BW917UuVFUs=; b=eNWsPxClxqiQ65zO41g06a1Axd5oGjqIRHYXnVReiy1Ll9RkL9nxilU6tMxj7Dj94R WsF80iuyWyiLfPWfgKmhwKEMMEdQN7ek0/PlANgJap6m9vNsq8ynUI1CN/2Czb2roPgB TYi28yz4XCwT5pQyxxIz6ZGH99xKDhwXR63/AMkE445LQQmzBtEqmbAqi9dfyO6FvQk8 Fm4LGLSWVo57AHybxvyP5a8j6AQ/uryiiRcyaOpK7dnu+dbahdaAD6tzlC+04ThZpYHh SYN66aIVvAkezBx49trryt+fZqEtSaxyzGhjNXcsR1fsr47rUumpbO0I1OBs3DA0ZBs0 LheQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j4si2621836ejv.17.2021.02.03.19.35.40; Wed, 03 Feb 2021 19:36:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234444AbhBDDdk (ORCPT + 99 others); Wed, 3 Feb 2021 22:33:40 -0500 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:39532 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231759AbhBDDdj (ORCPT ); Wed, 3 Feb 2021 22:33:39 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0UNp.PXn_1612409572; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0UNp.PXn_1612409572) by smtp.aliyun-inc.com(127.0.0.1); Thu, 04 Feb 2021 11:32:57 +0800 From: Jiapeng Chong To: will@kernel.org Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jiapeng Chong Subject: [PATCH] drivers/perf: convert sysfs sprintf/snprintf family to sysfs_emit Date: Thu, 4 Feb 2021 11:32:51 +0800 Message-Id: <1612409571-56451-1-git-send-email-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the following coccicheck warning: ./drivers/perf/arm-cci.c:708:8-16: WARNING: use scnprintf or sprintf. ./drivers/perf/arm-cci.c:699:8-16: WARNING: use scnprintf or sprintf. ./drivers/perf/arm-cci.c:528:8-16: WARNING: use scnprintf or sprintf. ./drivers/perf/arm-cci.c:309:8-16: WARNING: use scnprintf or sprintf. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- drivers/perf/arm-cci.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c index 87c4be9..efc39cb 100644 --- a/drivers/perf/arm-cci.c +++ b/drivers/perf/arm-cci.c @@ -306,7 +306,7 @@ static ssize_t cci400_pmu_cycle_event_show(struct device *dev, { struct dev_ext_attribute *eattr = container_of(attr, struct dev_ext_attribute, attr); - return snprintf(buf, PAGE_SIZE, "config=0x%lx\n", (unsigned long)eattr->var); + return sysfs_emit(buf, "config=0x%lx\n", (unsigned long)eattr->var); } static int cci400_get_event_idx(struct cci_pmu *cci_pmu, @@ -525,8 +525,8 @@ static ssize_t cci5xx_pmu_global_event_show(struct device *dev, struct dev_ext_attribute *eattr = container_of(attr, struct dev_ext_attribute, attr); /* Global events have single fixed source code */ - return snprintf(buf, PAGE_SIZE, "event=0x%lx,source=0x%x\n", - (unsigned long)eattr->var, CCI5xx_PORT_GLOBAL); + return sysfs_emit(buf, "event=0x%lx,source=0x%x\n", + (unsigned long)eattr->var, CCI5xx_PORT_GLOBAL); } /* @@ -696,7 +696,7 @@ static ssize_t cci_pmu_format_show(struct device *dev, { struct dev_ext_attribute *eattr = container_of(attr, struct dev_ext_attribute, attr); - return snprintf(buf, PAGE_SIZE, "%s\n", (char *)eattr->var); + return sysfs_emit(buf, "%s\n", (char *)eattr->var); } static ssize_t cci_pmu_event_show(struct device *dev, @@ -705,8 +705,7 @@ static ssize_t cci_pmu_event_show(struct device *dev, struct dev_ext_attribute *eattr = container_of(attr, struct dev_ext_attribute, attr); /* source parameter is mandatory for normal PMU events */ - return snprintf(buf, PAGE_SIZE, "source=?,event=0x%lx\n", - (unsigned long)eattr->var); + return sysfs_emit(buf, "source=?,event=0x%lx\n", (unsigned long)eattr->var); } static int pmu_is_valid_counter(struct cci_pmu *cci_pmu, int idx) -- 1.8.3.1