2012-12-09 17:13:28 +00:00
|
|
|
From: Ben Hutchings <ben@decadent.org.uk>
|
|
|
|
Subject: firmware_class: Log every success and failure against given device
|
|
|
|
Date: Sun, 09 Dec 2012 16:02:00 +0000
|
2013-07-01 01:12:30 +00:00
|
|
|
Forwarded: no
|
2012-12-09 17:13:28 +00:00
|
|
|
|
|
|
|
The hundreds of users of request_firmware() have nearly as many
|
|
|
|
different log formats for reporting failures. They also have only the
|
|
|
|
vaguest hint as to what went wrong; only firmware_class really knows
|
|
|
|
that. Therefore, add specific log messages for the failure modes that
|
|
|
|
aren't currently logged.
|
|
|
|
|
|
|
|
In case of a driver that tries multiple names, this may result in the
|
|
|
|
impression that it failed to initialise. Therefore, also log successes.
|
|
|
|
|
|
|
|
This makes many error messages in drivers redundant, which will be
|
|
|
|
removed in later patches.
|
|
|
|
|
2013-12-14 17:40:47 +00:00
|
|
|
This does not cover the case where we fall back to a user-mode helper
|
|
|
|
(which is no longer enabled in Debian).
|
|
|
|
---
|
2012-12-09 17:13:28 +00:00
|
|
|
--- a/drivers/base/firmware_class.c
|
|
|
|
+++ b/drivers/base/firmware_class.c
|
2014-03-06 02:36:41 +00:00
|
|
|
@@ -344,17 +344,20 @@ static int fw_get_filesystem_firmware(st
|
2012-12-09 17:13:28 +00:00
|
|
|
}
|
2013-12-21 19:24:24 +00:00
|
|
|
rc = fw_read_file_contents(file, buf);
|
|
|
|
fput(file);
|
|
|
|
- if (rc)
|
|
|
|
- dev_warn(device, "firmware, attempted to load %s, but failed with error %d\n",
|
|
|
|
+ if (!rc)
|
|
|
|
+ dev_dbg(device, "firmware, attempted to load %s, but failed with error %d\n",
|
|
|
|
path, rc);
|
|
|
|
else
|
|
|
|
break;
|
2012-12-10 04:06:21 +00:00
|
|
|
}
|
2013-12-14 17:40:47 +00:00
|
|
|
__putname(path);
|
2012-12-10 04:06:21 +00:00
|
|
|
|
2013-12-21 19:24:24 +00:00
|
|
|
- if (!rc) {
|
2013-12-14 17:40:47 +00:00
|
|
|
- dev_dbg(device, "firmware: direct-loading firmware %s\n",
|
|
|
|
- buf->fw_id);
|
2013-12-21 19:24:24 +00:00
|
|
|
+ if (rc) {
|
2013-12-14 17:40:47 +00:00
|
|
|
+ dev_err(device, "firmware: failed to load %s (%d)\n",
|
2013-12-21 19:24:24 +00:00
|
|
|
+ buf->fw_id, rc);
|
2013-12-14 17:40:47 +00:00
|
|
|
+ } else {
|
|
|
|
+ dev_info(device, "firmware: direct-loading firmware %s\n",
|
|
|
|
+ buf->fw_id);
|
2013-09-29 23:45:05 +00:00
|
|
|
mutex_lock(&fw_lock);
|
2013-12-14 17:40:47 +00:00
|
|
|
set_bit(FW_STATUS_DONE, &buf->status);
|
|
|
|
complete_all(&buf->completion);
|
2014-03-06 02:36:41 +00:00
|
|
|
@@ -1007,7 +1010,8 @@ _request_firmware_prepare(struct firmwar
|
2013-05-06 21:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fw_get_builtin_firmware(firmware, name)) {
|
|
|
|
- dev_dbg(device, "firmware: using built-in firmware %s\n", name);
|
|
|
|
+ dev_info(device, "firmware: using built-in firmware %s\n",
|
|
|
|
+ name);
|
|
|
|
return 0; /* assigned */
|
|
|
|
}
|
|
|
|
|
2014-03-06 02:36:41 +00:00
|
|
|
@@ -1090,7 +1094,7 @@ _request_firmware(const struct firmware
|
|
|
|
if (opt_flags & FW_OPT_NOWAIT) {
|
2013-05-06 21:53:29 +00:00
|
|
|
timeout = usermodehelper_read_lock_wait(timeout);
|
|
|
|
if (!timeout) {
|
|
|
|
- dev_dbg(device, "firmware: %s loading timed out\n",
|
|
|
|
+ dev_err(device, "firmware: %s loading timed out\n",
|
|
|
|
name);
|
|
|
|
ret = -EBUSY;
|
|
|
|
goto out;
|