diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 88e5ad2bc710..a857b7ac238c 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -321,7 +321,7 @@ static struct { | |||
321 | unsigned short vendor; | 321 | unsigned short vendor; |
322 | unsigned short product; | 322 | unsigned short product; |
323 | unsigned short release; | 323 | unsigned short release; |
324 | char *serial_parm; | 324 | char *serial; |
325 | unsigned int buflen; | 325 | unsigned int buflen; |
326 | 326 | ||
327 | int transport_type; | 327 | int transport_type; |
@@ -365,6 +365,8 @@ MODULE_PARM_DESC(stall, "false to prevent bulk stalls"); | |||
365 | module_param_named(cdrom, mod_data.cdrom, bool, S_IRUGO); | 365 | module_param_named(cdrom, mod_data.cdrom, bool, S_IRUGO); |
366 | MODULE_PARM_DESC(cdrom, "true to emulate cdrom instead of disk"); | 366 | MODULE_PARM_DESC(cdrom, "true to emulate cdrom instead of disk"); |
367 | 367 | ||
368 | module_param_named(serial, mod_data.serial, charp, S_IRUGO); | ||
369 | MODULE_PARM_DESC(serial, "USB serial number"); | ||
368 | 370 | ||
369 | /* In the non-TEST version, only the module parameters listed above | 371 | /* In the non-TEST version, only the module parameters listed above |
370 | * are available. */ | 372 | * are available. */ |
@@ -386,9 +388,6 @@ MODULE_PARM_DESC(product, "USB Product ID"); | |||
386 | module_param_named(release, mod_data.release, ushort, S_IRUGO); | 388 | module_param_named(release, mod_data.release, ushort, S_IRUGO); |
387 | MODULE_PARM_DESC(release, "USB release number"); | 389 | MODULE_PARM_DESC(release, "USB release number"); |
388 | 390 | ||
389 | module_param_named(serial, mod_data.serial_parm, charp, S_IRUGO); | ||
390 | MODULE_PARM_DESC(serial, "USB serial number"); | ||
391 | |||
392 | module_param_named(buflen, mod_data.buflen, uint, S_IRUGO); | 391 | module_param_named(buflen, mod_data.buflen, uint, S_IRUGO); |
393 | MODULE_PARM_DESC(buflen, "I/O buffer size"); | 392 | MODULE_PARM_DESC(buflen, "I/O buffer size"); |
394 | 393 | ||
@@ -3291,10 +3290,12 @@ static int __init check_parameters(struct fsg_dev *fsg) | |||
3291 | return -ETOOSMALL; | 3290 | return -ETOOSMALL; |
3292 | } | 3291 | } |
3293 | 3292 | ||
3293 | #endif /* CONFIG_USB_FILE_STORAGE_TEST */ | ||
3294 | |||
3294 | /* Serial string handling. | 3295 | /* Serial string handling. |
3295 | * On a real device, the serial string would be loaded | 3296 | * On a real device, the serial string would be loaded |
3296 | * from permanent storage. */ | 3297 | * from permanent storage. */ |
3297 | if (mod_data.serial_parm) { | 3298 | if (mod_data.serial) { |
3298 | const char *ch; | 3299 | const char *ch; |
3299 | unsigned len = 0; | 3300 | unsigned len = 0; |
3300 | 3301 | ||
@@ -3303,7 +3304,7 @@ static int __init check_parameters(struct fsg_dev *fsg) | |||
3303 | * 12 uppercase hexadecimal characters. | 3304 | * 12 uppercase hexadecimal characters. |
3304 | * BBB need at least 12 uppercase hexadecimal characters, | 3305 | * BBB need at least 12 uppercase hexadecimal characters, |
3305 | * with a maximum of 126. */ | 3306 | * with a maximum of 126. */ |
3306 | for (ch = mod_data.serial_parm; *ch; ++ch) { | 3307 | for (ch = mod_data.serial; *ch; ++ch) { |
3307 | ++len; | 3308 | ++len; |
3308 | if ((*ch < '0' || *ch > '9') && | 3309 | if ((*ch < '0' || *ch > '9') && |
3309 | (*ch < 'A' || *ch > 'F')) { /* not uppercase hex */ | 3310 | (*ch < 'A' || *ch > 'F')) { /* not uppercase hex */ |
@@ -3322,8 +3323,11 @@ static int __init check_parameters(struct fsg_dev *fsg) | |||
3322 | "Failing back to default\n"); | 3323 | "Failing back to default\n"); |
3323 | goto fill_serial; | 3324 | goto fill_serial; |
3324 | } | 3325 | } |
3325 | fsg_strings[FSG_STRING_SERIAL - 1].s = mod_data.serial_parm; | 3326 | fsg_strings[FSG_STRING_SERIAL - 1].s = mod_data.serial; |
3326 | } else { | 3327 | } else { |
3328 | WARNING(fsg, | ||
3329 | "Userspace failed to provide serial number; " | ||
3330 | "Failing back to default\n"); | ||
3327 | fill_serial: | 3331 | fill_serial: |
3328 | /* Serial number not specified or invalid, make our own. | 3332 | /* Serial number not specified or invalid, make our own. |
3329 | * We just encode it from the driver version string, | 3333 | * We just encode it from the driver version string, |
@@ -3339,8 +3343,6 @@ fill_serial: | |||
3339 | } | 3343 | } |
3340 | } | 3344 | } |
3341 | 3345 | ||
3342 | #endif /* CONFIG_USB_FILE_STORAGE_TEST */ | ||
3343 | |||
3344 | return 0; | 3346 | return 0; |
3345 | } | 3347 | } |
3346 | 3348 | ||