All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH 47/48] drm: omapdrm: dss: Store the debugfs root directory in struct dss_device
Date: Fri, 13 Oct 2017 17:59:43 +0300	[thread overview]
Message-ID: <20171013145944.26557-48-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20171013145944.26557-1-laurent.pinchart@ideasonboard.com>

As part of an effort to remove the usage of global variables in the
driver, store the debugfs root directory in the dss_device structure
instead of a global variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c |  2 +-
 drivers/gpu/drm/omapdrm/dss/dsi.c   |  8 ++++----
 drivers/gpu/drm/omapdrm/dss/dss.c   | 39 +++++++++++++++++++------------------
 drivers/gpu/drm/omapdrm/dss/dss.h   |  9 ++++++---
 drivers/gpu/drm/omapdrm/dss/hdmi4.c |  3 ++-
 drivers/gpu/drm/omapdrm/dss/hdmi5.c |  3 ++-
 drivers/gpu/drm/omapdrm/dss/venc.c  |  3 ++-
 7 files changed, 37 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index aaf7396f0273..5eacf4cdac54 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -4772,7 +4772,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
 	dispc_set_ops(&dispc_ops);
 	dss->dispc = dispc;
 
-	dispc->debugfs = dss_debugfs_create_file("dispc", dispc_dump_regs,
+	dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs,
 						 dispc);
 
 	return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index c7700dfccc08..48ea5285cf20 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5453,20 +5453,20 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
 	dsi_runtime_put(dsi);
 
 	if (dsi->module_id == 0)
-		dsi->debugfs.regs = dss_debugfs_create_file("dsi1_regs",
+		dsi->debugfs.regs = dss_debugfs_create_file(dss, "dsi1_regs",
 							    dsi1_dump_regs,
 							    &dsi);
 	else
-		dsi->debugfs.regs = dss_debugfs_create_file("dsi2_regs",
+		dsi->debugfs.regs = dss_debugfs_create_file(dss, "dsi2_regs",
 							    dsi2_dump_regs,
 							    &dsi);
 #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
 	if (dsi->module_id == 0)
-		dsi->debugfs.irqs = dss_debugfs_create_file("dsi1_irqs",
+		dsi->debugfs.irqs = dss_debugfs_create_file(dss, "dsi1_irqs",
 							    dsi1_dump_irqs,
 							    &dsi);
 	else
-		dsi->debugfs.irqs = dss_debugfs_create_file("dsi2_irqs",
+		dsi->debugfs.irqs = dss_debugfs_create_file(dss, "dsi2_irqs",
 							    dsi2_dump_irqs,
 							    &dsi);
 #endif
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 5d927dfe0a7f..f4e15850cc9d 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -906,25 +906,23 @@ static int dss_debug_dump_clocks(struct seq_file *s, void *p)
 	return 0;
 }
 
-static struct dentry *dss_debugfs_dir;
-
 static int dss_initialize_debugfs(struct dss_device *dss)
 {
-	dss_debugfs_dir = debugfs_create_dir("omapdss", NULL);
-	if (IS_ERR(dss_debugfs_dir)) {
-		int err = PTR_ERR(dss_debugfs_dir);
+	static struct dentry *dir;
 
-		dss_debugfs_dir = NULL;
-		return err;
-	}
+	dir = debugfs_create_dir("omapdss", NULL);
+	if (IS_ERR(dir))
+		return PTR_ERR(dir);
+
+	dss->debugfs.root = dir;
 
 	return 0;
 }
 
-static void dss_uninitialize_debugfs(void)
+static void dss_uninitialize_debugfs(struct dss_device *dss)
 {
-	if (dss_debugfs_dir)
-		debugfs_remove_recursive(dss_debugfs_dir);
+	if (dss->debugfs.root)
+		debugfs_remove_recursive(dss->debugfs.root);
 }
 
 struct dss_debugfs_entry {
@@ -947,8 +945,10 @@ static const struct file_operations dss_debug_fops = {
 	.release	= single_release,
 };
 
-struct dss_debugfs_entry *dss_debugfs_create_file(const char *name,
-		int (*show_fn)(struct seq_file *s, void *data), void *data)
+struct dss_debugfs_entry *
+dss_debugfs_create_file(struct dss_device *dss, const char *name,
+			int (*show_fn)(struct seq_file *s, void *data),
+			void *data)
 {
 	struct dss_debugfs_entry *entry;
 	struct dentry *d;
@@ -960,7 +960,7 @@ struct dss_debugfs_entry *dss_debugfs_create_file(const char *name,
 	entry->show_fn = show_fn;
 	entry->data = data;
 
-	d = debugfs_create_file(name, 0444, dss_debugfs_dir, entry,
+	d = debugfs_create_file(name, 0444, dss->debugfs.root, entry,
 				&dss_debug_fops);
 	if (IS_ERR(d)) {
 		kfree(entry);
@@ -985,7 +985,7 @@ static inline int dss_initialize_debugfs(struct dss_device *dss)
 {
 	return 0;
 }
-static inline void dss_uninitialize_debugfs(void)
+static inline void dss_uninitialize_debugfs(struct dss_device *dss)
 {
 }
 #endif /* CONFIG_OMAP2_DSS_DEBUGFS */
@@ -1382,9 +1382,10 @@ static int dss_bind(struct device *dev)
 	if (r)
 		goto err_component;
 
-	dss->debugfs.clk = dss_debugfs_create_file("clk", dss_debug_dump_clocks,
+	dss->debugfs.clk = dss_debugfs_create_file(dss, "clk",
+						   dss_debug_dump_clocks, dss);
+	dss->debugfs.dss = dss_debugfs_create_file(dss, "dss", dss_dump_regs,
 						   dss);
-	dss->debugfs.dss = dss_debugfs_create_file("dss", dss_dump_regs, dss);
 
 	pm_set_vt_switch(0);
 
@@ -1511,7 +1512,7 @@ static int dss_probe(struct platform_device *pdev)
 	return 0;
 
 err_debugfs:
-	dss_uninitialize_debugfs();
+	dss_uninitialize_debugfs(dss);
 err_free_dss:
 	kfree(dss);
 	return r;
@@ -1523,7 +1524,7 @@ static int dss_remove(struct platform_device *pdev)
 
 	component_master_del(&pdev->dev, &dss_component_ops);
 
-	dss_uninitialize_debugfs();
+	dss_uninitialize_debugfs(dss);
 	kfree(dss);
 
 	return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
index ceba8441c7cc..76a2561dfd22 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -271,6 +271,7 @@ struct dss_device {
 	const struct dss_features *feat;
 
 	struct {
+		struct dentry *root;
 		struct dss_debugfs_entry *clk;
 		struct dss_debugfs_entry *dss;
 	} debugfs;
@@ -299,12 +300,14 @@ static inline bool dss_mgr_is_lcd(enum omap_channel id)
 
 /* DSS */
 #if defined(CONFIG_OMAP2_DSS_DEBUGFS)
-struct dss_debugfs_entry *dss_debugfs_create_file(const char *name,
-		int (*show_fn)(struct seq_file *s, void *data), void *data);
+struct dss_debugfs_entry *
+dss_debugfs_create_file(struct dss_device *dss, const char *name,
+			int (*show_fn)(struct seq_file *s, void *data),
+			void *data);
 void dss_debugfs_remove_file(struct dss_debugfs_entry *entry);
 #else
 static inline struct dss_debugfs_entry *
-dss_debugfs_create_file(const char *name,
+dss_debugfs_create_file(struct dss_device *dss, const char *name,
 			int (*show_fn)(struct seq_file *s, void *data),
 			void *data)
 {
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 2050601fef0a..f523b426420f 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -800,7 +800,8 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
 		return r;
 	}
 
-	hdmi->debugfs = dss_debugfs_create_file("hdmi", hdmi_dump_regs, hdmi);
+	hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
+						hdmi);
 
 	return 0;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index ec3b044925d0..9017d78a9756 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -794,7 +794,8 @@ static int hdmi5_bind(struct device *dev, struct device *master, void *data)
 		return r;
 	}
 
-	hdmi->debugfs = dss_debugfs_create_file("hdmi", hdmi_dump_regs, hdmi);
+	hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
+						hdmi);
 
 	return 0;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index 449a82b84d03..5e475cafb7a4 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -940,7 +940,8 @@ static int venc_bind(struct device *dev, struct device *master, void *data)
 		goto err_probe_of;
 	}
 
-	venc->debugfs = dss_debugfs_create_file("venc", venc_dump_regs, venc);
+	venc->debugfs = dss_debugfs_create_file(dss, "venc", venc_dump_regs,
+						venc);
 
 	venc_init_output(venc);
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-10-13 15:00 UTC|newest]

Thread overview: 114+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 14:58 [PATCH 00/48] omapdrm: Merge omapdrm and omapdss Laurent Pinchart
2017-10-13 14:58 ` [PATCH 01/48] drm: omapdrm: dpi: Don't treat GPIO probe deferral as an error Laurent Pinchart
2017-10-14 12:11   ` Sebastian Reichel
2017-10-13 14:58 ` [PATCH 02/48] drm: omapdrm: Pass drm_device to omap_gem_resume() Laurent Pinchart
2017-10-14 12:15   ` Sebastian Reichel
2017-10-13 14:58 ` [PATCH 03/48] drm: omapdrm: Remove unused omap_dss_find_device() function Laurent Pinchart
2017-10-14 12:16   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 04/48] drm: omapdrm: Merge the omapdss and omapdss-base modules Laurent Pinchart
2017-10-14 12:22   ` Sebastian Reichel
2017-10-16  9:04     ` Laurent Pinchart
2017-10-18  9:19   ` Tomi Valkeinen
2017-10-18 12:28     ` Laurent Pinchart
2017-10-13 14:59 ` [PATCH 05/48] drm: omapdrm: dss: Set the DMA coherent mask Laurent Pinchart
2017-10-14 12:24   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 06/48] drm: omapdrm: dss: Make dss_dump_clocks() function static Laurent Pinchart
2017-10-14 12:24   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 07/48] drm: omapdrm: dpi: Remove dpi_data port_initialized field Laurent Pinchart
2017-10-14 12:28   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 08/48] drm: omapdrm: venc: Return error code on OF parsing failure Laurent Pinchart
2017-10-14 12:29   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 09/48] drm: omapdrm: Deconstruct the omap_drv.h header Laurent Pinchart
2017-10-17 22:25   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 10/48] drm: omapdrm: Use kernel integer types Laurent Pinchart
2017-10-14 12:34   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 11/48] drm: omapdrm: Use unsigned int type Laurent Pinchart
2017-10-14 12:37   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 12/48] drm: omapdrm: Split init and cleanup from probe and remove functions Laurent Pinchart
2017-10-14 12:41   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 13/48] drm: omapdrm: connector-analog-tv: Remove tvc_of_match forward declaration Laurent Pinchart
2017-10-14 12:42   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 14/48] drm: omapdrm: displays: Remove OF node check in connector drivers Laurent Pinchart
2017-10-14 12:43   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 15/48] drm: omapdrm: displays: Remove OF node check in encoder drivers Laurent Pinchart
2017-10-14 12:44   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 16/48] drm: omapdrm: displays: Remove OF node check in panel drivers Laurent Pinchart
2017-10-14 12:45   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 17/48] drm: omapdrm: displays: Get connector source at connect time Laurent Pinchart
2017-10-14 12:51   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 18/48] drm: omapdrm: displays: Get panel " Laurent Pinchart
2017-10-14 12:55   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 19/48] drm: omapdrm: displays: Get encoder " Laurent Pinchart
2017-10-14 12:58   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 20/48] drm: omapdrm: Merge the omapdrm and omapdss drivers Laurent Pinchart
2017-10-14 13:12   ` Sebastian Reichel
2017-10-16  9:09     ` Laurent Pinchart
2017-10-13 14:59 ` [PATCH 21/48] drm: omapdrm: dss: Support passing private data to debugfs show handlers Laurent Pinchart
2017-10-15 21:10   ` Sebastian Reichel
2017-10-16  9:11     ` Laurent Pinchart
2017-10-13 14:59 ` [PATCH 22/48] drm: omapdrm: dss: Pass DSS private structure to runtime PM functions Laurent Pinchart
2017-10-16  8:39   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 23/48] drm: omapdrm: dss: Pass PLL pointer to dss_ctrl_pll_enable() Laurent Pinchart
2017-10-16  8:42   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 24/48] drm: omapdrm: sdi: Pass DSS pointer to dss_sdi_*() functions Laurent Pinchart
2017-10-16  8:47   ` Sebastian Reichel
2017-10-16  9:03     ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 25/48] drm: omapdrm: dss: Pass DSS pointer to dss_ops operations Laurent Pinchart
2017-10-16  9:05   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 26/48] drm: omapdrm: dss: Pass DSS pointer to dss_get_*_clk_source() Laurent Pinchart
2017-10-16  9:08   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 27/48] drm: omapdrm: dss: Pass DSS pointer to dss clock functions Laurent Pinchart
2017-10-16  9:12   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 28/48] drm: omapdrm: dss: Pass DSS pointer to remaining dss functions Laurent Pinchart
2017-10-16  9:15   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 29/48] drm: omapdrm: dss: Remove dss_get_hdmi_venc_clk_source() function Laurent Pinchart
2017-10-16  9:16   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 30/48] drm: omapdrm: dss: Allocate the DSS private data structure dynamically Laurent Pinchart
2017-10-16  9:39   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 31/48] drm: omapdrm: hdmi4: Allocate the omap_hdmi " Laurent Pinchart
2017-10-16 10:19   ` Sebastian Reichel
2017-10-16 10:27   ` Sebastian Reichel
2017-10-16 11:17     ` Laurent Pinchart
2017-10-13 14:59 ` [PATCH 32/48] drm: omapdrm: hdmi5: " Laurent Pinchart
2017-10-17 18:52   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 33/48] drm: omapdrm: venc: Allocate the venc private " Laurent Pinchart
2017-10-17 18:52   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 34/48] drm: omapdrm: sdi: Allocate the sdi " Laurent Pinchart
2017-10-17 19:09   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 35/48] drm: omapdrm: dsi: Make wait_for_bit_change() return a status Laurent Pinchart
2017-10-17 19:12   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 36/48] drm: omapdrm: dsi: Pass the dsi_data pointer to internal functions Laurent Pinchart
2017-10-17 20:02   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 37/48] drm: omapdrm: dsi: Combine two commonly used inline functions Laurent Pinchart
2017-10-17 20:06   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 38/48] drm: omapdrm: dsi: Use dev pointer directly in dsi_bind() function Laurent Pinchart
2017-10-17 20:08   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 39/48] drm: omapdrm: dsi: Store the struct device pointer in struct dsi_data Laurent Pinchart
2017-10-17 20:11   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 40/48] drm: omapdrm: dsi: Don't pass channel to dispc init/uninit functions Laurent Pinchart
2017-10-17 20:13   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 41/48] drm: omapdrm: dss: Pass omap_dss_device pointer to dss_mgr_*() functions Laurent Pinchart
2017-10-17 20:31   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 42/48] drm: omapdrm: dss: Remove unused functions prototypes Laurent Pinchart
2017-10-17 20:37   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 43/48] drm: omapdrm: dss: Pass omap_drm_private pointer to dss_mgr_ops Laurent Pinchart
2017-10-17 21:23   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 44/48] drm: omapdrm: dispc: Pass DISPC pointer to dispc_ops operations Laurent Pinchart
2017-10-17 21:23   ` Sebastian Reichel
2017-10-13 14:59 ` [PATCH 45/48] drm: omapdrm: dispc: Pass DISPC pointer to remaining dispc API functions Laurent Pinchart
2017-10-17 21:24   ` Sebastian Reichel
2017-10-17 21:44     ` Laurent Pinchart
2017-10-13 14:59 ` [PATCH 46/48] drm: omapdrm: dispc: Allocate the dispc private data structure dynamically Laurent Pinchart
2017-10-17 22:09   ` Sebastian Reichel
2017-10-13 14:59 ` Laurent Pinchart [this message]
2017-10-17 22:16   ` [PATCH 47/48] drm: omapdrm: dss: Store the debugfs root directory in struct dss_device Sebastian Reichel
2017-10-17 22:34     ` Laurent Pinchart
2017-10-13 14:59 ` [PATCH 48/48] drm: omapdrm: dss: Store the registered plls array " Laurent Pinchart
2017-10-17 22:21   ` Sebastian Reichel
2017-10-17 22:29 ` [PATCH 00/48] omapdrm: Merge omapdrm and omapdss Sebastian Reichel
2017-10-17 22:36   ` Laurent Pinchart
2017-10-18  9:46 ` Tomi Valkeinen
2017-10-18  9:56   ` Tomi Valkeinen
2018-01-19  3:48     ` Laurent Pinchart
2017-10-18 12:56 ` Tomi Valkeinen
2017-12-01 12:55 ` Tomi Valkeinen

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=20171013145944.26557-48-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tomi.valkeinen@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.