Why need we call device_remove_file() firstly before call device_unregister() ?
Hello All:
I searched 'arch/*' and 'drivers/*' sub-directory, all of them are 'obey this rule', even in device_unregister() itself, it also firstly calls device_remove_file(), then call kobject_del().
But after read the related code (fs/sysfs/*, drivers/base/core.c), it seems kobject_del() -> sysfs_remove_dir() which will release all related things (can instead of device_remove_file()).
So in fact, we need not call device_remove_file() before call device_unregister(), is it correct ?
Welcome any member to give a suggestion or completion about it, thanks.
Thanks.
Signature · 3 lines
Chen Gang Asianux Corporation
Hi,
Quoted 6 lines · Chen Gang
Hello All:
I searched '
arch/*' and 'drivers/*' sub-directory, all of them are 'obey this rule', even indevice_unregister()itself, it also firstly callsdevice_remove_file(), then callkobject_del().
Quoted 6 lines
But after read the related code (
fs/sysfs/*,drivers/base/core.c), it seemskobject_del()->sysfs_remove_dir()which will release all related things (can instead ofdevice_remove_file()).So in fact, we need not call
device_remove_file()before calldevice_unregister(), is it correct ?
Looks it is correct but it is a bit implicit.
Thanks,
Signature · 1 line
Ming Lei
Quoted 9 lines · Ming Lei
Hi,
Quoted 6 lines · Chen Gang
Hello All:
I searched '
arch/*' and 'drivers/*' sub-directory, all of them are 'obey this rule', even indevice_unregister()itself, it also firstly callsdevice_remove_file(), then callkobject_del().
Quoted 9 lines
Quoted 6 lines
But after read the related code (
fs/sysfs/*,drivers/base/core.c), it seemskobject_del()->sysfs_remove_dir()which will release all related things (can instead ofdevice_remove_file()).So in fact, we need not call
device_remove_file()before calldevice_unregister(), is it correct ?Looks it is correct but it is a bit implicit.
If really no other members reply within a week, we should treat your opinion (or suggestion) as the final result conclusion within [email protected]. :-)
Thanks.
Signature · 3 lines
Chen Gang Asianux Corporation
Quoted 17 lines · Chen Gang
Quoted 16 lines · Ming Lei
Hi,
Quoted 12 lines · Chen Gang
Hello All:
I searched '
arch/*' and 'drivers/*' sub-directory, all of them are 'obey this rule', even indevice_unregister()itself, it also firstly callsdevice_remove_file(), then callkobject_del().But after read the related code (
fs/sysfs/*,drivers/base/core.c), it seemskobject_del()->sysfs_remove_dir()which will release all related things (can instead ofdevice_remove_file()).So in fact, we need not call
device_remove_file()before calldevice_unregister(), is it correct ?
Quoted 6 lines
Quoted 2 lines
Looks it is correct but it is a bit implicit.
If really no other members reply within a week, we should treat your opinion (or suggestion) as the final result conclusion within [email protected]. :-)
I have no idea what you mean by this.
Quoted 18 lines · Greg Kroah-Hartman
Quoted 17 lines · Chen Gang
Quoted 17 lines · Ming Lei
Quoted 16 lines
Quoted 16 lines
Hi,
Quoted 12 lines · Chen Gang
Quoted 12 lines
Hello All:
I searched '
arch/*' and 'drivers/*' sub-directory, all of them are 'obey this rule', even indevice_unregister()itself, it also firstly callsdevice_remove_file(), then callkobject_del().But after read the related code (
fs/sysfs/*,drivers/base/core.c), it seemskobject_del()->sysfs_remove_dir()which will release all related things (can instead ofdevice_remove_file()).So in fact, we need not call
device_remove_file()before calldevice_unregister(), is it correct ?
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Looks it is correct but it is a bit implicit.
If really no other members reply within a week, we should treat your opinion (or suggestion) as the final result conclusion within [email protected]. :-)
I have no idea what you mean by this.
I mean that if no reply by any other members within a week, I will know it is correct that "we need not call device_remove_file() firstly before call device_unregister()" (at least, one member's reply supports this conclusion).
I find this 'question' when discussing a patch with another members in [email protected], I have read the related code and also have searched with google, but can not find the result, so I want to consult it in [email protected].
And I think, this 'question' is not suitable to give a test firstly, because the test plan need be discussed firstly (or the test result means nothing).
This time, I send the 'consult' mail to 'All', not to specific members.
Thanks.
Signature · 3 lines
Chen Gang Asianux Corporation
Quoted 9 lines · Chen Gang
I mean that if no reply by any other members within a week, I will know it is correct that "we need not call
device_remove_file()firstly before calldevice_unregister()" (at least, one member's reply supports this conclusion).I find this 'question' when discussing a patch with another members in [email protected], I have read the related code and also have searched with google, but can not find the result, so I want to consult it in [email protected].
Asking random questions on lkml, and relying on the fact that no one else happens to say anything, is not any judge as to if the answer is correct at all.
In fact, just asking questions on lkml has a very low chance of ever getting a correct answer, given that the people that usually do know the answer to these types of things are usually:
1) not reading lkml because they are busy doing real work
2) annoyed by questions that are easily answered by themselves by either:
a) reading the code
b) writing a simple example module and testing it out yourself
Good luck,
greg k-h
Quoted 6 lines · Greg Kroah-Hartman
Quoted 5 lines · Chen Gang
Quoted 5 lines
I mean that if no reply by any other members within a week, I will know it is correct that "we need not call
device_remove_file()firstly before calldevice_unregister()" (at least, one member's reply supports this conclusion).
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
I find this 'question' when discussing a patch with another members in [email protected], I have read the related code and also have searched with google, but can not find the result, so I want to consult it in [email protected].
Asking random questions on lkml, and relying on the fact that no one else happens to say anything, is not any judge as to if the answer is correct at all.
OK, I can understand, now, thank you for your reply.
And I wish, we can provide the confirmation of all related questions about Linux kernel, in the future,
Quoted 4 lines
In fact, just asking questions on lkml has a very low chance of ever getting a correct answer, given that the people that usually do know the answer to these types of things are usually:
1) not reading lkml because they are busy doing real work
I should understand, they have no duty to have to reply the related mail, especially every members already have their own work (and normally, they are really busy).
Quoted 3 lines
2) annoyed by questions that are easily answered by themselves by either:
a) reading the code
I have done, so I need not worry about this item. :-)
Quoted 2 lines
b) writing a simple example module and testing it out yourself
Precisely, I did not do it firstly. It seems I should do it firstly (although, at least now, I do not think it will get any valuable result for our this case)
Quoted 3 lines
Good luck,
OK, 'Lucky' is really the first important !!
I should continue to analyze this question, independent this 'consult' mail.
Thanks.
Signature · 3 lines
Chen Gang Asianux Corporation