Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8379746rwl; Tue, 10 Jan 2023 12:43:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXuRBRR34Or0Uofg562lIcTMqvTfECx1H28XeYrbhSFPLlMmMp8/OgRVLg7ImYg5qY+xKTRH X-Received: by 2002:a62:ed06:0:b0:583:3e7f:a038 with SMTP id u6-20020a62ed06000000b005833e7fa038mr15573776pfh.5.1673383401225; Tue, 10 Jan 2023 12:43:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673383401; cv=none; d=google.com; s=arc-20160816; b=T0toWiy8SrBxU+A5YOuoLR9wYV+V+coSY3eT19o0ZCAYqLGrLbK46FWxPIzoDsx8wL j2hxFASN66Ii4A063Ivd9CB3DcBOmoSC/k4AWVqDl/nPvVkO+clkLedYUKp1KzLNn9lU yhUbNnKMFTpuSMXcGkO7/6JLSaRt21ywUIp0X2jJlWqv8vsDtboFvOL2/nXzKeyk+M7Z Y5P/hqXLB00nUxjP4MXx5K1ckDPnoPcAqHL9E/HXIb/ubnSA6KlrzeQmaKUqEG0jfywH OaQZGt7OdXYtB4k5yj41GeEHqQ4/AZOONct6nOuNW4QNHKP2fPMZWH5OLPNw5c+RN8BX if5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=N6uHBf3UobWVf5LfRBUDJBE5jRXFjmJtzR53m6ozU0U=; b=sg4Zs/0O912FUqYqEy2sFWPuVQbzuRRXXzEfGXYGroTJKuJ04lIN98JxEk5ZU8GCc0 +iTOp7MeOz/mVkbEBo6wAF1EDF2WFP164xysCy9V6UxiAZiRCVya+HO/eo7nSvkyYZ6P PTXBlJaqMw9JdfqbKNqRTSVIt1lQnsi++7asZFPBTmO6iUvZYKaCEoggQX5goDLeAFQI ED26TQaXDN1dc38/hbpO3I4Nc0L/o9D6pNf/k1AJhyDRGKEuM3fcoT9UYJalWX66hXk4 43WdX2zVthbNoeJ7bkluugjEicde/iRXIXX2Wxf8CNVeqHkbNmMkeXwF/5NNUeUhmUVj amLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=CZoF55Er; 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=mailo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020a056a00099200b00582c72e5c4csi12546334pfg.181.2023.01.10.12.43.14; Tue, 10 Jan 2023 12:43:21 -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=fail header.i=@mailo.com header.s=mailo header.b=CZoF55Er; 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=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232868AbjAJUX4 (ORCPT + 55 others); Tue, 10 Jan 2023 15:23:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231948AbjAJUXv (ORCPT ); Tue, 10 Jan 2023 15:23:51 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB0E5D437 for ; Tue, 10 Jan 2023 12:23:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1673382219; bh=KZfzfJaCNSjj2cTY/A9poRlxwbx4f/9t6x9qIyEDr8E=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=CZoF55ErL81RjxfbxOv/AGJIcDveO43CgMfLfYnt8wwGG2dpb8hrAqnhdZldpeusl Z/21vZg3MBNIugKKDxs2twaRgtbDn2ldWvu/AySGUWgYak3YzYdw1chsIb3BkDE57x PmcM+ivZJdxPDDz38imrY69pYS8R3CLSgubKPJRI= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via ip-206.mailobj.net [213.182.55.206] Tue, 10 Jan 2023 21:23:39 +0100 (CET) X-EA-Auth: jYWb5T3M9TX6HZLgkCJh+aXe7wz+hgdymKalfl4XRaUsGWATnEes0XA+xMOkmZgIygg47pBLvZRa8Gb/Wq/ModSHcKL8W0Bd Date: Wed, 11 Jan 2023 01:53:34 +0530 From: Deepak R Varma To: Guido =?iso-8859-1?Q?G=FCnther?= , Purism Kernel Team , Ondrej Jirman , Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar Subject: [PATCH] drm/panel: st7703: Avoid full proxy f_ops for st7703 debug attributes Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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_PASS 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 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 --- 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