On 11/09/2020 14:33:46+0200, Bartosz Golaszewski wrote: > I'm seeing this pattern elsewhere in the kernel too and I just > recently fixed this for MDIO. I think it's just a matter of people > copy-pasting a bad implementation. > > > was an actual reason this was done this way and it was the ordering of > > the rtc_nvmem_register/rtc_nvmem_unregister with rtc_device_unregister. > > I'm not sure this is still necessary though. > > > > To me - each of these should have their own 'unregister' function and > appropriate devres helpers *OR* RTC-related nvmem structures could be > set up and assigned to struct rtc_device after > devm_rtc_allocate_device() and picked up by the registration function > (and also undone by rtc_unregister_device()). > > I'll try to allocate some time to look into this but it's not like > it's urgent or anything - it's just a potential improvement. > Well, this could simply be done by adding a devres_add in __rtc_register_device. I'm planning to remove rtc_nvmem_unregister after the next LTS which will make that even easier. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com