From nobody Thu Dec 18 19:25:05 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 3167F19CCF5 for ; Thu, 11 Dec 2025 09:32:30 +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=1765445554; cv=none; b=IeNEprb7MxJbEZp3yIjrDTpAtJ16EBO4YmZFNnkYq8pRXafJfxNSJ872Hbu6gVhbRJnWLAjixOMWXCPhhGZtl4kDTuKTHHVA138bw2vcIHDX9iHrQxvJqWDwOYuKrDw10zY2QKpx+9PP1ZVc/cAMaBByMnvdYhpjrMJVMv6d+vs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765445554; c=relaxed/simple; bh=Ed4gBc2QkCYx6ZjA98fxH5sf2UFINsx0FhoBr4h1eGg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=UtqxWXn4fNGqUBopSvloymCJUOaMcnbX3dMVhzRvfHD5+vSdG81BkZGYprM1kzj9X+FxxwW8MhDJ3NHPGcHqnRcOE4BTXNzwogTn8m4LzX5dMbgbUFRyrKKFryNVT5V/sAhN+tbbtHY+q8iET0UXg5yi6e8oCmHjwAQVEooGsiQ= 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: 4bd47d84d67411f0a38c85956e01ac42-20251211 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.6,REQID:56e1c3f2-9970-47c6-89d3-4f900d6f0a8f,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:1d468a269312fe66aae175ce17b346db,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: 4bd47d84d67411f0a38c85956e01ac42-20251211 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 1336031601; Thu, 11 Dec 2025 17:32:22 +0800 From: chen zhang To: hdegoede@redhat.com, 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: Thu, 11 Dec 2025 17:32:17 +0800 Message-Id: <20251211093217.308309-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