On Mon, Nov 10, 2025 at 06:28:17AM +0000, Tzung-Bi Shih wrote:
It just means the user of this needs to understand there are limitations on what release can do. Usually release just frees memory, that is fine.
I think it would be strange for a release to touch revocable data, that might suggest some larger problem.
I think it'd be inevitable for accessing some devm memory in ->release(), e.g. [1].
[1] https://elixir.bootlin.com/linux/v6.17/source/drivers/platform/chrome/cros_e...
Again, that's symptomatic of a "larger problem" :\
The blocking notifier registration to receive events to relay out to the file descriptors should be part this drivers probe/remove lifecycle so it has the proper lifetime. Trying to use a revocable idea here will create a weirdly unbalanced/dangling blocking notifier registration :(
Inside cros_ec_chardev it should have a simple list of open file descriptors and the single blocking notifier callback can iterate over the list and memdup the events. Then your release is just a simple locked list del on a global list which doesn't have a lifecycle problem.
Jason