check_parameters() function has been incorporated inside the fsg_bind() function. Signed-off-by: Michal Nazarewicz <m.nazarewicz@xxxxxxxxxxx> --- drivers/usb/gadget/f_mass_storage.c | 53 ++++++++++++++--------------------- 1 files changed, 21 insertions(+), 32 deletions(-) diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 120e891..c075766 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -2805,36 +2805,6 @@ static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) } -static int __init check_parameters(struct fsg_dev *fsg) -{ - int gcnum; - - /* Some peripheral controllers are known not to be able to - * halt bulk endpoints correctly. If one of them is present, - * disable stalls. - */ - if (gadget_is_sh(fsg->gadget) || gadget_is_at91(fsg->gadget)) - mod_data.can_stall = 0; - - if (mod_data.release == 0xffff) { // Parameter wasn't set - /* The sa1100 controller is not supported */ - if (gadget_is_sa1100(fsg->gadget)) - gcnum = -1; - else - gcnum = usb_gadget_controller_number(fsg->gadget); - if (gcnum >= 0) - mod_data.release = 0x0300 + gcnum; - else { - WARNING(fsg, "controller '%s' not recognized\n", - fsg->gadget->name); - mod_data.release = 0x0399; - } - } - - return 0; -} - - static int __init fsg_bind(struct usb_gadget *gadget) { struct fsg_dev *fsg = the_fsg; @@ -2850,8 +2820,12 @@ static int __init fsg_bind(struct usb_gadget *gadget) fsg->ep0 = gadget->ep0; fsg->ep0->driver_data = fsg; - if ((rc = check_parameters(fsg)) != 0) - goto out; + /* Some peripheral controllers are known not to be able to + * halt bulk endpoints correctly. If one of them is present, + * disable stalls. + */ + if (gadget_is_sh(fsg->gadget) || gadget_is_at91(fsg->gadget)) + mod_data.can_stall = 0; if (mod_data.removable) { // Enable the store_xxx attributes dev_attr_file.attr.mode = 0644; @@ -2862,6 +2836,21 @@ static int __init fsg_bind(struct usb_gadget *gadget) } } + if (mod_data.release == 0xffff) { // Parameter wasn't set + /* The sa1100 controller is not supported */ + if (gadget_is_sa1100(fsg->gadget)) + i = -1; + else + i = usb_gadget_controller_number(fsg->gadget); + if (i >= 0) + mod_data.release = 0x0300 + i; + else { + WARNING(fsg, "controller '%s' not recognized\n", + fsg->gadget->name); + mod_data.release = 0x0399; + } + } + /* Find out how many LUNs there should be */ i = mod_data.nluns; if (i == 0) -- 1.6.3.3 -- 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