Hi Pierre-Louis
Thank you for your feedback
=> (A) if (!component->driver->ops || !component->driver->ops->open) continue; => (B) if (component->driver->module_get_upon_open && !try_module_get(component->dev->driver->owner)) { ... }
(snip)
The try_module_get()/module_put() mechanism is based on the assumption that the .open and .close callbacks are both mandatory.
Hi Pierre, But is this enforced? We could end up doing a try_module_get() without checking if there is a close callback in which case we'd never do the module_put(), isnt it?
My initial feedback was that changing the open case only wouldn't work.
We need to enforce that both the open/close callbacks are required and leave the code as is, or we apply both of Morimoto-san's patches (which unfortunately have the same subject to cover the two cases) and both open and close are optional - though I am having a hard time figuring out case where we we'd use one and the other.
If my understanding is correct, the reason why we need to call try_module_get()/module_put() is to checking used component. The component will be used anyway even though it doesn't have .open, I think. So, we need to call these anyway. But yes it should change both .open/.close in the same patch. Then, .open/.close is just optional. I will repost patch.
Thank you for your help !! Best regards --- Kuninori Morimoto