[lkml]   [2021]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] regmap: do not call regmap_debugfs_init() from regmap_attach_dev()
On Mon, 2021-07-26 at 13:11 +0100, Mark Brown wrote:
> * PGP Signed by an unknown key
> On Mon, Jul 26, 2021 at 02:01:51PM +0200, Matthias Schiffer wrote:
> > On Mon, 2021-07-26 at 12:47 +0100, Mark Brown wrote:
> > > The use case for regmap_attach_dev() is that there was no device when
> > > the regmap was initially instantiated due to it running very early, we
> > > want to attach the device when we figure out what it is which includes
> > > setting up the debugfs stuff. Whatever is managing to call this with
> > > the same device as has already been set is clearly not that use case.
> > I'm not talking about a case where regmap_attach_dev() is called when
> > there is already a device attached; as far as I can tell such a thing
> > does not happen in current kernel code.
> So in that case how are we managing to create a debugfs file with the
> same name given (which was the problem you were reporting) that the
> device name is embedded in the name of the debugfs file?
> > Please have a look at the commit in the Fixes: tag. The duplicate
> > regmap_debugfs_init() happens even when no device was passed in
> > __regmap_init(), so the regmap_attach_dev() is the first time a device
> > it attached.
> That's not what your patch says it's fixing, your patch says it's
> fixing an attempt to recreate the same directory as we had originally
> (we should probably clean up the one with no device but that's not what
> your commit does). I think what you need to look at here is that we
> store map->debugfs_name and don't overwrite it when the device is
> supplied.

That would be fine if regmap_debugfs_init() didn't do a lot more than
just create the debugfs directory. I'm more concerned about the mutex
and list head initialization that is happening on an already
initialized structure. I haven't looked in detail what the mutex and
list head are used for, but I assume bad things™ are going to happen
when someone is already holding the mutex or using the list.

 \ /
  Last update: 2021-07-26 14:19    [W:0.043 / U:1.984 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site