From patchwork Mon Jan 9 11:55:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13093327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84A0EC54EBD for ; Mon, 9 Jan 2023 11:57:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A41A10E3EF; Mon, 9 Jan 2023 11:57:05 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0025910E3F5; Mon, 9 Jan 2023 11:57:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=pqrbe98U4HcSnwGLvvhdazB5yysESNupfHxO+pMz1ZE=; b=KflhDs1qTn+6jqSQ7LoZsd4D66 RaIDI2FJDtyIH+qyWjDgFL+n0lNV6A90P1yTN67+LqKHF/nipmohwrSKL7SRcf7Ht+0CMmT3BlbeN VH8QxjQoM5ikIsOEVyzeMGAobyBLkNJiy9x8ODjXKXveBeXKJY3Xu69WkhvmszHUqlV2ut6141i6A SHyf7CCv4H/1y4reB8pLulGB7eJ5xDlH2BL3lBjCChj5pEnwrVA8hHTPX+Vmy5DwEDp9yaDBJdNko sXuiZUlBM/xf4Skibb4reNUcLdulO4t6oxAhdJ6IG/d3Eks14VSaATkc/ghktyZZq1dMGcCUg6ULU PzYD7uCg==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pEqlp-003LkJ-QR; Mon, 09 Jan 2023 12:56:54 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: David Airlie , Daniel Vetter , Lucas Stach , Russell King , Christian Gmeiner , Emma Anholt , Alexey Brodkin , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Tomi Valkeinen Subject: [PATCH v2 4/7] drm/virtio: use new debugfs device-centered functions Date: Mon, 9 Jan 2023 08:55:18 -0300 Message-Id: <20230109115520.40088-5-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230109115520.40088-1-mcanal@igalia.com> References: <20230109115520.40088-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , Daniel Vetter , =?utf-8?q?Ma=C3=ADra_Canal?= , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Melissa Wen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_create_files() with the new drm_debugfs_add_files() function, which centers the debugfs files management on the drm_device instead of drm_minor. Moreover, remove the debugfs_init hook and add the debugfs files directly on virtio_gpu_probe(), before drm_dev_register(). Reviewed-by: Daniel Vetter Signed-off-by: MaĆ­ra Canal --- drivers/gpu/drm/virtio/virtgpu_debugfs.c | 17 +++++++---------- drivers/gpu/drm/virtio/virtgpu_drv.c | 5 ++--- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c index 853dd9aa397e..91c81b7429cc 100644 --- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c +++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c @@ -68,8 +68,8 @@ static int virtio_gpu_features(struct seq_file *m, void *data) static int virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct virtio_gpu_device *vgdev = node->minor->dev->dev_private; + struct drm_debugfs_entry *entry = m->private; + struct virtio_gpu_device *vgdev = entry->dev->dev_private; seq_printf(m, "fence %llu %lld\n", (u64)atomic64_read(&vgdev->fence_drv.last_fence_id), @@ -80,8 +80,8 @@ virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data) static int virtio_gpu_debugfs_host_visible_mm(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *)m->private; - struct virtio_gpu_device *vgdev = node->minor->dev->dev_private; + struct drm_debugfs_entry *entry = m->private; + struct virtio_gpu_device *vgdev = entry->dev->dev_private; struct drm_printer p; if (!vgdev->has_host_visible) { @@ -94,7 +94,7 @@ virtio_gpu_debugfs_host_visible_mm(struct seq_file *m, void *data) return 0; } -static struct drm_info_list virtio_gpu_debugfs_list[] = { +static struct drm_debugfs_info virtio_gpu_debugfs_list[] = { { "virtio-gpu-features", virtio_gpu_features }, { "virtio-gpu-irq-fence", virtio_gpu_debugfs_irq_info, 0, NULL }, { "virtio-gpu-host-visible-mm", virtio_gpu_debugfs_host_visible_mm }, @@ -102,10 +102,7 @@ static struct drm_info_list virtio_gpu_debugfs_list[] = { #define VIRTIO_GPU_DEBUGFS_ENTRIES ARRAY_SIZE(virtio_gpu_debugfs_list) -void -virtio_gpu_debugfs_init(struct drm_minor *minor) +void virtio_gpu_debugfs_init(struct drm_device *drm) { - drm_debugfs_create_files(virtio_gpu_debugfs_list, - VIRTIO_GPU_DEBUGFS_ENTRIES, - minor->debugfs_root, minor); + drm_debugfs_add_files(drm, virtio_gpu_debugfs_list, VIRTIO_GPU_DEBUGFS_ENTRIES); } diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c index ae97b98750b6..83aa77e5893b 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.c +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c @@ -98,6 +98,8 @@ static int virtio_gpu_probe(struct virtio_device *vdev) if (ret) goto err_free; + virtio_gpu_debugfs_init(dev); + ret = drm_dev_register(dev, 0); if (ret) goto err_deinit; @@ -179,9 +181,6 @@ static const struct drm_driver driver = { .dumb_create = virtio_gpu_mode_dumb_create, .dumb_map_offset = virtio_gpu_mode_dumb_mmap, -#if defined(CONFIG_DEBUG_FS) - .debugfs_init = virtio_gpu_debugfs_init, -#endif .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_mmap = drm_gem_prime_mmap, diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index af6ffb696086..fe90f0959063 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -472,7 +472,7 @@ struct drm_gem_object *virtgpu_gem_prime_import_sg_table( struct sg_table *sgt); /* virtgpu_debugfs.c */ -void virtio_gpu_debugfs_init(struct drm_minor *minor); +void virtio_gpu_debugfs_init(struct drm_device *drm); /* virtgpu_vram.c */ bool virtio_gpu_is_vram(struct virtio_gpu_object *bo);