summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/omapdrm/dss/dispc.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2018-02-13 15:00:29 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2018-03-01 10:18:18 +0300
commitf33656e1fe5aba0ac0d35e18d90121dd894611ca (patch)
tree58c04da2428aef40799a2bd38da3eecaa73dbc9f /drivers/gpu/drm/omapdrm/dss/dispc.c
parent360c21533ce79981bd9802622dd0b7a0dcd81395 (diff)
downloadlinux-f33656e1fe5aba0ac0d35e18d90121dd894611ca.tar.xz
drm: omapdrm: dss: Support passing private data to debugfs show handlers
To simplify implementation of debugfs seq_file show handlers, the driver passes the pointer to the show function through the debugfs_create_file data pointer. This prevents using the pointer to pass driver private data to the show handler, and requires all handlers to use global variables to access private data. To prepare for the removal of global private data in the driver, rework the debugfs infrastructure to allow passing a private data pointer to show handlers. The price to pay is explicit removal of debugfs files to free the internally allocated memory. This is desirable anyway as debugfs entries should be removed when a component driver is unbound, otherwise crashes will occur due to access to freed memory when the components will be dynamically allocated instead of stored in global variables. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/dss/dispc.c')
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dispc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 867887151565..3428ffea70ee 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -167,6 +167,8 @@ static struct {
void __iomem *base;
struct dss_device *dss;
+ struct dss_debugfs_entry *debugfs;
+
int irq;
irq_handler_t user_handler;
void *user_data;
@@ -3268,7 +3270,7 @@ void dispc_dump_clocks(struct seq_file *s)
dispc_runtime_put();
}
-static void dispc_dump_regs(struct seq_file *s)
+static int dispc_dump_regs(struct seq_file *s, void *p)
{
int i, j;
const char *mgr_names[] = {
@@ -3289,7 +3291,7 @@ static void dispc_dump_regs(struct seq_file *s)
#define DUMPREG(r) seq_printf(s, "%-50s %08x\n", #r, dispc_read_reg(r))
if (dispc_runtime_get())
- return;
+ return 0;
/* DISPC common registers */
DUMPREG(DISPC_REVISION);
@@ -3461,6 +3463,8 @@ static void dispc_dump_regs(struct seq_file *s)
#undef DISPC_REG
#undef DUMPREG
+
+ return 0;
}
/* calculate clock rates using dividers in cinfo */
@@ -4620,7 +4624,8 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
dispc_set_ops(&dispc_ops);
- dss_debugfs_create_file("dispc", dispc_dump_regs);
+ dispc.debugfs = dss_debugfs_create_file("dispc", dispc_dump_regs,
+ &dispc);
return 0;
@@ -4632,6 +4637,8 @@ err_runtime_get:
static void dispc_unbind(struct device *dev, struct device *master,
void *data)
{
+ dss_debugfs_remove_file(dispc.debugfs);
+
dispc_set_ops(NULL);
pm_runtime_disable(dev);