diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-15 11:11:47 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-15 11:11:47 -0800 |
commit | 9682ec9692e5ac11c6caebd079324e727b19e7ce (patch) | |
tree | 16b25351557cd028913fc2c225e2db0175d750b6 /drivers/base/firmware_class.c | |
parent | 4ba63072b998cc31515cc6305c25f3b808b50c01 (diff) | |
parent | adf305f77878880fa5868a7179979da93be68d83 (diff) | |
download | linux-stable-9682ec9692e5ac11c6caebd079324e727b19e7ce.tar.gz linux-stable-9682ec9692e5ac11c6caebd079324e727b19e7ce.tar.bz2 linux-stable-9682ec9692e5ac11c6caebd079324e727b19e7ce.zip |
Merge tag 'driver-core-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core patches from Greg KH:
"Really tiny set of patches for this kernel. Nothing major, all
described in the shortlog and have been in linux-next for a while"
* tag 'driver-core-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
sysfs: fix warning when creating a sysfs group without attributes
firmware_loader: handle timeout via wait_for_completion_interruptible_timeout()
firmware_loader: abort request if wait_for_completion is interrupted
firmware: Correct function name in comment
device: Change dev_<level> logging functions to return void
device: Fix dev_dbg_once macro
Diffstat (limited to 'drivers/base/firmware_class.c')
-rw-r--r-- | drivers/base/firmware_class.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index c3293f0a8573..6c5c9edf5ff6 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) @@ -861,9 +850,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); @@ -916,16 +902,19 @@ 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); + 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); + } - cancel_delayed_work_sync(&fw_priv->timeout_work); if (is_fw_load_aborted(buf)) retval = -EAGAIN; else if (!buf->data) @@ -1193,7 +1182,7 @@ request_firmware(const struct firmware **firmware_p, const char *name, EXPORT_SYMBOL(request_firmware); /** - * request_firmware: - load firmware directly without usermode helper + * request_firmware_direct: - load firmware directly without usermode helper * @firmware_p: pointer to firmware image * @name: name of firmware file * @device: device for which firmware is being loaded |