Hi again, On Sat, Jan 25, 2025 at 09:42:29AM -0800, Guenter Roeck wrote: > Hi Wolfram, > > when playing with this, I noticed that the i2c debugfs directory and with it > the files located within are only removed when i2c_unregister_device() is called. > Unfortunately, that function is not [necessarily] called when a driver is unloaded > (for example by executing "modprobe -r"), leaving the debugfs files in place. > If the driver is then loaded again, the old debugfs files still exist, referencing > the previous instance of the driver. > > I don't know if this happens all the time, but it does happen if a driver > which was instantiated using the new_device method is unloaded with modprobe -r. > > Right now that means that the driver has to delete each individual debugfs file > it created when exiting, but I think that defeats the purpose of the entire exercise > since it would make drivers more complicated. > > Do you have an idea how to handle this ? > I don't know if my rationale is correct, but the attached patch fixes the problem for me. Guenter ---