Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1077493rwb; Fri, 13 Jan 2023 07:40:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXvRZJUT2yRQStwlobJ3IQN23bGAKJtbaebdbOMUyQOtceJbg9MFgyi8TCkqum2eIEvmjMj5 X-Received: by 2002:a05:6a00:b48:b0:581:dda:cec3 with SMTP id p8-20020a056a000b4800b005810ddacec3mr84586441pfo.16.1673624434435; Fri, 13 Jan 2023 07:40:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673624434; cv=none; d=google.com; s=arc-20160816; b=sERT9BrjbNVGddqItYkSGwkNzS0KLdSxJV/NGRN0D/ogb/L+RVNltm+gOQxCt+0LSK 3UDk6O//7xI/PwHk+hZrl2qz1Qho/T2y9HacTLxiEDtQNxrTi1Vn5faTE3cDewTP0N00 ubYN98zjld7xz9YN3kXBVe9kCgLIOZ7B/nKwEWc1KQdFfoUrGr/on9QUebr6+lL6igsd adZtqTWDZPWraBIvh9QAOMKXh+DPbsNI0+hdGEv8GOVJsAEP2FLQK+wWd5PSe+jwWkK8 dpTg92jm6Lb8JbZ9R5ivF4Sccj9hkn86KuVNSwh+u4F/nB0ssf4uBLNHj4EBruSsNgiU 8bdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=5Ec9VEpxL0HdQ3ys6pNHqMik91oFBgfMANcke80xD/A=; b=UuEjPcqc96pGXxkdsHFezPK16U3JC7zG6apM1oRkqIQ2/ArQ676xSf4T4vz3IpZ4re s0Z6n6ZORrZHOYow7l/Zhi3OlqRCyo0068ptk27pcvv+gAmNS/LOQo2cmU/b4S7pk1So 7Nno+hg0oL4SdnooPBDm/vT9xz2bCsgbcYU9XXLDCOhRV2zMWrrzNcGe0oHVyPLM9PXG SQPrePytVkU6VsH8nZnCEruqRZ27d1Gx71prnLby0ZHp4S/iqcG5Rp7vzo2v0wkiYwK2 /0GjieOFvRl2nQSxTYW2bVrt5xi3IeY48BTZhl8wZbdld7arr4+n+3vZLLtGT4POGNIc 5IzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ravnborg.org header.s=rsa2 header.b=mNsL6p20; dkim=neutral (no key) header.i=@ravnborg.org header.b=6cLlDT99; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dc8-20020a056a0035c800b005865f3befe1si18056510pfb.15.2023.01.13.07.40.24; Fri, 13 Jan 2023 07:40:34 -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; dkim=pass header.i=@ravnborg.org header.s=rsa2 header.b=mNsL6p20; dkim=neutral (no key) header.i=@ravnborg.org header.b=6cLlDT99; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbjAMPZ6 (ORCPT + 52 others); Fri, 13 Jan 2023 10:25:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbjAMPZf (ORCPT ); Fri, 13 Jan 2023 10:25:35 -0500 Received: from mailrelay5-1.pub.mailoutpod2-cph3.one.com (mailrelay5-1.pub.mailoutpod2-cph3.one.com [IPv6:2a02:2350:5:404::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90EB110540 for ; Fri, 13 Jan 2023 07:17:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa2; h=in-reply-to:content-type:mime-version:references:message-id:subject:cc:to: from:date:from; bh=5Ec9VEpxL0HdQ3ys6pNHqMik91oFBgfMANcke80xD/A=; b=mNsL6p20VOs74QKIu8snpBt8lWcWR1uguGQk7ru7ofSMp35A1oCHYta7HJUwcGkPn561uhzGtVVJb YEwpoJYI/4DSAA9rsapANR3CEi09F9aHr9g5WxkajAP5W6jnF//3HmrSMDtPprhJVlOSbs6u1fVfXI +fRVLa8bFfuNyAYAn8oPQC16RAjHav49Z6s8lJU7F0qwlzMRQhTJnhj3j8SWLPQiZ2UhdCV86FnMA7 +sxRCet5Cx5uBOySOCGPlr9jgr9tQUQzf7MbRfHdOS0wxSgByTW8EqYRNfe28hl8LH0r0p9Tjihwgn mW32T+trR0jdFN7na/nuSwgivwn/j9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed2; h=in-reply-to:content-type:mime-version:references:message-id:subject:cc:to: from:date:from; bh=5Ec9VEpxL0HdQ3ys6pNHqMik91oFBgfMANcke80xD/A=; b=6cLlDT99AqkJuJaJoLKjJ3jWirKVmctGHXRyb6MZW9SNOTVHZRCTbGjd2HjbqxlOIr/XgibkTrpQj cH+L7k4DQ== X-HalOne-ID: 5f693b70-9355-11ed-a136-7703b0afff57 Received: from ravnborg.org (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay5 (Halon) with ESMTPSA id 5f693b70-9355-11ed-a136-7703b0afff57; Fri, 13 Jan 2023 15:17:23 +0000 (UTC) Date: Fri, 13 Jan 2023 16:17:21 +0100 From: Sam Ravnborg To: Deepak R Varma Cc: Guido =?iso-8859-1?Q?G=FCnther?= , Purism Kernel Team , Ondrej Jirman , Thierry Reding , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Saurabh Singh Sengar , Praveen Kumar Subject: Re: [PATCH] drm/panel: st7703: Avoid full proxy f_ops for st7703 debug attributes Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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 On Wed, Jan 11, 2023 at 01:53:34AM +0530, Deepak R Varma wrote: > Using DEFINE_SIMPLE_ATTRIBUTE macro with the debugfs_create_file() > function adds the overhead of introducing a proxy file operation > functions to wrap the original read/write inside file removal protection > functions. This adds significant overhead in terms of introducing and > managing the proxy factory file operations structure and function > wrapping at runtime. > As a replacement, a combination of DEFINE_DEBUGFS_ATTRIBUTE macro paired > with debugfs_create_file_unsafe() is suggested to be used instead. The > DEFINE_DEBUGFS_ATTRIBUTE utilises debugfs_file_get() and > debugfs_file_put() wrappers to protect the original read and write > function calls for the debug attributes. There is no need for any > runtime proxy file operations to be managed by the debugfs core. > Following coccicheck make command helped identify this change: > > make coccicheck M=drivers/gpu/drm/i915/ MODE=patch COCCI=./scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci > > Signed-off-by: Deepak R Varma Acked-by: Sam Ravnborg Anyone up for testing this change? I have never dealt with debugfs so dunno if the chnage will work or not. Sam > --- > Note: Patch compile tested only. > > drivers/gpu/drm/panel/panel-sitronix-st7703.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c > index 86a472b01360..22ed7e2b0e00 100644 > --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c > +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c > @@ -510,15 +510,14 @@ static int allpixelson_set(void *data, u64 val) > return 0; > } > > -DEFINE_SIMPLE_ATTRIBUTE(allpixelson_fops, NULL, > - allpixelson_set, "%llu\n"); > +DEFINE_DEBUGFS_ATTRIBUTE(allpixelson_fops, NULL, allpixelson_set, "%llu\n"); > > static void st7703_debugfs_init(struct st7703 *ctx) > { > ctx->debugfs = debugfs_create_dir(DRV_NAME, NULL); > > - debugfs_create_file("allpixelson", 0600, ctx->debugfs, ctx, > - &allpixelson_fops); > + debugfs_create_file_unsafe("allpixelson", 0600, ctx->debugfs, ctx, > + &allpixelson_fops); > } > > static void st7703_debugfs_remove(struct st7703 *ctx) > -- > 2.34.1 > >