Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp242146rdb; Mon, 15 Jan 2024 20:54:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFnMHweuQ3texp1iLRK4+kFBxyFFiXtRyEldnRYzy/xfmsJqpMrUBpGs2IR1H5+FOoJqWcx X-Received: by 2002:a17:90a:f593:b0:28d:e4aa:e883 with SMTP id ct19-20020a17090af59300b0028de4aae883mr4106411pjb.0.1705380857309; Mon, 15 Jan 2024 20:54:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705380857; cv=none; d=google.com; s=arc-20160816; b=Y6Wxo4keGMw2Q3FEP5JiDoAlyAkInWAhQFEKclBusV/FhKl2096ARVrMHgciNGM2u9 vm3nqqp8n/AoxIQHkLK+ptle+3Fs/c+xnA0nDY5JNFByREIjNYnUnosOtkshdhLNLJqx N+h1Fi3js+lnRzag9ze6sTBqmOk+tJ+KKCeqOFeicjrEiJR75R/YwlDnXwXgge6uTP9F PcuhqjL5QipvjStf/PWObTfoLav2OToPX3NNsPzcvoN8UtH/3VErTRUFZ+kvQsf3kAoL 6pIhpW9rfVYFn8F31GrajQHfyyQVPz55KIzNNFhdh30uAhrYtUU0/AhRjTMmhExGdbRb b1DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ZXE8V1UDTJu7wxPHxKdRsvPGGNMDTj74zp+nEQ3+tEI=; fh=S7riKXlWnTfTTlJbzMD8VELVoSL00w0eVV6ANuvq+cY=; b=lPuVWtpa853mMAt1fawmmY6PUz/LUa7x5Byx7/0dL328jqvm6boILM0SxRJJOXkqA9 /tTbgRb5yVIOXwPQcFaKfuTqP5usJP45BabunlQW+rPqWeDOLNS6H/MuNdjkhqNvPn+6 DQb+wlZJ/pnNF5ZFeGyCp82sW4fOyG0ITdSToEUAqBTBcEpLf+iIhjpDkHPWLhkVUNc7 Ev7F3i9TYgWYxIbp8EprHh0L7Wlr6biY0W4zaL2xem3Juin/ptWWmr0F+u4joLLigVOn lGE6mDFOUuLU5rhJZ2vOv/n0Xry7u5JpZx6W0YlnAhVOt1gD1NQ4H0wbsjeN8RXgw+3q zJvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26966-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26966-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t19-20020a17090aba9300b0028c2b46bf90si10050035pjr.188.2024.01.15.20.54.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 20:54:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26966-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26966-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26966-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BB8A0B22D2E for ; Tue, 16 Jan 2024 04:53:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27D6B8831; Tue, 16 Jan 2024 04:52:28 +0000 (UTC) Received: from esa7.hc1455-7.c3s2.iphmx.com (esa7.hc1455-7.c3s2.iphmx.com [139.138.61.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D058A12B66 for ; Tue, 16 Jan 2024 04:52:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fujitsu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fujitsu.com X-IronPort-AV: E=McAfee;i="6600,9927,10954"; a="125018755" X-IronPort-AV: E=Sophos;i="6.04,198,1695654000"; d="scan'208";a="125018755" Received: from unknown (HELO oym-r3.gw.nic.fujitsu.com) ([210.162.30.91]) by esa7.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2024 13:52:17 +0900 Received: from oym-m4.gw.nic.fujitsu.com (oym-nat-oym-m4.gw.nic.fujitsu.com [192.168.87.61]) by oym-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id 289EFD64B3 for ; Tue, 16 Jan 2024 13:52:15 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id 2581AD4BF4 for ; Tue, 16 Jan 2024 13:52:14 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id A88EA200A768C for ; Tue, 16 Jan 2024 13:52:13 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by edo.cn.fujitsu.com (Postfix) with ESMTP id C437E1A0070; Tue, 16 Jan 2024 12:52:12 +0800 (CST) From: Li Zhijian To: linux-kernel@vger.kernel.org Cc: Li Zhijian , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Subject: [PATCH 03/42] arch/x86/events/amd: Convert snprintf to sysfs_emit Date: Tue, 16 Jan 2024 12:51:12 +0800 Message-Id: <20240116045151.3940401-1-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240116041129.3937800-1-lizhijian@fujitsu.com> References: <20240116041129.3937800-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-28122.004 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-28122.004 X-TMASE-Result: 10--9.861000-10.000000 X-TMASE-MatchedRID: TWQD+6s80gM4ibokZ3+Q0CoiRKlBVkYIBXngI6jFvpfvd49YGReckE1N J2MN+nPkgxCMf8A0YpR5sRK06wHV4ZsFQA+TKYc0rMZ+BqQt2No4ptE5KnVLXsC5DTEMxpeQfiq 1gj2xET8vYRhsicUjm384hUjri5PxNyl1nd9CIt0URSScn+QSXmVV1G+Ck2l7+gtHj7OwNO35N/ S1zEq4uhy2IzOhKblFEJIBIVfbbipfoaf/6t5wxkOF+6eMOsgw X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 Per filesystems/sysfs.rst, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. coccinelle complains that there are still a couple of functions that use snprintf(). Convert them to sysfs_emit(). > ./arch/x86/events/amd/core.c:1282:8-16: WARNING: please use sysfs_emit No functional change intended CC: Peter Zijlstra CC: Ingo Molnar CC: Arnaldo Carvalho de Melo CC: Mark Rutland CC: Alexander Shishkin CC: Jiri Olsa CC: Namhyung Kim CC: Ian Rogers CC: Adrian Hunter CC: Thomas Gleixner CC: Borislav Petkov CC: Dave Hansen CC: x86@kernel.org CC: "H. Peter Anvin" Signed-off-by: Li Zhijian --- arch/x86/events/amd/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index e24976593a29..f2fef75d464c 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c @@ -1279,7 +1279,7 @@ static ssize_t branches_show(struct device *cdev, struct device_attribute *attr, char *buf) { - return snprintf(buf, PAGE_SIZE, "%d\n", x86_pmu.lbr_nr); + return sysfs_emit(buf, "%d\n", x86_pmu.lbr_nr); } static DEVICE_ATTR_RO(branches); -- 2.29.2