firmware_class: Log every success and failure against given device
authorBen Hutchings <ben@decadent.org.uk>
Sun, 9 Dec 2012 16:02:00 +0000 (16:02 +0000)
committerSalvatore Bonaccorso <carnil@debian.org>
Mon, 18 Apr 2022 12:36:36 +0000 (13:36 +0100)
Forwarded: no

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.

This does not cover the case where we fall back to a user-mode helper
(which is no longer enabled in Debian).

NOTE: hw-detect will depend on the "firmware: failed to load %s (%d)\n"
format to detect missing firmware.

Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name firmware_class-log-every-success-and-failure.patch

drivers/base/firmware_loader/fallback.c
drivers/base/firmware_loader/main.c

index 4afb0e9312c094f9b0e8dfdc8fb8d415e2d4fbd3..ba28c434dcfd16c63087e543cb9c888655d36371 100644 (file)
@@ -565,7 +565,7 @@ static int fw_load_from_user_helper(struct firmware *firmware,
        if (opt_flags & FW_OPT_NOWAIT) {
                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);
                        return -EBUSY;
                }
index 94d1789a233e0f436e51cc9d214c139bb8dceb80..f92f5a0c0ee8cfe1fc325774bfc95e506a5f641f 100644 (file)
@@ -478,18 +478,15 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv,
                                                       file_size_ptr,
                                                       READING_FIRMWARE);
                if (rc < 0) {
-                       if (rc != -ENOENT)
-                               dev_warn(device, "loading %s failed with error %d\n",
-                                        path, rc);
-                       else
-                               dev_dbg(device, "loading %s failed for no such file or directory.\n",
-                                        path);
+                       dev_dbg(device, "loading %s failed with error %d\n",
+                               path, rc);
                        continue;
                }
                size = rc;
                rc = 0;
 
-               dev_dbg(device, "Loading firmware from %s\n", path);
+               dev_info(device, "firmware: direct-loading firmware %s\n",
+                        fw_priv->fw_name);
                if (decompress) {
                        dev_dbg(device, "f/w decompressing %s\n",
                                fw_priv->fw_name);
@@ -502,8 +499,6 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv,
                                continue;
                        }
                } else {
-                       dev_dbg(device, "direct-loading %s\n",
-                               fw_priv->fw_name);
                        if (!fw_priv->data)
                                fw_priv->data = buffer;
                        fw_priv->size = size;
@@ -513,6 +508,10 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv,
        }
        __putname(path);
 
+       if (rc)
+               dev_err(device, "firmware: failed to load %s (%d)\n",
+                       fw_priv->fw_name, rc);
+
        return rc;
 }