Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp609901rwj; Fri, 23 Dec 2022 06:00:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXs95h/MnkgViFI5Etsmie+S2CkOMe8Tn6tqGJ+x2Oo9xunUNKURnNFcPrvbGNkHEIGgdTzN X-Received: by 2002:a05:6a00:419b:b0:578:9708:887a with SMTP id ca27-20020a056a00419b00b005789708887amr10592258pfb.8.1671804020146; Fri, 23 Dec 2022 06:00:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671804020; cv=none; d=google.com; s=arc-20160816; b=Lrg3Z+HoRh3tSzxQuJhBk5J8lN3iIdRGc4N6rSGguSfBQtw+Qj4kFOaR2dXoVVjOhC +r7QdcDuKzrsIRZSOHlcqPPnRz0PiwzWhQcgmsTostD3tOvI4SiNIoR21BxaNSheHsgG jDfkgFyBKc+DWjQ3OTlyEKIICK7TVCfTmATkhWencJ9oyzJ2scCdHQEcg5lL9XmQTc0U yHCqldpgpOkaAPtRtVFcCLPDbA9UDwJ+N7eu9MK0Le1wuX5x6TYPZOu+xx4nhuE/7CW/ 4FPB+ePxC4yfKa96r+NG2qp4wLZsjTvrqNYh3mFvmE6wlH7i2tYlnKxxFZHN9RsMPuBD Bzww== 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; bh=Z33o5stdNUByHqCuaPpBHVr0QlW9FhPMP1TI/VfuiTM=; b=rMuqGXWO+LKM9+5Ra/KD/159/y7szZAtfTSe10ykPJ3n9Hg8Gjt2VZ3X9YU2I8UgrU dRXNUoFoKav14dA+0FZNCheXqt6ZXdhsDbkm6qA5g6fQ81Vq3ALqybQ9jfYjFmoDcNcw 4vHmJHgwWS75KTkg1lgscRdY5Wp5leo9Y86hAu6DaBbqa4GS5clfdIXzghaxpnluA9Pp yFHi9+6mcu8IBkGsqN5vB/XJj3k2wWA6SwbrxdupR1m8UdUzXc33MDz3ac4+B5emdWTy 4jof8iwYVEOEDIUl+tn1ZM4G/ku3lgFZDtQgPLCM7mIBNxKL9k50oZIk93Pq+nFIfmQw ZJNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=n1B1LDqv; 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 h4-20020a056a00170400b00563960fdb21si3687357pfc.260.2022.12.23.06.00.10; Fri, 23 Dec 2022 06:00:20 -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=n1B1LDqv; 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 S236350AbiLWNal (ORCPT + 65 others); Fri, 23 Dec 2022 08:30:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236336AbiLWNaj (ORCPT ); Fri, 23 Dec 2022 08:30:39 -0500 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0529B1ED for ; Fri, 23 Dec 2022 05:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1671802212; bh=hh/P3iw4eBs4c5XAeMc1qUpSafty1+QfORKyRMiRZao=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=n1B1LDqv6ibhdD+F1if+LE9+mv3hvjRnOo21E/+Buuu/QjyNmPF3pI3b5VtGru07X VGsjkCkaavKuJamlbNN2SaDCwCy23PBBGErKX7Z/88J6wW0Pia1zIq+U4IlMCgJeqU a+62jC2eDd1Lu8pE9/6K/+aCv/S11cQ/Pe3OnoWM= Received: by b-4.in.mailobj.net [192.168.90.14] with ESMTP via ip-206.mailobj.net [213.182.55.206] Fri, 23 Dec 2022 14:30:12 +0100 (CET) X-EA-Auth: MYGhqpJwe1OkJiLuBz/mYu+NlbOxDTxwSvtBnShGmqmsf/chpNNZBWpBSU29/z8cdyBFOs/MbjLq++Sv/DHCZGsYyjHVbdB5 Date: Fri, 23 Dec 2022 19:00:05 +0530 From: Deepak R Varma To: Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , drv@mailo.com Subject: Re: [PATCH] drm/i915/gvt: Replace DEFINE_SIMPLE_ATTRIBUTE by DEFINE_DEBUGFS_ATTRIBUTE 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_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 On Fri, Dec 16, 2022 at 09:37:47PM +0530, Deepak R Varma wrote: > The DEFINE_DEBUGFS_ATTRIBUTE macro has implementation for protecting the > read/write file operations from removal race conditions. This further > enables using debugfs_create_file_unsafe() function since there is no need > for a proxy file operations struct for protection. Hence replace the > DEFINE_SIMPLE_ATTRIBUTE macro by DEFINE_DEBUGFS_ATTRIBUTE and the > debugfs_create_file() by the lightweight debugfs_create_file_unsafe() > versions. > > This issue was identified using the coccinelle debugfs_simple_attr.cocci > semantic patch. > > Signed-off-by: Deepak R Varma Hello, May I please request a review and feedback on this change proposal? Thank you, ./drv > --- > Please note: The changes are compile tested only. > > drivers/gpu/drm/i915/gvt/debugfs.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gvt/debugfs.c b/drivers/gpu/drm/i915/gvt/debugfs.c > index 9f1c209d9251..a45a43c35a6b 100644 > --- a/drivers/gpu/drm/i915/gvt/debugfs.c > +++ b/drivers/gpu/drm/i915/gvt/debugfs.c > @@ -147,9 +147,9 @@ vgpu_scan_nonprivbb_set(void *data, u64 val) > return 0; > } > > -DEFINE_SIMPLE_ATTRIBUTE(vgpu_scan_nonprivbb_fops, > - vgpu_scan_nonprivbb_get, vgpu_scan_nonprivbb_set, > - "0x%llx\n"); > +DEFINE_DEBUGFS_ATTRIBUTE(vgpu_scan_nonprivbb_fops, > + vgpu_scan_nonprivbb_get, vgpu_scan_nonprivbb_set, > + "0x%llx\n"); > > /** > * intel_gvt_debugfs_add_vgpu - register debugfs entries for a vGPU > @@ -165,8 +165,8 @@ void intel_gvt_debugfs_add_vgpu(struct intel_vgpu *vgpu) > debugfs_create_bool("active", 0444, vgpu->debugfs, &vgpu->active); > debugfs_create_file("mmio_diff", 0444, vgpu->debugfs, vgpu, > &vgpu_mmio_diff_fops); > - debugfs_create_file("scan_nonprivbb", 0644, vgpu->debugfs, vgpu, > - &vgpu_scan_nonprivbb_fops); > + debugfs_create_file_unsafe("scan_nonprivbb", 0644, vgpu->debugfs, vgpu, > + &vgpu_scan_nonprivbb_fops); > } > > /** > -- > 2.34.1 >