i2c: core: document preference for i2c_get_adapter_by_fwnode()
Subsystems (2)
PATCH 1/1 i2c: core: document preference for i2c_get_adapter_by_fwnode()
The i2c subsystem currently blocks during adapter deregistration whenever there are consumers holding a reference.
Document that i2c_get_adapter_by_fwnode(), which also takes a module reference, should almost always be preferred over i2c_find_adapter_by_fwnode() so that an attempt to unload the adapter module while in use fails gracefully instead of blocking uninterruptibly.
Note that by implication of_get_i2c_adapter_by_node() is also generally preferred over of_find_i2c_adapter_by_node().
--- drivers/i2c/i2c-core-base.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/i2c/i2c-core-base.c +3 -0
@@ -1895,6 +1895,9 @@ static int i2c_dev_or_parent_fwnode_match(struct device *dev, const void *data)* If no adapter can be found, or @fwnode is NULL, this returns NULL. * * The user must call put_device(&adapter->dev) once done with the i2c adapter. +* +* Note that i2c_get_adapter_by_fwnode(), which also takes a module reference, +* should almost always be used instead of this one. */ struct i2c_adapter *i2c_find_adapter_by_fwnode (struct fwnode_handle *fwnode) {
Signature · 1 line
2.54.0
Quoted 9 lines · Johan Hovold
The i2c subsystem currently blocks during adapter deregistration whenever there are consumers holding a reference.
Document that
i2c_get_adapter_by_fwnode(), which also takes a module reference, should almost always be preferred overi2c_find_adapter_by_fwnode()so that an attempt to unload the adapter module while in use fails gracefully instead of blocking uninterruptibly.
Quoted 4 lines
Note that by implication
of_get_i2c_adapter_by_node()is also generally preferred overof_find_i2c_adapter_by_node().Signed-off-by Johan Hovold <[email protected]>
Andi, I would suggest to apply it to for-current even, because this is an important doc update, but I'll leave it to you, of course.
Quoted 13 lines · Wolfram Sang
Quoted 12 lines · Johan Hovold
The i2c subsystem currently blocks during adapter deregistration whenever there are consumers holding a reference.
Document that
i2c_get_adapter_by_fwnode(), which also takes a module reference, should almost always be preferred overi2c_find_adapter_by_fwnode()so that an attempt to unload the adapter module while in use fails gracefully instead of blocking uninterruptibly.Note that by implication
of_get_i2c_adapter_by_node()is also generally preferred overof_find_i2c_adapter_by_node().
Quoted 6 lines
Quoted 1 line
Signed-off-by Johan Hovold <[email protected]>Reviewed-by Wolfram Sang <[email protected]>Andi, I would suggest to apply it to for-current even, because this is an important doc update, but I'll leave it to you, of course.
Can this one be picked up now?
Johan
Quoted 10 lines · Wolfram Sang
Quoted 9 lines · Johan Hovold
The i2c subsystem currently blocks during adapter deregistration whenever there are consumers holding a reference.
Document that
i2c_get_adapter_by_fwnode(), which also takes a module reference, should almost always be preferred overi2c_find_adapter_by_fwnode()so that an attempt to unload the adapter module while in use fails gracefully instead of blocking uninterruptibly.
Quoted 6 lines
Quoted 4 lines
Note that by implication
of_get_i2c_adapter_by_node()is also generally preferred overof_find_i2c_adapter_by_node().Signed-off-by Johan Hovold <[email protected]>Reviewed-by Wolfram Sang <[email protected]>
Andi, can we have that in 7.4 pretty please?
Andi Shyti
maintainerHi Johan and Wolfram,
Quoted 11 lines · Wolfram Sang
Quoted 10 lines · Wolfram Sang
Quoted 9 lines · Johan Hovold
The i2c subsystem currently blocks during adapter deregistration whenever there are consumers holding a reference.
Document that
i2c_get_adapter_by_fwnode(), which also takes a module reference, should almost always be preferred overi2c_find_adapter_by_fwnode()so that an attempt to unload the adapter module while in use fails gracefully instead of blocking uninterruptibly.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Note that by implication
of_get_i2c_adapter_by_node()is also generally preferred overof_find_i2c_adapter_by_node().Signed-off-by Johan Hovold <[email protected]>Reviewed-by Wolfram Sang <[email protected]>Andi, can we have that in 7.4 pretty please?
I was just pushing this and thanks for pinging me here last night.
Now it's in i2c/i2c.
Thanks,
Andi