From patchwork Fri Dec 2 09:05:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ye.xingchen@zte.com.cn X-Patchwork-Id: 28799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp726441wrr; Fri, 2 Dec 2022 01:07:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf5HO4fH8bdx877J+MzTzbFPWDw7Hfxih3em5dekN2iHaOJd7nUhQ5Xh7wUwguRa8Qc1Eg5s X-Received: by 2002:a17:907:a489:b0:7c0:c14f:73d7 with SMTP id vp9-20020a170907a48900b007c0c14f73d7mr2012305ejc.52.1669972040727; Fri, 02 Dec 2022 01:07:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669972040; cv=none; d=google.com; s=arc-20160816; b=YDeJ74cC+T0L45vlZ56iY9pUNrVxJTjiIKLVQtmRUmjespRQHFCmHhpsqFOgRNjYNe JQzNUKNGpm/NRFRObfnq3EOPbaEpLb0XDFcuoBOQsMRweORiR3oM/DbJma6H4ZLBoGQZ P1+aLildqHX237sLzb7cT1p1nvAjJB3RJ6t9MGANsjtBUZJscz8NP/dyKGiGeVQRVsqe i3mbFj2iKbW/890NH+dGAwvCA8aRPM4oCuxD1YjtJBQoYn1EUhChNlXRsCHSHehN4WAz BkId1eqPr/5k0cGDeAq8rJbmq5y08edSXT3b8/lTvaujLKFkovBLy9z7fPz2SuC/V3AX 4T1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=ASE5bft9Yv77OQo0jATDmTlOX9VdfYymoc4ZLqCsDjA=; b=AaXL+kVbnvpBonfpFCvYS+CSUwV3hjeEbPKho+7uQA+0PR5esKinrIhCQvj+T68DIh I+MstbV9ECTbN8OpCNdAtgSj0BBkopKO+MUbBCcfd2bwddUMXAj7g0ymCKaYF5R7t2SN FyqUT/+4bUvFcZ6necEul5FG2oLbxydFtxfk5CTC60fgKFAUhMT1FNcDpea3oJaQGSe1 nH8syLNK1Bjp49m4fDx395EiE5jTTfdI+fLUG0CZcWwzDRU7d1z5MJYh9VcBF9mce7Rg St4VmHQEcavglUuI3bXynkt6yiyQBFMaUdZYTd804FuhhuJtmaCJRMrKNHbNCAfLy4qS /RlA== 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=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v7-20020a056402174700b0045d9a3adf48si5416838edx.591.2022.12.02.01.06.57; Fri, 02 Dec 2022 01:07:20 -0800 (PST) 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=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232327AbiLBJFe (ORCPT + 99 others); Fri, 2 Dec 2022 04:05:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231578AbiLBJFb (ORCPT ); Fri, 2 Dec 2022 04:05:31 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76FB525CC; Fri, 2 Dec 2022 01:05:30 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NNn8n16BMz5BNS0; Fri, 2 Dec 2022 17:05:29 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2B295Avb031743; Fri, 2 Dec 2022 17:05:10 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Fri, 2 Dec 2022 17:05:12 +0800 (CST) Date: Fri, 2 Dec 2022 17:05:12 +0800 (CST) X-Zmail-TransId: 2af96389bfc805f2c885 X-Mailer: Zmail v1.0 Message-ID: <202212021705128095546@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , Subject: =?utf-8?q?=5BPATCH=5D_platform/x86=3A_use_sysfs=5Femit=28=29_to_ins?= =?utf-8?q?tead_of_scnprintf=28=29?= X-MAIL: mse-fl2.zte.com.cn 2B295Avb031743 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 6389BFD9.001 by FangMail milter! X-FangMail-Envelope: 1669971929/4NNn8n16BMz5BNS0/6389BFD9.001/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6389BFD9.001/4NNn8n16BMz5BNS0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751092602997708002?= X-GMAIL-MSGID: =?utf-8?q?1751092602997708002?= From: ye xingchen 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. Signed-off-by: ye xingchen Reviewed-by: Justin Ernst --- drivers/platform/x86/uv_sysfs.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c index 625b0b79d185..73fc38ee7430 100644 --- a/drivers/platform/x86/uv_sysfs.c +++ b/drivers/platform/x86/uv_sysfs.c @@ -119,12 +119,12 @@ struct uv_hub { static ssize_t hub_name_show(struct uv_bios_hub_info *hub_info, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%s\n", hub_info->name); + return sysfs_emit(buf, "%s\n", hub_info->name); } static ssize_t hub_location_show(struct uv_bios_hub_info *hub_info, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%s\n", hub_info->location); + return sysfs_emit(buf, "%s\n", hub_info->location); } static ssize_t hub_partition_show(struct uv_bios_hub_info *hub_info, char *buf) @@ -460,12 +460,12 @@ struct uv_pci_top_obj { static ssize_t uv_pci_type_show(struct uv_pci_top_obj *top_obj, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%s\n", top_obj->type); + return sysfs_emit(buf, "%s\n", top_obj->type); } static ssize_t uv_pci_location_show(struct uv_pci_top_obj *top_obj, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%s\n", top_obj->location); + return sysfs_emit(buf, "%s\n", top_obj->location); } static ssize_t uv_pci_iio_stack_show(struct uv_pci_top_obj *top_obj, char *buf) @@ -475,7 +475,7 @@ static ssize_t uv_pci_iio_stack_show(struct uv_pci_top_obj *top_obj, char *buf) static ssize_t uv_pci_ppb_addr_show(struct uv_pci_top_obj *top_obj, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%s\n", top_obj->ppb_addr); + return sysfs_emit(buf, "%s\n", top_obj->ppb_addr); } static ssize_t uv_pci_slot_show(struct uv_pci_top_obj *top_obj, char *buf) @@ -737,7 +737,7 @@ static ssize_t coherence_id_show(struct kobject *kobj, static ssize_t uv_type_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%s\n", uv_type_string()); + return sysfs_emit(buf, "%s\n", uv_type_string()); } static ssize_t uv_archtype_show(struct kobject *kobj, @@ -749,13 +749,13 @@ static ssize_t uv_archtype_show(struct kobject *kobj, static ssize_t uv_hub_type_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_hub_type()); + return sysfs_emit(buf, "0x%x\n", uv_hub_type()); } static ssize_t uv_hubless_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_get_hubless_system()); + return sysfs_emit(buf, "0x%x\n", uv_get_hubless_system()); } static struct kobj_attribute partition_id_attr =