summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2015-01-13 00:02:01 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-02-03 15:33:10 -0800
commit68ff2a00dbf590dc9483c20f85fd1f1faa054604 (patch)
tree43502001a0d21b0eb71c5df2109f392556f1f923 /drivers/base
parent0cb64249ca50033ec22e63582837f94202c63d9f (diff)
downloadlinux-68ff2a00dbf590dc9483c20f85fd1f1faa054604.tar.bz2
firmware_loader: handle timeout via wait_for_completion_interruptible_timeout()
It is simpler to handle timeout by wait_for_completion_interruptible_timeout(), so remove previous delay work for timeout. Signed-off-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/firmware_class.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 5870ec35efe6..60ac9c3f7f48 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -94,7 +94,7 @@ static int loading_timeout = 60; /* In seconds */
static inline long firmware_loading_timeout(void)
{
- return loading_timeout > 0 ? loading_timeout * HZ : MAX_SCHEDULE_TIMEOUT;
+ return loading_timeout > 0 ? loading_timeout * HZ : MAX_JIFFY_OFFSET;
}
/* firmware behavior options */
@@ -446,7 +446,6 @@ static int fw_add_devm_name(struct device *dev, const char *name)
*/
#ifdef CONFIG_FW_LOADER_USER_HELPER
struct firmware_priv {
- struct delayed_work timeout_work;
bool nowait;
struct device dev;
struct firmware_buf *buf;
@@ -836,16 +835,6 @@ static struct bin_attribute firmware_attr_data = {
.write = firmware_data_write,
};
-static void firmware_class_timeout_work(struct work_struct *work)
-{
- struct firmware_priv *fw_priv = container_of(work,
- struct firmware_priv, timeout_work.work);
-
- mutex_lock(&fw_lock);
- fw_load_abort(fw_priv);
- mutex_unlock(&fw_lock);
-}
-
static struct firmware_priv *
fw_create_instance(struct firmware *firmware, const char *fw_name,
struct device *device, unsigned int opt_flags)
@@ -862,9 +851,6 @@ fw_create_instance(struct firmware *firmware, const char *fw_name,
fw_priv->nowait = !!(opt_flags & FW_OPT_NOWAIT);
fw_priv->fw = firmware;
- INIT_DELAYED_WORK(&fw_priv->timeout_work,
- firmware_class_timeout_work);
-
f_dev = &fw_priv->dev;
device_initialize(f_dev);
@@ -917,18 +903,14 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
buf->need_uevent = true;
dev_set_uevent_suppress(f_dev, false);
dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id);
- if (timeout != MAX_SCHEDULE_TIMEOUT)
- queue_delayed_work(system_power_efficient_wq,
- &fw_priv->timeout_work, timeout);
-
kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD);
+ } else {
+ timeout = MAX_JIFFY_OFFSET;
}
- retval = wait_for_completion_interruptible(&buf->completion);
-
- cancel_delayed_work_sync(&fw_priv->timeout_work);
-
- if (retval == -ERESTARTSYS) {
+ retval = wait_for_completion_interruptible_timeout(&buf->completion,
+ timeout);
+ if (retval == -ERESTARTSYS || !retval) {
mutex_lock(&fw_lock);
fw_load_abort(fw_priv);
mutex_unlock(&fw_lock);