mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jagath Jog J <jagathjog1996@gmail.com>
To: mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
	simona@ffwll.ch, mcanal@igalia.com,
	maarten.lankhorst@linux.intel.com
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	jagathjog1996@gmail.com
Subject: [RFC 1/1] drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor and .debugfs_init
Date: Mon, 21 Apr 2025 14:29:07 +0530	[thread overview]
Message-ID: <20250421085907.24972-2-jagathjog1996@gmail.com> (raw)
In-Reply-To: <20250421085907.24972-1-jagathjog1996@gmail.com>

Refactor to use drm_device.debugfs_root instead of drm_minor for
debugfs file creation. The driver can now initialize debugfs directly
in probe(), before drm_dev_register(). This also removes the use of
.debugfs_init callback.

Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com>
---
 drivers/gpu/drm/drm_mipi_dbi.c        | 8 ++++----
 drivers/gpu/drm/tiny/ili9163.c        | 3 ++-
 drivers/gpu/drm/tiny/panel-mipi-dbi.c | 3 ++-
 include/drm/drm_mipi_dbi.h            | 4 ++--
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 89e05a5bed1d..66f292c48a78 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -1488,17 +1488,17 @@ static const struct file_operations mipi_dbi_debugfs_command_fops = {
  *
  * This function creates a 'command' debugfs file for sending commands to the
  * controller or getting the read command values.
- * Drivers can use this as their &drm_driver->debugfs_init callback.
+ * Drivers can call this function before registering their device to drm.
  *
  */
-void mipi_dbi_debugfs_init(struct drm_minor *minor)
+void mipi_dbi_debugfs_init(struct mipi_dbi_dev *dbidev)
 {
-	struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(minor->dev);
 	umode_t mode = S_IFREG | S_IWUSR;
 
 	if (dbidev->dbi.read_commands)
 		mode |= S_IRUGO;
-	debugfs_create_file("command", mode, minor->debugfs_root, dbidev,
+
+	debugfs_create_file("command", mode, dbidev->drm.debugfs_root, dbidev,
 			    &mipi_dbi_debugfs_command_fops);
 }
 EXPORT_SYMBOL(mipi_dbi_debugfs_init);
diff --git a/drivers/gpu/drm/tiny/ili9163.c b/drivers/gpu/drm/tiny/ili9163.c
index 62cadf5e033d..351d2a5b9f27 100644
--- a/drivers/gpu/drm/tiny/ili9163.c
+++ b/drivers/gpu/drm/tiny/ili9163.c
@@ -115,7 +115,6 @@ static struct drm_driver ili9163_driver = {
 	.fops			= &ili9163_fops,
 	DRM_GEM_DMA_DRIVER_OPS_VMAP,
 	DRM_FBDEV_DMA_DRIVER_OPS,
-	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "ili9163",
 	.desc			= "Ilitek ILI9163",
 	.major			= 1,
@@ -182,6 +181,8 @@ static int ili9163_probe(struct spi_device *spi)
 
 	drm_mode_config_reset(drm);
 
+	mipi_dbi_debugfs_init(dbidev);
+
 	ret = drm_dev_register(drm, 0);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
index 0460ecaef4bd..94466dd8db9f 100644
--- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c
+++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
@@ -267,7 +267,6 @@ static const struct drm_driver panel_mipi_dbi_driver = {
 	.fops			= &panel_mipi_dbi_fops,
 	DRM_GEM_DMA_DRIVER_OPS_VMAP,
 	DRM_FBDEV_DMA_DRIVER_OPS,
-	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "panel-mipi-dbi",
 	.desc			= "MIPI DBI compatible display panel",
 	.major			= 1,
@@ -384,6 +383,8 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)
 
 	drm_mode_config_reset(drm);
 
+	mipi_dbi_debugfs_init(dbidev);
+
 	ret = drm_dev_register(drm, 0);
 	if (ret)
 		return ret;
diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h
index f45f9612c0bc..88a9c87a1e99 100644
--- a/include/drm/drm_mipi_dbi.h
+++ b/include/drm/drm_mipi_dbi.h
@@ -230,9 +230,9 @@ int mipi_dbi_buf_copy(void *dst, struct iosys_map *src, struct drm_framebuffer *
 })
 
 #ifdef CONFIG_DEBUG_FS
-void mipi_dbi_debugfs_init(struct drm_minor *minor);
+void mipi_dbi_debugfs_init(struct mipi_dbi_dev *dbidev);
 #else
-static inline void mipi_dbi_debugfs_init(struct drm_minor *minor) {}
+static inline void mipi_dbi_debugfs_init(struct mipi_dbi_dev *dbidev) {}
 #endif
 
 /**
-- 
2.20.1


  reply	other threads:[~2025-04-21  8:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21  8:59 [RFC 0/1] drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor Jagath Jog J
2025-04-21  8:59 ` Jagath Jog J [this message]
2025-04-21 10:29   ` [RFC 1/1] drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor and .debugfs_init Dmitry Baryshkov
2025-04-22 15:25     ` Jagath Jog J
2025-04-23 10:51 ` [RFC 0/1] drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor Maíra Canal
2025-04-24  6:26   ` Jagath Jog J

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250421085907.24972-2-jagathjog1996@gmail.com \
    --to=jagathjog1996@gmail.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mcanal@igalia.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®