From patchwork Thu Dec 1 02:53:26 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: 28169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp43343wrr; Wed, 30 Nov 2022 19:05:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf7IgH+429zRaLiKHlbIDyNPORPu/i1kSvpDzbMrotukIbRhcUylBOK8xcuWC7WdHrglgREX X-Received: by 2002:a63:eb4b:0:b0:477:a350:2172 with SMTP id b11-20020a63eb4b000000b00477a3502172mr37198113pgk.167.1669863943744; Wed, 30 Nov 2022 19:05:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669863943; cv=none; d=google.com; s=arc-20160816; b=TYra4WPB5ajJoHbW9FhFmMXvNwM+hKBYB+MThBFclqmSTlc5GVa7dyUH1vXWnO01TO mhq4Kg+5VQt3uuukeE4WLSpWCXnVsBlW3VjbpcqdTHxZ5EPw4is7G2nRy00N9f3uKgQy PgIc95wbFsvnKBisULqyli/NB2RDsM/sKSQKxS6a9Ckd/nqLe4W5HnNJdOLbzNJ9ewoQ rtefrrsPe2NTazj9FiKVN7OPpHjgQQfJamTBV8LDjpDPVZCvT9czOyavET/KJpyC25wT AHC8Vtb10bk3C4hXHyg3rY5GcYB1q6KUOvyaXIYHjwrigndMg/P9154ui2/dCR6GvvIn hFBQ== 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=JMQKzdxyCHXgH+ewawzUSWWRg6wwzHBPtV4dXu23C3k=; b=vb3pbMzgyM5dOM9pZ7gtxCXBhIOcMDJrmKz7E3Ibbm6QAMFeAinK3lCrNzlWfWDUjY Rj+Xwvis/Lv9C46ugP/K7sFzH2oj8w1GMmTlW2j+8yBP7LRQ1rM1zEvL4qQ8HQVBIHXf ius9a2RDNKQ3iOaOMEh1gnyoAYYBUBgGF7M857XkCn0r27Takq01xhvvVJCpy34NwFjx cRTqAJR1HwY8UmIcseDV0q8eCrO22x0DUZfq6yjg5eUkoMA5iAFwz8ADCwFvKUfaJofA FJzSm3J79CCdXcfCbdycIVld7VS4FKgWrXJPOPopqTtvaD+QFvbh0KZzzWnzaEUzCrhv d0nw== 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 g6-20020a056a001a0600b00556c1c66b61si3518178pfv.143.2022.11.30.19.05.30; Wed, 30 Nov 2022 19:05:43 -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 S229757AbiLACxj (ORCPT + 99 others); Wed, 30 Nov 2022 21:53:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbiLACxi (ORCPT ); Wed, 30 Nov 2022 21:53:38 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB8089AD1 for ; Wed, 30 Nov 2022 18:53:37 -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 4NN0y76GV1z8QrkZ; Thu, 1 Dec 2022 10:53:35 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2B12rP0R030683; Thu, 1 Dec 2022 10:53:25 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Thu, 1 Dec 2022 10:53:26 +0800 (CST) Date: Thu, 1 Dec 2022 10:53:26 +0800 (CST) X-Zmail-TransId: 2af9638817266e81791a X-Mailer: Zmail v1.0 Message-ID: <202212011053265568903@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , Subject: =?utf-8?q?=5BPATCH=5D_drm/i915=3A_use_sysfs=5Femit=28=29_to_instead?= =?utf-8?q?_of_scnprintf=28=29?= X-MAIL: mse-fl2.zte.com.cn 2B12rP0R030683 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 6388172F.000 by FangMail milter! X-FangMail-Envelope: 1669863215/4NN0y76GV1z8QrkZ/6388172F.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6388172F.000/4NN0y76GV1z8QrkZ 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750979254966007759?= X-GMAIL-MSGID: =?utf-8?q?1750979254966007759?= From: ye xingchen Replace the open-code with sysfs_emit() to simplify the code. Signed-off-by: ye xingchen --- drivers/gpu/drm/i915/i915_mitigations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_mitigations.c b/drivers/gpu/drm/i915/i915_mitigations.c index def7302ef7fe..2b7aaaefb3a9 100644 --- a/drivers/gpu/drm/i915/i915_mitigations.c +++ b/drivers/gpu/drm/i915/i915_mitigations.c @@ -102,10 +102,10 @@ static int mitigations_get(char *buffer, const struct kernel_param *kp) bool enable; if (!local) - return scnprintf(buffer, PAGE_SIZE, "%s\n", "off"); + return sysfs_emit(buffer, "%s\n", "off"); if (local & BIT(BITS_PER_LONG - 1)) { - count = scnprintf(buffer, PAGE_SIZE, "%s,", "auto"); + count = sysfs_emit(buffer, "%s,", "auto"); enable = false; } else { enable = true;