@@ -2351,6 +2351,8 @@ static void handle_exception(struct fsg_common *common)
struct fsg_lun *curlun;
unsigned int exception_req_tag;
+ pr_err("%s %d current %p\n", __func__, __LINE__, current);
+
/*
* Clear the existing signals. Anything but SIGUSR1 is converted
* into a high-priority EXIT exception.
@@ -2368,8 +2370,12 @@ static void handle_exception(struct fsg_common *common)
/* Cancel all the pending transfers */
if (likely(common->fsg)) {
+ pr_err("%s %d current %p common->fsg_num_buffers %d\n",
+ __func__, __LINE__, current, common->fsg_num_buffers);
for (i = 0; i < common->fsg_num_buffers; ++i) {
bh = &common->buffhds[i];
+ pr_err("%s %d bh %p\n", __func__, __LINE__, bh);
+ msleep(2000);
if (bh->inreq_busy)
usb_ep_dequeue(common->fsg->bulk_in, bh->inreq);
if (bh->outreq_busy)
@@ -2377,6 +2383,8 @@ static void handle_exception(struct fsg_common *common)
bh->outreq);
}
+ pr_err("%s %d current %p\n", __func__, __LINE__, current);
+
/* Wait until everything is idle */
for (;;) {
int num_active = 0;
@@ -2397,6 +2405,8 @@ static void handle_exception(struct fsg_common *common)
usb_ep_fifo_flush(common->fsg->bulk_out);
}
+ pr_err("%s %d current %p\n", __func__, __LINE__, current);
+
/*
* Reset the I/O buffer states and pointers, the SCSI
* state, and the exception. Then invoke the handler.
@@ -2487,6 +2497,10 @@ static void handle_exception(struct fsg_common *common)
case FSG_STATE_IDLE:
break;
}
+
+ pr_err("%s %d current %p common->state %d\n", __func__, __LINE__,
+ current, common->state);
+
}
@@ -2515,6 +2529,8 @@ static int fsg_main_thread(void *common_)
*/
set_fs(get_ds());
+ pr_err("%s %d current %p\n", __func__, __LINE__, current);
+
/* The main loop */
while (common->state != FSG_STATE_TERMINATED) {
if (exception_in_progress(common) || signal_pending(current)) {
@@ -2527,6 +2543,8 @@ static int fsg_main_thread(void *common_)
continue;
}
+ pr_err("%s %d current %p\n", __func__, __LINE__, current);
+
if (get_next_command(common))
continue;
@@ -2572,6 +2590,8 @@ static int fsg_main_thread(void *common_)
up_write(&common->filesem);
}
+ pr_err("%s %d current %p\n", __func__, __LINE__, current);
+
/* Let fsg_unbind() know the thread has exited */
complete_and_exit(&common->thread_notifier, 0);
}
@@ -2979,6 +2999,8 @@ EXPORT_SYMBOL_GPL(fsg_common_set_inquiry_string);
int fsg_common_run_thread(struct fsg_common *common)
{
+ pr_err("%s %d common->state %d common->thread_task %p\n", __func__,
+ __LINE__, common->state, common->thread_task);
common->state = FSG_STATE_IDLE;
/* Tell the thread to start working */
common->thread_task =
@@ -3036,6 +3058,8 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
int ret;
struct fsg_opts *opts;
+ dump_stack();
+ pr_err("%s %d common %p\n", __func__, __LINE__, common);
/* Don't allow to bind if we don't have at least one LUN */
ret = _fsg_common_get_max_lun(common);
if (ret < 0) {
@@ -3118,6 +3142,10 @@ static void fsg_unbind(struct usb_configuration *c, struct usb_function *f)
struct fsg_dev *fsg = fsg_from_func(f);
struct fsg_common *common = fsg->common;
+ dump_stack();
+ pr_err("%s %d common %p common->fsg %p fsg %p\n", __func__, __LINE__,
+ common, common->fsg, fsg);
+
DBG(fsg, "unbind\n");
if (fsg->common->fsg == fsg) {
fsg->common->new_fsg = NULL;