[PATCH 21/48] drm: omapdrm: dss: Support passing private data to debugfs show handlers

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Oct 16 09:11:24 UTC 2017


Hi Sebastian,

On Monday, 16 October 2017 00:10:19 EEST Sebastian Reichel wrote:
> On Fri, Oct 13, 2017 at 05:59:17PM +0300, Laurent Pinchart wrote:
> > 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 at ideasonboard.com>
> > ---
> 
> Reviewed-by: Sebastian Reichel <sebastian.reichel at collabora.co.uk>
> 
> (One nit-pick in dss.h, see below)
> 
> -- Sebastian
> 
> >  drivers/gpu/drm/omapdrm/dss/dispc.c | 13 ++++--
> >  drivers/gpu/drm/omapdrm/dss/dsi.c   | 40 +++++++++++-----
> >  drivers/gpu/drm/omapdrm/dss/dss.c   | 92 +++++++++++++++++++++-----------
> >  drivers/gpu/drm/omapdrm/dss/dss.h   | 27 +++++++----
> >  drivers/gpu/drm/omapdrm/dss/hdmi.h  |  2 +
> >  drivers/gpu/drm/omapdrm/dss/hdmi4.c |  9 ++--
> >  drivers/gpu/drm/omapdrm/dss/hdmi5.c |  9 ++--
> >  drivers/gpu/drm/omapdrm/dss/venc.c  | 11 +++--
> >  8 files changed, 140 insertions(+), 63 deletions(-)

[snip]

> > diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h
> > b/drivers/gpu/drm/omapdrm/dss/dss.h index db529481b364..e688e937da28
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> > +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> > @@ -27,6 +27,11 @@
> > 
> >  #include "omapdss.h"
> > 
> > +struct dentry;
> 
> You can drop this one. It is not used in dss.h.

Indeed, it's a leftover from a previous version where I was still exposing 
struct dentry. I'll remove it in v2.

> > +struct dss_debugfs_entry;
> > +struct platform_device;
> > +struct seq_file;

[snip]

-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list