Re: [alsa-devel] [RFC PATCH 04/40] soundwire: intel: add debugfs register dump
On Fri, Jul 26, 2019 at 09:00:28AM -0500, Pierre-Louis Bossart wrote: > > > On 7/26/19 4:35 AM, Cezary Rojewski wrote: > > On 2019-07-26 01:39, Pierre-Louis Bossart wrote: > > > +static void intel_debugfs_init(struct sdw_intel *sdw) > > > +{ > > > + struct dentry *root = sdw->cdns.bus.debugfs; > > > + > > > + if (!root) > > > + return; > > > + > > > + sdw->fs = debugfs_create_dir("intel-sdw", root); > > > + if (IS_ERR_OR_NULL(sdw->fs)) { > > > + dev_err(sdw->cdns.dev, "debugfs root creation failed\n"); > > > + sdw->fs = NULL; > > > + return; > > > + } > > > + > > > + debugfs_create_file("intel-registers", 0400, sdw->fs, sdw, > > > + _reg_fops); > > > + > > > + sdw_cdns_debugfs_init(>cdns, sdw->fs); > > > +} > > > > I believe there should be dummy equivalent of _init and _exit if debugfs > > is not enabled (if these are defined already and I've missed it, please > > ignore). > > I think the direction is just to keep going if there is an error or debufs > is not enabled. You should not care either way :)
Re: [alsa-devel] [RFC PATCH 04/40] soundwire: intel: add debugfs register dump
On 7/26/19 4:35 AM, Cezary Rojewski wrote: On 2019-07-26 01:39, Pierre-Louis Bossart wrote: +static void intel_debugfs_init(struct sdw_intel *sdw) +{ + struct dentry *root = sdw->cdns.bus.debugfs; + + if (!root) + return; + + sdw->fs = debugfs_create_dir("intel-sdw", root); + if (IS_ERR_OR_NULL(sdw->fs)) { + dev_err(sdw->cdns.dev, "debugfs root creation failed\n"); + sdw->fs = NULL; + return; + } + + debugfs_create_file("intel-registers", 0400, sdw->fs, sdw, + _reg_fops); + + sdw_cdns_debugfs_init(>cdns, sdw->fs); +} I believe there should be dummy equivalent of _init and _exit if debugfs is not enabled (if these are defined already and I've missed it, please ignore). I think the direction is just to keep going if there is an error or debufs is not enabled. +static void intel_debugfs_exit(struct sdw_intel *sdw) +{ + debugfs_remove_recursive(sdw->fs); +}