From: Michal Nazarewicz <mina86-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
To: Alan Stern
<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>,
Ivaylo Dimitrov
<ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "Felipe Balbi"
<felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
"Tony Lindgren" <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
"Bin Liu" <b-liu-l0cyMroinI0@public.gmane.org>,
"pali Rohár" <pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"USB list" <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"Greg Kroah-Hartman"
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
"Robert Baldyga"
<r.baldyga-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
"Andrzej Pietrasiewicz"
<andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: USB gadgets with configfs hang reboot
Date: Fri, 01 Apr 2016 19:02:47 +0200 [thread overview]
Message-ID: <xa1tmvpdz2h4.fsf@mina86.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1603311255560.1516-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
On Thu, Mar 31 2016, Alan Stern wrote:
> Michal, I'm not sure how you intended to handle this.
For legacy/nokia setting no_configfs should be a valid solution:
---- >8 ----------------------------------------------------------------
diff --git a/drivers/usb/gadget/legacy/nokia.c b/drivers/usb/gadget/legacy/nokia.c
index 0997504..e4bc607 100644
--- a/drivers/usb/gadget/legacy/nokia.c
+++ b/drivers/usb/gadget/legacy/nokia.c
@@ -223,6 +223,7 @@ static int nokia_bind_config(struct usb_configuration *c)
}
fsg_opts = fsg_opts_from_func_inst(fi_msg);
+ fsg_opts->no_configfs = true;
status = fsg_common_run_thread(fsg_opts->common);
if (status)
---- >8 ----------------------------------------------------------------
This is what other legacy gadgets do after all.
For configfs, why not simply check if the thread has already been
started:
---- >8 ----------------------------------------------------------------
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index acf210f..62854b6 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2984,8 +2984,10 @@ int fsg_common_run_thread(struct fsg_common *common)
common->thread_task =
kthread_create(fsg_main_thread, common, "file-storage");
if (IS_ERR(common->thread_task)) {
+ int ret = PTR_ERR(common->thread_task);
+ common->thread_task = NULL;
common->state = FSG_STATE_TERMINATED;
- return PTR_ERR(common->thread_task);
+ return ret;
}
DBG(common, "I/O thread pid: %d\n", task_pid_nr(common->thread_task));
@@ -3005,6 +3007,7 @@ static void fsg_common_release(struct kref *ref)
if (common->state != FSG_STATE_TERMINATED) {
raise_exception(common, FSG_STATE_EXIT);
wait_for_completion(&common->thread_notifier);
+ common->thread_task = NULL;
}
for (i = 0; i < ARRAY_SIZE(common->luns); ++i) {
@@ -3050,9 +3053,11 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
if (ret)
return ret;
fsg_common_set_inquiry_string(fsg->common, NULL, NULL);
- ret = fsg_common_run_thread(fsg->common);
- if (ret)
- return ret;
+ if (common->thread_task) {
+ ret = fsg_common_run_thread(fsg->common);
+ if (ret)
+ return ret;
+ }
}
fsg->gadget = gadget;
---- >8 ---------------------------------------------------------------
next prev parent reply other threads:[~2016-04-01 17:02 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-15 22:48 USB gadgets with configfs hang reboot Tony Lindgren
[not found] ` <20160115224839.GA19432-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-01-16 0:09 ` Tony Lindgren
2016-01-16 10:40 ` Ivaylo Dimitrov
[not found] ` <569A1E32.1020502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-01-18 16:16 ` Tony Lindgren
2016-03-23 18:24 ` Ivaylo Dimitrov
[not found] ` <56F2DF79.6010903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-24 6:50 ` Felipe Balbi
[not found] ` <87fuvgxtc3.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-24 7:03 ` Ivaylo Dimitrov
[not found] ` <56F3914B.4010206-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-24 7:11 ` Felipe Balbi
[not found] ` <87a8loxsdm.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-24 18:46 ` Ivaylo Dimitrov
[not found] ` <56F4361C.9040907-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-30 10:22 ` Felipe Balbi
[not found] ` <877fgkqn8c.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-30 13:29 ` Ivaylo Dimitrov
[not found] ` <56FBD4BF.6090905-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-30 13:38 ` Felipe Balbi
[not found] ` <87h9fohyr1.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-30 14:01 ` Ivaylo Dimitrov
[not found] ` <56FBDC51.9020602-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-30 14:33 ` Pali Rohár
2016-03-30 18:50 ` Ivaylo Dimitrov
[not found] ` <56FC1FD8.6090003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-30 18:54 ` Ivaylo Dimitrov
2016-03-30 19:25 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1603301509180.2194-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-03-30 19:41 ` Tony Lindgren
2016-03-31 16:32 ` Ivaylo Dimitrov
[not found] ` <56FD512C.2070108-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-31 17:00 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1603311255560.1516-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-04-01 17:02 ` Michal Nazarewicz [this message]
[not found] ` <xa1tmvpdz2h4.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
2016-04-01 19:18 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1604011452580.1957-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-04-01 22:16 ` Michal Nazarewicz
[not found] ` <xa1tbn5tynyp.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
2016-04-02 14:55 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1604021031030.19366-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-04-04 12:57 ` Michal Nazarewicz
[not found] ` <xa1ty48tilai.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
2016-04-04 15:04 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1604041038510.1704-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-04-04 18:18 ` Michal Nazarewicz
[not found] ` <xa1ttwjhi6fo.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
2016-04-04 19:37 ` Alan Stern
2016-04-04 16:18 ` Ivaylo Dimitrov
[not found] ` <570293E8.2060406-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-04 18:48 ` Michal Nazarewicz
2016-04-05 15:18 ` Michal Nazarewicz
2016-04-04 4:45 ` Felipe Balbi
2016-04-04 4:41 ` Felipe Balbi
2016-04-08 20:13 ` Ivaylo Dimitrov
[not found] ` <57081105.2050206-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-18 7:02 ` Ivaylo Dimitrov
[not found] ` <571486A1.2060006-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-06 12:32 ` Pali Rohár
2016-04-18 7:55 ` Felipe Balbi
[not found] ` <87oa97gxkw.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-25 19:00 ` Ivaylo Dimitrov
[not found] ` <571E6943.30305-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-26 6:22 ` Felipe Balbi
[not found] ` <87a8kgrisz.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-26 15:03 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1604261102000.2038-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-04-26 16:44 ` Ivaylo Dimitrov
[not found] ` <571F9AD4.8010900-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-26 16:49 ` Tony Lindgren
[not found] ` <20160426164918.GA5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-04-26 18:13 ` Ivaylo Dimitrov
2016-01-22 10:35 ` Andrzej Pietrasiewicz
[not found] ` <56A205E4.6050305-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-01-22 18:28 ` Tony Lindgren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xa1tmvpdz2h4.fsf@mina86.com \
--to=mina86-deaty8a+uhjqt0dzr+alfa@public.gmane.org \
--cc=andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=b-liu-l0cyMroinI0@public.gmane.org \
--cc=felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=r.baldyga-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.