From patchwork Fri Dec 16 16:07:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 33993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp1054281wrn; Fri, 16 Dec 2022 08:10:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf7I7E3UUhjv7KIMrTRZocQvTBJ0pmwbkz3YSJexP/5RtdDVu4z7ySoiQx6HrcJeuS5hNw2C X-Received: by 2002:a17:907:a50d:b0:7c1:6344:84a with SMTP id vr13-20020a170907a50d00b007c16344084amr34253444ejc.5.1671207009784; Fri, 16 Dec 2022 08:10:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671207009; cv=none; d=google.com; s=arc-20160816; b=tApGYToZGQp36OUzrwerey9Sg40N4rmh9IGYy4pzNIud6Me5s8T+n4EwajopPRDVsq iWb/WkVADZrGIb1Rxkwvm749EPWmDHjZ1ZHqtj338AWa8jZcAo0VmrQnD3Tgd4iEzT/N /TCui129Kd2xX3rhsc2qTG61E6PEkTJEijHpTtyrvpMV4DXmuRxrhO5agFE79f7cg8BB IQkQTc+99LCC88bQRXezuGxudI07sB0fAIX07c+Lrhr5ARSXe3gIG4zWYMnWEakdzznK UZEkVLGVdGPy2DgQhDHR57no0JGjcM0qVMHJ244zVjXqAlVvQgZmgDnDVFx6brVjw0sg wKnQ== 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=gZRwzYWa8LF7OJNf1+225s/eZCUGBXU9jCQ2YqPUC7s=; b=nVfcJIfL7o5eoj32Mmuua1zHE3GHpS24LHLNmW+pZvuiYb2O5ObrJhtTfZNzFu8EhX vz1dVzNSsF3OZv81vEL1rAWYf0M3cgnl9+ZO7qrBZ/0tBafwGT+Ue33q7QuR/Z9rMKHF Xn9noaZ5m+YcSB9QITst1YdQVv6OSVE+3pxinh+CeJj9pzIal0cbgeh+JzI+yq5U7aqz gArQvqlELDSav3XxY6FRazCpncZX2Sa1OtuwrvSQvyDtJDaq605rv3nRJGzAMawfD1GY hVztdsEZq6yz+EojAaf6bFWANty92M9Tua6gBSAzdMdwWD8jwylVHDAsn23Z4dM7UbwJ 8gCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b="XnU/moSq"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb3-20020a170907070300b007adcc8fb7a0si2710067ejb.399.2022.12.16.08.09.47; Fri, 16 Dec 2022 08:10:09 -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="XnU/moSq"; 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 S231767AbiLPQJc (ORCPT + 99 others); Fri, 16 Dec 2022 11:09:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231298AbiLPQJB (ORCPT ); Fri, 16 Dec 2022 11:09:01 -0500 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD8547330 for ; Fri, 16 Dec 2022 08:08:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1671206874; bh=pbGpvULOholZvb5olInn+Fl6NBfMf3MM3SbvamW2d28=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=XnU/moSq/6f6jqdAYoQ9DRaqqQH5af54Tv3y/qlQdHoPi6U1UYeZghrG8suLor2r/ kM6KA4s30gVkYVklrcIQidIbtgMPYiGXBubJEv9i2Cvk8cHqkJB3sryrxHnq2zA9Mo UH5BollB15U0L3WPyrYTezQnpeKueuegGMMOlNNw= Received: by b-3.in.mailobj.net [192.168.90.13] with ESMTP via ip-206.mailobj.net [213.182.55.206] Fri, 16 Dec 2022 17:07:54 +0100 (CET) X-EA-Auth: r6MeKYUR9fyZA/V6ZIIId1y+j07mHDm4LIWLgWKlymZezNqlTBjuWAOPObWQ9e34wUQtjuxU6yiuhxCu1INPd50jxqFtKREG Date: Fri, 16 Dec 2022 21:37:47 +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: [PATCH] drm/i915/gvt: Replace DEFINE_SIMPLE_ATTRIBUTE by DEFINE_DEBUGFS_ATTRIBUTE Message-ID: MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752387560985353925?= X-GMAIL-MSGID: =?utf-8?q?1752387560985353925?= 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 --- Please note: The changes are compile tested only. drivers/gpu/drm/i915/gvt/debugfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.34.1 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); } /**