From nobody Thu Dec 18 13:40:50 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 017B9748F for ; Mon, 15 Dec 2025 03:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765769491; cv=none; b=Hubpi6ttWeBVefxlj97PDunOXsP3rC6vrMnq3lBBkuT0vy/GJ/QBltsP9nu1iGJza90B1ayHivBbxJphW71E+ptnjftxsGyx7e+q9CU9JRIXQLFR5HzKF5y6Hu3eSO7fzHs4ZIA5DLBoolQUNC/ytjTrNvkZylIlLA9Nx+enDg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765769491; c=relaxed/simple; bh=Ed4gBc2QkCYx6ZjA98fxH5sf2UFINsx0FhoBr4h1eGg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=f8HsSaQH4k0H3kkZqjABJt1Xf7VnNVDzCXjap+//Azxpw45fRzqP0rDarKUIg3hBuBndYwVrkzzRYQkdG99XjaqAtiyUJ/V+BIuWa6LgzYMHk74tp9zqjuFYHmUnxsFjTPGUFvuzWiP06DGWpRZCBkVRrU2oV2Z1P0fBBDkVusM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 87ba18fad96611f0a38c85956e01ac42-20251215 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.6,REQID:9b476346-7ca3-494a-b344-08d46941a681,IP:0,UR L:0,TC:0,Content:0,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:25 X-CID-META: VersionHash:a9d874c,CLOUDID:0fac4955cee2e96b2d17f5ec61495ae4,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102|850|898,TC:nil,Content:0|15|50,EDM:5 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 87ba18fad96611f0a38c85956e01ac42-20251215 X-User: jiangyunshui@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1583132799; Mon, 15 Dec 2025 11:31:23 +0800 From: chen zhang To: hdegoede@redhat.com, hansg@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-kernel@vger.kernel.org, chenzhang_0901@163.com, chen zhang Subject: [PATCH] platform/x86: ibm_rtl: use sysfs_emit() instead of sprintf() Date: Mon, 15 Dec 2025 11:31:19 +0800 Message-Id: <20251215033119.51590-1-chenzhang@kylinos.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Follow the advice in Documentation/filesystems/sysfs.rst: show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: chen zhang --- drivers/platform/x86/ibm_rtl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c index 231b37909801..c533b240534f 100644 --- a/drivers/platform/x86/ibm_rtl.c +++ b/drivers/platform/x86/ibm_rtl.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -144,14 +145,14 @@ static ssize_t rtl_show_version(struct device *dev, struct device_attribute *attr, char *buf) { - return sprintf(buf, "%d\n", (int)ioread8(&rtl_table->version)); + return sysfs_emit(buf, "%d\n", (int)ioread8(&rtl_table->version)); } =20 static ssize_t rtl_show_state(struct device *dev, struct device_attribute *attr, char *buf) { - return sprintf(buf, "%d\n", ioread8(&rtl_table->rt_status)); + return sysfs_emit(buf, "%d\n", ioread8(&rtl_table->rt_status)); } =20 static ssize_t rtl_set_state(struct device *dev, --=20 2.25.1