[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVXFVN-B7ZrqjoA_QNkWKjM0XdM-S08h-d6JuRjsYOX0YPt=A@mail.gmail.com>
Date: Thu, 20 Jun 2013 09:22:13 +0800
From: Ming Lei <ming.lei@...onical.com>
To: Stephen Rothwell <sfr@...b.auug.org.au>
Cc: Greg KH <greg@...ah.com>, linux-next@...r.kernel.org,
linux-kernel@...r.kernel.org, Takashi Iwai <tiwai@...e.de>
Subject: Re: linux-next: manual merge of the driver-core tree with the
driver-core.current tree
Hi Stephen,
Thanks for your help.
On Thu, Jun 20, 2013 at 9:06 AM, Stephen Rothwell <sfr@...b.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists