diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2018-02-13 14:00:29 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2018-03-01 09:18:18 +0200 |
commit | f33656e1fe5aba0ac0d35e18d90121dd894611ca (patch) | |
tree | 58c04da2428aef40799a2bd38da3eecaa73dbc9f /drivers/gpu/drm/omapdrm/dss/hdmi4.c | |
parent | 360c21533ce79981bd9802622dd0b7a0dcd81395 (diff) |
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/hdmi4.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/hdmi4.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index 3e4a5cf2d06f..e528b7a223e1 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c @@ -303,13 +303,13 @@ static void hdmi_display_get_timings(struct omap_dss_device *dssdev, *vm = hdmi.cfg.vm; } -static void hdmi_dump_regs(struct seq_file *s) +static int hdmi_dump_regs(struct seq_file *s, void *p) { mutex_lock(&hdmi.lock); if (hdmi_runtime_get()) { mutex_unlock(&hdmi.lock); - return; + return 0; } hdmi_wp_dump(&hdmi.wp, s); @@ -319,6 +319,7 @@ static void hdmi_dump_regs(struct seq_file *s) hdmi_runtime_put(); mutex_unlock(&hdmi.lock); + return 0; } static int read_edid(u8 *buf, int len) @@ -779,7 +780,7 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data) return r; } - dss_debugfs_create_file("hdmi", hdmi_dump_regs); + hdmi.debugfs = dss_debugfs_create_file("hdmi", hdmi_dump_regs, &hdmi); return 0; err: @@ -791,6 +792,8 @@ static void hdmi4_unbind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev = to_platform_device(dev); + dss_debugfs_remove_file(hdmi.debugfs); + if (hdmi.audio_pdev) platform_device_unregister(hdmi.audio_pdev); |