[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>
This commit is contained in:
parent
5e32b5767f
commit
aafe5bd6ec
|
@ -114,6 +114,14 @@
|
|||
* setting are not allowed when the medium is loaded.
|
||||
*
|
||||
* This gadget driver is heavily based on "Gadget Zero" by David Brownell.
|
||||
* The driver's SCSI command interface was based on the "Information
|
||||
* technology - Small Computer System Interface - 2" document from
|
||||
* X3T9.2 Project 375D, Revision 10L, 7-SEP-93, available at
|
||||
* <http://www.t10.org/ftp/t10/drafts/s2/s2-r10l.pdf>. The single exception
|
||||
* is opcode 0x23 (READ FORMAT CAPACITIES), which was based on the
|
||||
* "Universal Serial Bus Mass Storage Class UFI Command Specification"
|
||||
* document, Revision 1.0, December 14, 1998, available at
|
||||
* <http://www.usb.org/developers/devclass_docs/usbmass-ufi10.pdf>.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -340,11 +348,9 @@ MODULE_LICENSE("Dual BSD/GPL");
|
|||
|
||||
#define MAX_LUNS 8
|
||||
|
||||
/* Arggh! There should be a module_param_array_named macro! */
|
||||
static char *file[MAX_LUNS];
|
||||
static int ro[MAX_LUNS];
|
||||
|
||||
static struct {
|
||||
char *file[MAX_LUNS];
|
||||
int ro[MAX_LUNS];
|
||||
int num_filenames;
|
||||
int num_ros;
|
||||
unsigned int nluns;
|
||||
|
@ -376,10 +382,11 @@ static struct {
|
|||
};
|
||||
|
||||
|
||||
module_param_array(file, charp, &mod_data.num_filenames, S_IRUGO);
|
||||
module_param_array_named(file, mod_data.file, charp, &mod_data.num_filenames,
|
||||
S_IRUGO);
|
||||
MODULE_PARM_DESC(file, "names of backing files or devices");
|
||||
|
||||
module_param_array(ro, bool, &mod_data.num_ros, S_IRUGO);
|
||||
module_param_array_named(ro, mod_data.ro, bool, &mod_data.num_ros, S_IRUGO);
|
||||
MODULE_PARM_DESC(ro, "true to force read-only");
|
||||
|
||||
module_param_named(luns, mod_data.nluns, uint, S_IRUGO);
|
||||
|
@ -3868,7 +3875,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
|
|||
|
||||
for (i = 0; i < fsg->nluns; ++i) {
|
||||
curlun = &fsg->luns[i];
|
||||
curlun->ro = ro[i];
|
||||
curlun->ro = mod_data.ro[i];
|
||||
curlun->dev.parent = &gadget->dev;
|
||||
curlun->dev.driver = &fsg_driver.driver;
|
||||
dev_set_drvdata(&curlun->dev, fsg);
|
||||
|
@ -3885,8 +3892,9 @@ static int __init fsg_bind(struct usb_gadget *gadget)
|
|||
kref_get(&fsg->ref);
|
||||
}
|
||||
|
||||
if (file[i] && *file[i]) {
|
||||
if ((rc = open_backing_file(curlun, file[i])) != 0)
|
||||
if (mod_data.file[i] && *mod_data.file[i]) {
|
||||
if ((rc = open_backing_file(curlun,
|
||||
mod_data.file[i])) != 0)
|
||||
goto out;
|
||||
} else if (!mod_data.removable) {
|
||||
ERROR(fsg, "no file given for LUN%d\n", i);
|
||||
|
|
Loading…
Reference in New Issue