static void fsg_disable(struct usb_function *f)
{
struct fsg_dev *fsg = fsg_from_func(f);
- raise_exception(fsg->common, FSG_STATE_DISCONNECT);
+ fsg->common->new_fsg = NULL;
+ raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
}
enum fsg_state old_state;
struct fsg_lun *curlun;
unsigned int exception_req_tag;
- struct fsg_dev *fsg;
/*
* Clear the existing signals. Anything but SIGUSR1 is converted
break;
case FSG_STATE_CONFIG_CHANGE:
- fsg = common->new_fsg;
- /*
- * Add a check here to double confirm if a disconnect event
- * occurs and common->new_fsg has been cleared.
- */
- if (fsg) {
- do_set_interface(common, fsg);
+ do_set_interface(common, common->new_fsg);
+ if (common->new_fsg)
usb_composite_setup_continue(common->cdev);
- }
- break;
-
- case FSG_STATE_DISCONNECT:
- do_set_interface(common, NULL);
break;
case FSG_STATE_EXIT:
DBG(fsg, "unbind\n");
if (fsg->common->fsg == fsg) {
- raise_exception(fsg->common, FSG_STATE_DISCONNECT);
+ fsg->common->new_fsg = NULL;
+ raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
/* FIXME: make interruptible or killable somehow? */
wait_event(common->fsg_wait, common->fsg != fsg);
}