On Fri, 4 Apr 2008 12:07:12 -0700 (PDT), Trent Piepho wrote:On Fri, 4 Apr 2008, Jean Delvare wrote:On Thu, 3 Apr 2008 19:06:27 -0700 (PDT), Trent Piepho wrote:+ strcpy(buf, test_bit(FLAG_IS_OUT, &gdesc->flags) ? "out\n" : "in\n\0");
+
+ return 5;
Confusing construct... I suggest using sprintf instead, which will
automatically return the correct number of bytes for you.
But it's less efficient! Will nobody think of the wasted cycles?
Can you prove that it is actually less efficient, and if so, by how
much? The time spent in this single function if probably insignificant
thread, you aren't support to include trailing \0s in the buffer you
pass back to sysfs. Not all programming languages use \0 for string
termination.
+ /* FIXME: Code to remove all the sysfs devices and files created
+ * should go here */
Oh yes it really should ;)
I know, but I'm not using modules for the system this is in, so it will never
get called. What's the point of writing code I'll never use if this isn't
useful for the kernel?
Because most certainly your code won't be accepted upstream until this
is fixed, and presumably you posted this patch in the hope that it
would go upstream ;) Just because it isn't useful to you doesn't mean
it won't be useful to others. Otherwise this particular piece of code
couldn't be built as a module at all.