Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1122033lqb; Thu, 18 Apr 2024 00:07:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWts00Uob5NeiZXqFFQ1W3zSpgM6G6wde28Xq1hcxyktG8N1wshqqx0DDmgBgGsmH/p7ldRyUmH/wPdwW8YZAsC3AhJhcqEZkWxj35L6Q== X-Google-Smtp-Source: AGHT+IFxxXS4rgwnYoPWgcBTwdBIJ5wf9PkNYJ6nTz+u4y3vNdyy0lOcsEoUbPmu2dsKHYxeZOIG X-Received: by 2002:a05:6a21:3a84:b0:1a9:c79c:7a67 with SMTP id zv4-20020a056a213a8400b001a9c79c7a67mr2831724pzb.5.1713424031814; Thu, 18 Apr 2024 00:07:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713424031; cv=pass; d=google.com; s=arc-20160816; b=xfb37pyohxAqGFz67qVn2o+1zLBX2Ns7WgrVt5D5WCruo+0V9Q+RhH5ALhASbpiOz4 DB0kJliJpcD66QPBp4de80+k1GClfs8p6bIrGuG+fEkptg83OWdnZlfH4MDtSyoFp5JN rWAh0PwZU4PffaJ/aikeLNmmwvMQCePRQcQhv056Ifom6Pez+kvFXKm0QFJojHdWa7wO M8IUyKBUZJhOF6CkQOqfGKk6HN4vhMUOTt7pCx1zVxNJdvAayS7UjAxF6JlhnLgEZ9lU 6eeJHDzPkqSZtCDhiY7sHcxwtOOTu4eyq3xUmDv2d1Fad9CqCR8IQ+qteQJE6FP7QZJ3 yxhQ== ARC-Message-Signature: i=2; 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:message-id:date:subject:cc:to :from; bh=2X8QpMEHgwFOwZUsJBJYofLlxH+cdtaB1rdj6fTYH/c=; fh=pD1F14eBHxl2BPLHawIr/r8LycQ44+kum/erSllM6qM=; b=KjSwScapqwzGafFROD54EJL0FJj5FWyhpOxt2wS0Y3YQPVMqZYiOJvYP8QL9s+UImC q/42pcAV/6iKIKdfd47spjOuqw1eN6/Z50ow+QDd/uf+oWxnAyDBQ6o6Ftd6yFIqwhQh GFfaq2IAkX9bGkUulQGANLyD1sGhr4WF1r4ma32nw+9Fsu2pl5teJjnsQg6nuVPfmKdI mJK5cbJO+MZg2SrEkkW9Q2IEyBI0ss8rLaHQ0PzW2RRyfjYZP9iXuV0OPV7KCzTTn4Cf KQI5vspzDT1d+Ls7+xdrQJlk13QI6EZXoPRP1s+P3l6KNmPA0sk8Z7suVXHA6UobP1Pa /SiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-149633-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149633-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 13-20020a630b0d000000b005e84998d26dsi878988pgl.867.2024.04.18.00.07.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 00:07:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149633-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-149633-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149633-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A88E1283912 for ; Thu, 18 Apr 2024 07:06:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4980D3BBF9; Thu, 18 Apr 2024 07:06:25 +0000 (UTC) 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 45DD238DD9; Thu, 18 Apr 2024 07:06:15 +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=1713423984; cv=none; b=kiuyhSQtIgnsCvfbH6+ryfDnNGcl8rftx2wBSYF1huvZ2m7p07RlXo14q0Aq62LNs4FtkRvKxv5NwTqXpGn4RNkFWAMkPTvJeMHoDr9oSmf76UvMKUBid3JbVFf+vehX0PgpxuCptYNPx0FVwkfp5Xe/4hWT133llyfsHwNS9Dg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713423984; c=relaxed/simple; bh=0cq2KNXJm8olaBiLZ4pdwZRcVn9JY5hk7eaXRwyGEJ8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=CTwmhfzwfcOkpMjwFC0YlY562vWJee0AAZV8HkIDMDA8cxnArAnKWVBVklw/V3lwaz+xrtuEUJSvIkBD4OBYRfESqOzImQ6EQfQIPAsnRGKROg1wPswRAmIX/tk06HinuT/dCVtHULVY4v+1DvtsWRWTmQ1IxPo85EPjb9qbY0M= 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: 1e8c7d88fd5211ee9305a59a3cc225df-20240418 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:ac5da2f7-eedb-4fdc-948d-0bc3ae0cfbd4,IP:20, URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:10 X-CID-INFO: VERSION:1.1.37,REQID:ac5da2f7-eedb-4fdc-948d-0bc3ae0cfbd4,IP:20,UR L:0,TC:0,Content:-5,EDM:0,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:10 X-CID-META: VersionHash:6f543d0,CLOUDID:152c965dcca78d4fb2b481a9159d2bc1,BulkI D:24041815060521XOATZ6,BulkQuantity:0,Recheck:0,SF:66|24|72|19|44|102,TC:n il,Content:0,EDM:-3,IP:-2,URL:11|1,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 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_FSI,TF_CID_SPAM_ULN,TF_CID_SPAM_SNR,TF_CID_SPAM_FSD X-CTIC-Tags: HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NAME, HR_CC_NO_NAME, HR_CTE_8B HR_CTT_MISS, HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_NAME HR_SJ_DIGIT_LEN, HR_SJ_LANG, HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM HR_SJ_PHRASE, HR_SJ_PHRASE_LEN, HR_SJ_WS, HR_TO_COUNT, HR_TO_DOMAIN_COUNT HR_TO_NO_NAME, IP_TRUSTED, SRC_TRUSTED, DN_TRUSTED, SA_EXISTED SN_UNTRUSTED, SN_UNFAMILIAR, SPF_NOPASS, DKIM_NOPASS, DMARC_NOPASS CIE_BAD, CIE_GOOD, CIE_GOOD_SPF, GTI_FG_BS, GTI_RG_INFO GTI_C_BU, AMN_T1, AMN_GOOD, AMN_C_TI, AMN_C_BU ABX_MISS_RDNS X-UUID: 1e8c7d88fd5211ee9305a59a3cc225df-20240418 X-User: jiangyunshui@kylinos.cn Received: from kylin-pc.. [(112.64.161.44)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 424594125; Thu, 18 Apr 2024 15:06:03 +0800 From: yunshui To: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: corentin.chary@gmail.com, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, yunshui , Ai Chao Subject: [PATCH] platform/x86: samsung-laptop: Use sysfs_emit() to replace the old interface sprintf() Date: Thu, 18 Apr 2024 15:05:50 +0800 Message-Id: <20240418070550.628310-1-jiangyunshui@kylinos.cn> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit As Documentation/filesystems/sysfs.rst suggested, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: yunshui Signed-off-by: Ai Chao --- drivers/platform/x86/samsung-laptop.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c index b4aa8ba35d2d..3d2f8e758369 100644 --- a/drivers/platform/x86/samsung-laptop.c +++ b/drivers/platform/x86/samsung-laptop.c @@ -661,9 +661,9 @@ static ssize_t get_performance_level(struct device *dev, /* The logic is backwards, yeah, lots of fun... */ for (i = 0; config->performance_levels[i].name; ++i) { if (sretval.data[0] == config->performance_levels[i].value) - return sprintf(buf, "%s\n", config->performance_levels[i].name); + return sysfs_emit(buf, "%s\n", config->performance_levels[i].name); } - return sprintf(buf, "%s\n", "unknown"); + return sysfs_emit(buf, "%s\n", "unknown"); } static ssize_t set_performance_level(struct device *dev, @@ -744,7 +744,7 @@ static ssize_t get_battery_life_extender(struct device *dev, if (ret < 0) return ret; - return sprintf(buf, "%d\n", ret); + return sysfs_emit(buf, "%d\n", ret); } static ssize_t set_battery_life_extender(struct device *dev, @@ -813,7 +813,7 @@ static ssize_t get_usb_charge(struct device *dev, if (ret < 0) return ret; - return sprintf(buf, "%d\n", ret); + return sysfs_emit(buf, "%d\n", ret); } static ssize_t set_usb_charge(struct device *dev, @@ -878,7 +878,7 @@ static ssize_t get_lid_handling(struct device *dev, if (ret < 0) return ret; - return sprintf(buf, "%d\n", ret); + return sysfs_emit(buf, "%d\n", ret); } static ssize_t set_lid_handling(struct device *dev, -- 2.34.1