Re: [PATCH] gadget/file_storage.c : Add a serial number parameter.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 27 May 2010 20:45:57 +0200, Yann Cantin <yann.cantin@xxxxxxxxxxx> wrote:
To be sure, i've launch checkpatch.pl against the whole file : 156 errors (wow),
but none related to this.

It may be more convenient to test patch rather then a file.  In this way, only
errors related to thee patch are shown.

Le 27/05/2010 10:59, Michał Nazarewicz a écrit :
Sort of but not quite.  The fsg_serial_string is accessed by the gadget via
the fsg_strings array in storage_common.c.  To avoid copying of the serial
it is enough to change pointer in the array hence:

fsg_strings[FSG_STRING_SERIAL - 1] = mod_data.serial_parm;

Note that FSG_STRING_* are indexed from one (in case of file_storage)
whereas entries in fsg_strings are indexed from zero hence the "- 1".

We're left with an unused array when serial is submitted. Should it be better
to create it on-the-fly when necessary (fallback serial), using a kmalloc call ?
And in this case, when to kfree it ?

I don't think that's better option.  It only complicates code and does not save
that much of memory and as a matter of fact, this would increase the code size
hence defying the whole purpose of saving memory.

--
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-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux