Message ID | 202212011053265568903@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;heyuhang3455@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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: <ye.xingchen@zte.com.cn> To: <joonas.lahtinen@linux.intel.com> Cc: <jani.nikula@linux.intel.com>, <rodrigo.vivi@intel.com>, <tvrtko.ursulin@linux.intel.com>, <airlied@gmail.com>, <daniel@ffwll.ch>, <intel-gfx@lists.freedesktop.org>, <dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org> Subject: =?utf-8?q?=5BPATCH=5D_drm/i915=3A_use_sysfs=5Femit=28=29_to_instead?= =?utf-8?q?_of_scnprintf=28=29?= Content-Type: text/plain; charset="UTF-8" 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/<ye.xingchen@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: <linux-kernel.vger.kernel.org> 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?= |
Series |
drm/i915: use sysfs_emit() to instead of scnprintf()
|
|
Commit Message
ye.xingchen@zte.com.cn
Dec. 1, 2022, 2:53 a.m. UTC
From: ye xingchen <ye.xingchen@zte.com.cn> Replace the open-code with sysfs_emit() to simplify the code. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> --- drivers/gpu/drm/i915/i915_mitigations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Thu, 01 Dec 2022, <ye.xingchen@zte.com.cn> wrote: > From: ye xingchen <ye.xingchen@zte.com.cn> > > Replace the open-code with sysfs_emit() to simplify the code. I was going to push this, but noticed the function has a third scnprintf(), and the last two play together with count. It would be confusing to have a mix of sysfs_emit() and scnprintf(). The third one can't be blindly converted to sysfs_emit() because it writes at an offset not aligned by PAGE_SIZE. So I'm not taking this. BR, Jani. > > Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> > --- > 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;
On Mon, Dec 05, 2022 at 12:50:53PM +0200, Jani Nikula wrote: > On Thu, 01 Dec 2022, <ye.xingchen@zte.com.cn> wrote: > > From: ye xingchen <ye.xingchen@zte.com.cn> > > > > Replace the open-code with sysfs_emit() to simplify the code. > > I was going to push this, but noticed the function has a third > scnprintf(), and the last two play together with count. It would be > confusing to have a mix of sysfs_emit() and scnprintf(). The third one > can't be blindly converted to sysfs_emit() because it writes at an > offset not aligned by PAGE_SIZE. > > So I'm not taking this. > Hi Jani, Fortunately you'd NAKed this patch from ZTE people, which are known for ignoring your (and others) patch review. Remember that they were used to send from cgel.zte gmail account [1], which after the address was banned from LKML, they tried to send from their own corporate account but Greg suspected that emails sent from them are spoofed [2]. Thanks. [1]: https://lore.kernel.org/lkml/878rn1dd8l.fsf@intel.com/ [2]: https://lore.kernel.org/lkml/Y3NqyDDGz%2FUKPgxM@kroah.com/
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;