On 9/18/2023 2:39 AM, Chaoyong He wrote: > > >> -----Original Message----- >> From: Ferruh Yigit <ferruh.yi...@amd.com> >> Sent: Friday, September 15, 2023 9:46 PM >> To: Chaoyong He <chaoyong...@corigine.com>; dev@dpdk.org >> Cc: oss-drivers <oss-driv...@corigine.com>; Niklas Soderlund >> <niklas.soderl...@corigine.com> >> Subject: Re: [PATCH v3 12/27] net/nfp: refact the hwinfo module >> >> On 9/15/2023 10:15 AM, Chaoyong He wrote: >>> Move the definition of data structure and macro into the implement file. >>> >> >> What is the motivation for this move, I can see same is done in multiple >> other >> patches? >> Header file is still included by .c file, what is the benefit of moving from >> header >> to .c file? > > We try to make the interface between modules as small as possible. > > We meet some problem when we add new features, too much content in the header > files make it difficult to form a identify dependencies among modules. > When we try to add a new data field in a structure or add a new data type in > one header file, we had to modify many unrelated files just because it > includes this header file, it's not good. > > This is the direct motivation for this move, this will make the development > easier.>
If you can move a struct or data type to .c file, it means it is not shared so updating it should not cause change anyway. I am not against it, but I didn't get your reasoning. When there are 'nfp_hwinfo.c' and 'nfp_hwinfo.h' files, I think that is reasonable to have "nfp_hwinfo*" macros and structs in the .h file, it looks like you want to separate data structures that are shared and ones that are only used by 'nfp_hwinfo.c' but I am not sure how it helps. Anyway if you know what you are doing, it is OK, I just want to double check if this is done on purpose.