On Mon, Mar 18, 2013 at 05:18:22PM -0700, Greg KH wrote:
>On Thu, Mar 07, 2013 at 10:22:45AM +0800, Wei Yang wrote:
>> Originally, we have two functions named device_add_attrs() in
>> drivers/base/bus.c and drivers/base/core.c. This will cause some confusion
>> when reading the code.
>
>Why?  It's just static functions.

Hmm, yes, they are static functions.

The confusion comes from myself. When I look for the definitions of the
function in cscope, it pop out two line with the same name. So I just think
whether we can help the reader, if there is only one pop up.

Well, I have to admit this is my personal feeling and due to my lack of
experence.

>
>> And the one in drivers/base/bus.c do the same action as 
>> device_add_attributes()
>> in drivers/base/core.c. That would be better to reuse this code.
>
>Possibly, yes, but you put the .h entry in the wrong place, thereby
>exposing a previously static function to the entire kernel, which is not

Agree, this is not a good idea to expose an extra interface to the entire
kernel.

>good at all.  Why did you do that?  Are you now going to want to call
>that function from some driver?

The reason for this patch is, the logic in these two functions are the same.
My purpose is to reuse the code and save some space for the kernel image,
well, I have to admit it is just a very small piece of space.

>
>greg k-h

-- 
Richard Yang
Help you, Help me

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to