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.