From: Ming Lei <ming.lei@canonical.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Greg KH <greg@kroah.com>,
linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
Takashi Iwai <tiwai@suse.de>
Subject: Re: linux-next: manual merge of the driver-core tree with the driver-core.current tree
Date: Thu, 20 Jun 2013 09:22:13 +0800 [thread overview]
Message-ID: <CACVXFVN-B7ZrqjoA_QNkWKjM0XdM-S08h-d6JuRjsYOX0YPt=A@mail.gmail.com> (raw)
In-Reply-To: <20130620110610.7d245d88b70620fa271a29f7@canb.auug.org.au>
Hi Stephen,
Thanks for your help.
On Thu, Jun 20, 2013 at 9:06 AM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Try "git diff-tree --cc e4b00d75ee3ed3af9fac83970d21e27d1ad4aa8d"
Greg, Stephen, so is sort of below generated patch what you expected?
If yes, I will send it out to you.
e4b00d75ee3ed3af9fac83970d21e27d1ad4aa8d
diff --cc drivers/base/firmware_class.c
index 6ede229,01e2103..7fefcb5
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@@ -452,35 -446,27 +452,52 @@@ static struct firmware_priv *to_firmwar
return container_of(dev, struct firmware_priv, dev);
}
- static void fw_load_abort(struct firmware_buf *buf)
-static void fw_load_abort(struct firmware_priv *fw_priv)
++static void __fw_load_abort(struct firmware_buf *buf)
{
- struct firmware_buf *buf = fw_priv->buf;
-
+ /*
+ * There is a small window in which user can write to 'loading'
+ * between loading done and disappearance of 'loading'
+ */
+ if (test_bit(FW_STATUS_DONE, &buf->status))
+ return;
+
+ list_del_init(&buf->pending_list);
set_bit(FW_STATUS_ABORT, &buf->status);
complete_all(&buf->completion);
+}
+
++static void fw_load_abort(struct firmware_priv *fw_priv)
++{
++ struct firmware_buf *buf = fw_priv->buf;
++
++ __fw_load_abort(buf);
+
+ /* avoid user action after loading abort */
+ fw_priv->buf = NULL;
+ }
+
#define is_fw_load_aborted(buf) \
test_bit(FW_STATUS_ABORT, &(buf)->status)
+static LIST_HEAD(pending_fw_head);
+
+/* reboot notifier for avoid deadlock with usermode_lock */
+static int fw_shutdown_notify(struct notifier_block *unused1,
+ unsigned long unused2, void *unused3)
+{
+ mutex_lock(&fw_lock);
+ while (!list_empty(&pending_fw_head))
- fw_load_abort(list_first_entry(&pending_fw_head,
++ __fw_load_abort(list_first_entry(&pending_fw_head,
+ struct firmware_buf,
+ pending_list));
+ mutex_unlock(&fw_lock);
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block fw_shutdown_nb = {
+ .notifier_call = fw_shutdown_notify,
+};
+
static ssize_t firmware_timeout_show(struct class *class,
struct class_attribute *attr,
char *buf)
@@@ -911,23 -895,6 +927,23 @@@ static int fw_load_from_user_helper(str
fw_priv->buf = firmware->priv;
return _request_firmware_load(fw_priv, uevent, timeout);
}
+
+#ifdef CONFIG_PM_SLEEP
+/* kill pending requests without uevent to avoid blocking suspend */
+static void kill_requests_without_uevent(void)
+{
+ struct firmware_buf *buf;
+ struct firmware_buf *next;
+
+ mutex_lock(&fw_lock);
+ list_for_each_entry_safe(buf, next, &pending_fw_head, pending_list) {
+ if (!buf->need_uevent)
- fw_load_abort(buf);
++ __fw_load_abort(buf);
+ }
+ mutex_unlock(&fw_lock);
+}
+#endif
+
#else /* CONFIG_FW_LOADER_USER_HELPER */
static inline int
fw_load_from_user_helper(struct firmware *firmware, const char *name,
Thanks,
--
Ming Lei
next prev parent reply other threads:[~2013-06-20 1:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 5:32 linux-next: manual merge of the driver-core tree with the driver-core.current tree Stephen Rothwell
2013-06-19 5:55 ` Greg KH
2013-06-19 6:58 ` Ming Lei
2013-06-19 14:39 ` Greg KH
2013-06-19 15:04 ` Ming Lei
2013-06-19 16:36 ` Greg KH
2013-06-20 0:23 ` Ming Lei
2013-06-20 1:06 ` Stephen Rothwell
2013-06-20 1:22 ` Ming Lei [this message]
2013-06-20 3:28 ` Greg KH
2013-06-20 3:46 ` Ming Lei
2013-06-20 3:49 ` Stephen Rothwell
2013-06-19 7:12 ` Stephen Rothwell
2013-06-19 7:21 ` Ming Lei
-- strict thread matches above, loose matches on Subject: below --
2020-04-30 4:25 Stephen Rothwell
2020-04-30 8:15 ` Greg KH
2013-12-09 3:47 Stephen Rothwell
2013-12-09 8:21 ` Greg KH
2012-02-03 3:51 Stephen Rothwell
2012-02-03 15:07 ` Greg KH
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='CACVXFVN-B7ZrqjoA_QNkWKjM0XdM-S08h-d6JuRjsYOX0YPt=A@mail.gmail.com' \
--to=ming.lei@canonical.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=tiwai@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).