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

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

 



@@ -330,6 +332,7 @@ static struct {
     .vendor            = FSG_VENDOR_ID,
     .product        = FSG_PRODUCT_ID,
     .release        = 0xffff,    // Use controller chip type
+    .serial_parm        = NULL,
     .buflen            = 16384,
     };


Le 26/05/2010 11:02, Michał Nazarewicz a écrit :
This is no needed.  Check out scripts/checkpatch.pl Greg mentioned.

On Wed, 26 May 2010 22:21:26 +0200, Yann Cantin <yann.cantin@xxxxxxxxxxx> wrote:
checkpatch.pl don't catch this, nor am i... I now see the point.

C standard requires all objects with static duration that are not explicitly
initialised to be implicitly initialised to "zero" so initialisation to NULL
is redundant.

It seems checkpatch.pl has problems with compound initialisers if it does not
recognise the above case.

I'm not sure i understand, do you talk about something like :

fsg_string_serial = serial_parm;

after validation of serial_parm ?

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".

--
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