Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7044463rwb; Mon, 5 Dec 2022 23:45:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf7y9JlE0gr5u3mxLzLqApbQrkvdYBM6xK4uYywQqP5DCtOU2T6Ooq8X+32PxACJI/s4H4Dd X-Received: by 2002:a63:2251:0:b0:476:cb2a:b99b with SMTP id t17-20020a632251000000b00476cb2ab99bmr78052263pgm.436.1670312738373; Mon, 05 Dec 2022 23:45:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670312738; cv=none; d=google.com; s=arc-20160816; b=CRRFpdDAJIxQ7R0srOY3Xk3BxcWKBRBlV2i1TK9NDbzauZL1azjYLJoXMCBKL4WaiB Y89v1QPp+z+gvYFktKOycKubTLcgPNQHtCVPGp7qDjAm+Uq9yv1/pAcOZnXMCGRsB3US da/+mk7LqFRnCimSa5urgxHp8DqtFLR0OeCruqnzYeImmQzKERhKt6zRIBn532SHSZl5 CmkU1QVHULNMYV2E3eU8oAdhtKF1yv6/Q99SajNPaIcXAimu57X/8/f+U7Zp+eTVgzuw xsM4MfRiRz42PM2MPZvFOcG5j4MseOMqZPiyOpPbu1m7/sT+wfy7zAKvcUKOneDzbbwC +cGA== 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=yv4WVF6OfRigkxPu292G/stt1o0prT3degwJYG4NtKQ=; b=RJXullp9fE/R4EnfaNUVeYVUbIjJGNu9NKK6zJNC7YGfyuYkAF6gyHxx9Xgvekyhyw Sngkff5mdQxUhiCvYfR3G2nZsenIRxGF8oV1/MyPi/rIhCkOuJxKZh2hP5YGYCwl+TIu MMaoG39Q/v144RJu+s1MimeLdb74gROjaGUVVbZV1QDuKTT5dhonEQ4K9OFzm7K3Bs7a NEU4VF6swfCTPU6s7FvlteRKfTHg1i4ME/Ybf0y+8QYvcjuom1Bg8s4zHNOva441VrrI /bzzqrGvUqaxJUXW6GrIr+8PsEvlcb7UgI6oX8e2/THPaJRUVomyuterqK9piE8n4eRS aIQg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dc8-20020a056a0035c800b00574f6921ba2si15777262pfb.207.2022.12.05.23.45.28; Mon, 05 Dec 2022 23:45:38 -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 S233548AbiLFHT4 (ORCPT + 79 others); Tue, 6 Dec 2022 02:19:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230280AbiLFHTy (ORCPT ); Tue, 6 Dec 2022 02:19:54 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6AB2FD3F; Mon, 5 Dec 2022 23:19:52 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (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 4NRBd314QDz8RV7N; Tue, 6 Dec 2022 15:19:51 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2B67JgBu008998; Tue, 6 Dec 2022 15:19:42 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Tue, 6 Dec 2022 15:19:45 +0800 (CST) Date: Tue, 6 Dec 2022 15:19:45 +0800 (CST) X-Zmail-TransId: 2af9638eed11ffffffff8d6e0d5a X-Mailer: Zmail v1.0 Message-ID: <202212061519451024396@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , Subject: =?UTF-8?B?W1BBVENIXSBBQ1BJOiBmYW46IENvbnZlcnQgdG8gdXNlIHN5c2ZzX2VtaXRfYXQoKSBBUEk=?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2B67JgBu008998 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 638EED17.000 by FangMail milter! X-FangMail-Envelope: 1670311191/4NRBd314QDz8RV7N/638EED17.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 638EED17.000/4NRBd314QDz8RV7N X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, 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 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 --- drivers/acpi/fan_attr.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/fan_attr.c b/drivers/acpi/fan_attr.c index f15157d40713..f4f6e2381f1d 100644 --- a/drivers/acpi/fan_attr.c +++ b/drivers/acpi/fan_attr.c @@ -27,24 +27,24 @@ static ssize_t show_state(struct device *dev, struct device_attribute *attr, cha count = scnprintf(buf, PAGE_SIZE, "%lld:", fps->control); if (fps->trip_point == 0xFFFFFFFF || fps->trip_point > 9) - count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:"); + count += sysfs_emit_at(buf, count, "not-defined:"); else - count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->trip_point); + count += sysfs_emit_at(buf, count, "%lld:", fps->trip_point); if (fps->speed == 0xFFFFFFFF) - count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:"); + count += sysfs_emit_at(buf, count, "not-defined:"); else - count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->speed); + count += sysfs_emit_at(buf, count, "%lld:", fps->speed); if (fps->noise_level == 0xFFFFFFFF) - count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:"); + count += sysfs_emit_at(buf, count, "not-defined:"); else - count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->noise_level * 100); + count += sysfs_emit_at(buf, count, "%lld:", fps->noise_level * 100); if (fps->power == 0xFFFFFFFF) - count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined\n"); + count += sysfs_emit_at(buf, count, "not-defined\n"); else - count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld\n", fps->power); + count += sysfs_emit_at(buf, count, "%lld\n", fps->power); return count; } -- 2.25.1