* [Consult] Why need we call device_remove_file() firstly before call device_unregister() ? @ 2013-05-17 5:43 Chen Gang 2013-05-18 11:06 ` Ming Lei 0 siblings, 1 reply; 7+ messages in thread From: Chen Gang @ 2013-05-17 5:43 UTC (permalink / raw) To: linux-kernel@vger.kernel.org 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. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Consult] Why need we call device_remove_file() firstly before call device_unregister() ? 2013-05-17 5:43 [Consult] Why need we call device_remove_file() firstly before call device_unregister() ? Chen Gang @ 2013-05-18 11:06 ` Ming Lei 2013-05-20 1:03 ` Chen Gang 0 siblings, 1 reply; 7+ messages in thread From: Ming Lei @ 2013-05-18 11:06 UTC (permalink / raw) To: Chen Gang; +Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman Hi, On Fri, May 17, 2013 at 1:43 PM, Chen Gang <gang.chen@asianux.com> wrote: > 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 ? Looks it is correct but it is a bit implicit. Thanks, -- Ming Lei ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Consult] Why need we call device_remove_file() firstly before call device_unregister() ? 2013-05-18 11:06 ` Ming Lei @ 2013-05-20 1:03 ` Chen Gang 2013-05-20 1:45 ` Greg Kroah-Hartman 0 siblings, 1 reply; 7+ messages in thread From: Chen Gang @ 2013-05-20 1:03 UTC (permalink / raw) To: Ming Lei; +Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman On 05/18/2013 07:06 PM, Ming Lei wrote: > Hi, > > On Fri, May 17, 2013 at 1:43 PM, Chen Gang <gang.chen@asianux.com> wrote: >> 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 ? > > 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 linux-kernel@vger.kernel.org. :-) Thanks. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Consult] Why need we call device_remove_file() firstly before call device_unregister() ? 2013-05-20 1:03 ` Chen Gang @ 2013-05-20 1:45 ` Greg Kroah-Hartman 2013-05-20 2:12 ` Chen Gang 0 siblings, 1 reply; 7+ messages in thread From: Greg Kroah-Hartman @ 2013-05-20 1:45 UTC (permalink / raw) To: Chen Gang; +Cc: Ming Lei, linux-kernel@vger.kernel.org On Mon, May 20, 2013 at 09:03:27AM +0800, Chen Gang wrote: > On 05/18/2013 07:06 PM, Ming Lei wrote: > > Hi, > > > > On Fri, May 17, 2013 at 1:43 PM, Chen Gang <gang.chen@asianux.com> wrote: > >> 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 ? > > > > 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 > linux-kernel@vger.kernel.org. :-) I have no idea what you mean by this. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Consult] Why need we call device_remove_file() firstly before call device_unregister() ? 2013-05-20 1:45 ` Greg Kroah-Hartman @ 2013-05-20 2:12 ` Chen Gang 2013-05-20 2:20 ` Greg Kroah-Hartman 0 siblings, 1 reply; 7+ messages in thread From: Chen Gang @ 2013-05-20 2:12 UTC (permalink / raw) To: Greg Kroah-Hartman; +Cc: Ming Lei, linux-kernel@vger.kernel.org On 05/20/2013 09:45 AM, Greg Kroah-Hartman wrote: > On Mon, May 20, 2013 at 09:03:27AM +0800, Chen Gang wrote: >> > On 05/18/2013 07:06 PM, Ming Lei wrote: >>> > > Hi, >>> > > >>> > > On Fri, May 17, 2013 at 1:43 PM, Chen Gang <gang.chen@asianux.com> wrote: >>>> > >> 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 ? >>> > > >>> > > 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 >> > linux-kernel@vger.kernel.org. :-) > 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 linux-kernel@vger.kernel.org, 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 linux-kernel@vger.kernel.org. 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. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Consult] Why need we call device_remove_file() firstly before call device_unregister() ? 2013-05-20 2:12 ` Chen Gang @ 2013-05-20 2:20 ` Greg Kroah-Hartman 2013-05-20 2:42 ` Chen Gang 0 siblings, 1 reply; 7+ messages in thread From: Greg Kroah-Hartman @ 2013-05-20 2:20 UTC (permalink / raw) To: Chen Gang; +Cc: Ming Lei, linux-kernel@vger.kernel.org On Mon, May 20, 2013 at 10:12:41AM +0800, Chen Gang wrote: > 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 > linux-kernel@vger.kernel.org, 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 linux-kernel@vger.kernel.org. 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Consult] Why need we call device_remove_file() firstly before call device_unregister() ? 2013-05-20 2:20 ` Greg Kroah-Hartman @ 2013-05-20 2:42 ` Chen Gang 0 siblings, 0 replies; 7+ messages in thread From: Chen Gang @ 2013-05-20 2:42 UTC (permalink / raw) To: Greg Kroah-Hartman; +Cc: Ming Lei, linux-kernel@vger.kernel.org On 05/20/2013 10:20 AM, Greg Kroah-Hartman wrote: > On Mon, May 20, 2013 at 10:12:41AM +0800, Chen Gang wrote: >> > 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 >> > linux-kernel@vger.kernel.org, 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 linux-kernel@vger.kernel.org. > 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, > 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). > 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. :-) > 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) > > Good luck, > OK, 'Lucky' is really the first important !! I should continue to analyze this question, independent this 'consult' mail. Thanks. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-05-20 2:43 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-05-17 5:43 [Consult] Why need we call device_remove_file() firstly before call device_unregister() ? Chen Gang 2013-05-18 11:06 ` Ming Lei 2013-05-20 1:03 ` Chen Gang 2013-05-20 1:45 ` Greg Kroah-Hartman 2013-05-20 2:12 ` Chen Gang 2013-05-20 2:20 ` Greg Kroah-Hartman 2013-05-20 2:42 ` Chen Gang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox