summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorNeil Gabriel <ngabriel@nvidia.com>2014-01-21 12:03:59 -0600
committerMitch Luban <mluban@nvidia.com>2014-02-06 09:20:45 -0800
commit50ba73a322afff1e63d1cc2880bef7c907db98d6 (patch)
treea78e7b230d8abe8adfb4741562866c0e5d5d9929 /drivers/base
parent81f64d13a288a84218b0f31239ed195d8ba5840c (diff)
Attempt kernel firmware load before going to udev.
request_firmware() should fall back to usermodehelper routines to load firmware only after a failed attempt to load it directly. Prior to this change, the code will attempt to lock the usermodehelper state before attempting to load the firmware directly. If the usermodehelper is disabled, the lock attempts will fail and request_firmware() will exit without even attempting a direct load. Bug 1403956 Change-Id: I26c502d30657eab3d382d139618f9daa366068cf Signed-off-by: Neil Gabriel <ngabriel@nvidia.com> Reviewed-on: http://git-master/r/358303 Reviewed-by: Mitch Luban <mluban@nvidia.com> Reviewed-on: http://git-master/r/362065
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/firmware_class.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 01e21037d8fe..cbb8b0015e03 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -1026,32 +1026,34 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
goto out;
ret = 0;
- timeout = firmware_loading_timeout();
- if (nowait) {
- timeout = usermodehelper_read_lock_wait(timeout);
- if (!timeout) {
- dev_dbg(device, "firmware: %s loading timed out\n",
- name);
- ret = -EBUSY;
- goto out;
- }
- } else {
- ret = usermodehelper_read_trylock();
- if (WARN_ON(ret)) {
- dev_err(device, "firmware: %s will not be loaded\n",
- name);
- goto out;
+ if (!fw_get_filesystem_firmware(device, fw->priv)) {
+ timeout = firmware_loading_timeout();
+ if (nowait) {
+ timeout = usermodehelper_read_lock_wait(timeout);
+ if (!timeout) {
+ dev_dbg(device, "firmware: %s loading timed out\n",
+ name);
+ ret = -EBUSY;
+ goto out;
+ }
+ } else {
+ ret = usermodehelper_read_trylock();
+ if (WARN_ON(ret)) {
+ dev_err(device, "firmware: %s will not be loaded\n",
+ name);
+ goto out;
+ }
}
- }
- if (!fw_get_filesystem_firmware(device, fw->priv))
ret = fw_load_from_user_helper(fw, name, device,
uevent, nowait, timeout);
+
+ usermodehelper_read_unlock();
+ }
+
if (!ret)
ret = assign_firmware_buf(fw, device);
- usermodehelper_read_unlock();
-
out:
if (ret < 0) {
release_firmware(fw);