From: Alan Stern on
On Tue, 20 Jul 2010, [utf-8] Michał Nazarewicz wrote:

> > On Mon, 19 Jul 2010, [utf-8] Michal‚ Nazarewicz wrote:
> >> 1/3: http://lkml.org/lkml/2010/7/8/317
> >> Adds serial to mass storage gadget and g_multi introducing
> >> fsg_string_serial_fill() macro used by abovementioned
> >> gadgets and file storage gadget.
>
> On Mon, 19 Jul 2010 19:06:32 +0200, Alan Stern <stern(a)rowland.harvard.edu> wrote:
> > Ah, yes. My personal taste would be to write fsg_string_serial_fill_n
> > as an inline routine instead of as a macro, and not try to make it
> > separate from fsg_string_serial_fill.
>
> Not sure what you meant by "make it separate from fsg_string_serial_fill".

I mean have a single function, called "fsg_string_serial_fill", instead
of two separate macros called "fsg_string_serial_fill" and
"fsg_string_serial_fill_n".

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Alan Stern on
On Tue, 20 Jul 2010, [utf-8] Michał Nazarewicz wrote:

> On Mon, 19 Jul 2010 19:41:10 +0200, David Brownell <david-b(a)pacbell.net> wrote:
> >> I'm not entirely sure of what the issue with
> >> the patches is really. It merely adds a serial
> >> number to the gadgets using MSF and that's all.
> >
> > Go back and read what I wrote then. The issue is
> > that THERE ALREADY IS SUCH A MECHANISM. We neither
> > need or want another way to do it. The answer is to
> > use the existing mechanism correctly.
>
> There is no existing mechanism. If the module does not set the
> iSerialNumber field the iSerialNumber module parameter won't work
> and I don't see any other way to set the string. If there is one,
> please show it to me.

That's clearly a bug. Change the code so that a module parameter will
always work, even if a function driver doesn't specify a serial number
string.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Michał Nazarewicz on
On Tue, 20 Jul 2010 16:08:53 +0200, Alan Stern <stern(a)rowland.harvard.edu> wrote:

> On Tue, 20 Jul 2010, [utf-8] Michał Nazarewicz wrote:
>
>> > On Mon, 19 Jul 2010, [utf-8] Michal‚ Nazarewicz wrote:
>> >> 1/3: http://lkml.org/lkml/2010/7/8/317
>> >> Adds serial to mass storage gadget and g_multi introducing
>> >> fsg_string_serial_fill() macro used by abovementioned
>> >> gadgets and file storage gadget.
>>
>> On Mon, 19 Jul 2010 19:06:32 +0200, Alan Stern <stern(a)rowland.harvard.edu> wrote:
>> > Ah, yes. My personal taste would be to write fsg_string_serial_fill_n
>> > as an inline routine instead of as a macro, and not try to make it
>> > separate from fsg_string_serial_fill.
>>
>> Not sure what you meant by "make it separate from fsg_string_serial_fill".
>
> I mean have a single function, called "fsg_string_serial_fill", instead
> of two separate macros called "fsg_string_serial_fill" and
> "fsg_string_serial_fill_n".

I wanted to keep fsg_string_serial_fill() as a macro so that it can
use ARRAY_SIZE() on the first argument to check the size. If there
was a single function it would have to explicitly take the length of
the destination array as an argument -- that's what the *_n() function
is for.

The rationale is that not having to use ARRAY_SIZE() is, well,
simpler. ;)

Basically, what you are proposing is to remove the
fsg_string_serial_fill() macro and leave only the *_n() changed to
an inline function and force all callers use sizeof/ARRAY_SIZE().

Am I getting that right? Personally, I'd leave things like they are
changing the *_n() to a function. What do you think?

--
Best regards, _ _
| Humble Liege of Serenely Enlightened Majesty of o' \,=./ `o
| Computer Science, Michał "mina86" Nazarewicz (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Michał Nazarewicz on
> On Tue, 20 Jul 2010, [utf-8] Michał Nazarewicz wrote:
>> There is no existing mechanism. If the module does not set the
>> iSerialNumber field the iSerialNumber module parameter won't work
>> and I don't see any other way to set the string. If there is one,
>> please show it to me.

On Tue, 20 Jul 2010 16:07:35 +0200, Alan Stern <stern(a)rowland.harvard.edu> wrote:
> That's clearly a bug. Change the code so that a module parameter will
> always work, even if a function driver doesn't specify a serial number
> string.

Ah! So that's what I wasn't getting! I'll get to it then. Will
send an updated v4 later this week (maybe today).

--
Best regards, _ _
| Humble Liege of Serenely Enlightened Majesty of o' \,=./ `o
| Computer Science, Michał "mina86" Nazarewicz (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: David Brownell on
--- On Tue, 7/20/10, Michał Nazarewicz <m.nazarewicz(a)samsung.com> wrote:

> The rationale is that not having to use ARRAY_SIZE() is,
> well, simpler. ;)

And more foolish. Do work at compile
time, not run time, when it's that easy.

- Dave



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