diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2006-03-31 11:46:43 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-14 14:12:21 -0400 |
commit | aafe5bd6ec341edfaf3233d272febbb8862a7251 (patch) | |
tree | 901d1202beb009994a6260c02d401887bf47f213 /drivers | |
parent | 5e32b5767fca231e1c84b84e877a26766c27510f (diff) |
[PATCH] USB: g_file_storage: use module_param_array_named macro
Randy Dunlap pointed out that there now is a module_param_array_named
macro available. This patch (as666) updates g_file_storage to make use of
it. It also adds a comment listing the specifications documents used in
the design of the driver's SCSI operation (at Pat LaVarre's request).
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index b6d920f349ea..6f887478b148 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -114,6 +114,14 @@ | |||
114 | * setting are not allowed when the medium is loaded. | 114 | * setting are not allowed when the medium is loaded. |
115 | * | 115 | * |
116 | * This gadget driver is heavily based on "Gadget Zero" by David Brownell. | 116 | * This gadget driver is heavily based on "Gadget Zero" by David Brownell. |
117 | * The driver's SCSI command interface was based on the "Information | ||
118 | * technology - Small Computer System Interface - 2" document from | ||
119 | * X3T9.2 Project 375D, Revision 10L, 7-SEP-93, available at | ||
120 | * <http://www.t10.org/ftp/t10/drafts/s2/s2-r10l.pdf>. The single exception | ||
121 | * is opcode 0x23 (READ FORMAT CAPACITIES), which was based on the | ||
122 | * "Universal Serial Bus Mass Storage Class UFI Command Specification" | ||
123 | * document, Revision 1.0, December 14, 1998, available at | ||
124 | * <http://www.usb.org/developers/devclass_docs/usbmass-ufi10.pdf>. | ||
117 | */ | 125 | */ |
118 | 126 | ||
119 | 127 | ||
@@ -340,11 +348,9 @@ MODULE_LICENSE("Dual BSD/GPL"); | |||
340 | 348 | ||
341 | #define MAX_LUNS 8 | 349 | #define MAX_LUNS 8 |
342 | 350 | ||
343 | /* Arggh! There should be a module_param_array_named macro! */ | ||
344 | static char *file[MAX_LUNS]; | ||
345 | static int ro[MAX_LUNS]; | ||
346 | |||
347 | static struct { | 351 | static struct { |
352 | char *file[MAX_LUNS]; | ||
353 | int ro[MAX_LUNS]; | ||
348 | int num_filenames; | 354 | int num_filenames; |
349 | int num_ros; | 355 | int num_ros; |
350 | unsigned int nluns; | 356 | unsigned int nluns; |
@@ -376,10 +382,11 @@ static struct { | |||
376 | }; | 382 | }; |
377 | 383 | ||
378 | 384 | ||
379 | module_param_array(file, charp, &mod_data.num_filenames, S_IRUGO); | 385 | module_param_array_named(file, mod_data.file, charp, &mod_data.num_filenames, |
386 | S_IRUGO); | ||
380 | MODULE_PARM_DESC(file, "names of backing files or devices"); | 387 | MODULE_PARM_DESC(file, "names of backing files or devices"); |
381 | 388 | ||
382 | module_param_array(ro, bool, &mod_data.num_ros, S_IRUGO); | 389 | module_param_array_named(ro, mod_data.ro, bool, &mod_data.num_ros, S_IRUGO); |
383 | MODULE_PARM_DESC(ro, "true to force read-only"); | 390 | MODULE_PARM_DESC(ro, "true to force read-only"); |
384 | 391 | ||
385 | module_param_named(luns, mod_data.nluns, uint, S_IRUGO); | 392 | module_param_named(luns, mod_data.nluns, uint, S_IRUGO); |
@@ -3868,7 +3875,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3868 | 3875 | ||
3869 | for (i = 0; i < fsg->nluns; ++i) { | 3876 | for (i = 0; i < fsg->nluns; ++i) { |
3870 | curlun = &fsg->luns[i]; | 3877 | curlun = &fsg->luns[i]; |
3871 | curlun->ro = ro[i]; | 3878 | curlun->ro = mod_data.ro[i]; |
3872 | curlun->dev.parent = &gadget->dev; | 3879 | curlun->dev.parent = &gadget->dev; |
3873 | curlun->dev.driver = &fsg_driver.driver; | 3880 | curlun->dev.driver = &fsg_driver.driver; |
3874 | dev_set_drvdata(&curlun->dev, fsg); | 3881 | dev_set_drvdata(&curlun->dev, fsg); |
@@ -3885,8 +3892,9 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3885 | kref_get(&fsg->ref); | 3892 | kref_get(&fsg->ref); |
3886 | } | 3893 | } |
3887 | 3894 | ||
3888 | if (file[i] && *file[i]) { | 3895 | if (mod_data.file[i] && *mod_data.file[i]) { |
3889 | if ((rc = open_backing_file(curlun, file[i])) != 0) | 3896 | if ((rc = open_backing_file(curlun, |
3897 | mod_data.file[i])) != 0) | ||
3890 | goto out; | 3898 | goto out; |
3891 | } else if (!mod_data.removable) { | 3899 | } else if (!mod_data.removable) { |
3892 | ERROR(fsg, "no file given for LUN%d\n", i); | 3900 | ERROR(fsg, "no file given for LUN%d\n", i); |