firmware_class-log-every-success-and-failure.patch 2.06 KB
Newer Older
1 2 3
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
4
Forwarded: no
5 6 7 8 9 10 11 12 13 14 15 16 17

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.

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

NOTE: hw-detect will depend on the "firmware: failed to load %s (%d)\n"
format to detect missing firmware.
23
---
24 25
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
Ben Hutchings's avatar
Ben Hutchings committed
26 27 28
@@ -443,21 +443,22 @@ fw_get_filesystem_firmware(struct device
 		rc = kernel_read_file_from_path(path, &fw_priv->data, &size,
 						msize, id);
Ben Hutchings's avatar
Ben Hutchings committed
29 30 31 32 33 34 35 36 37 38 39
 		if (rc) {
-			if (rc == -ENOENT)
-				dev_dbg(device, "loading %s failed with error %d\n",
-					 path, rc);
-			else
-				dev_warn(device, "loading %s failed with error %d\n",
-					 path, rc);
+			dev_dbg(device, "loading %s failed with error %d\n",
+				path, rc);
 			continue;
 		}
Ben Hutchings's avatar
Ben Hutchings committed
40
-		dev_dbg(device, "direct-loading %s\n", fw_priv->fw_name);
Ben Hutchings's avatar
Ben Hutchings committed
41
+		dev_info(device, "firmware: direct-loading firmware %s\n",
Ben Hutchings's avatar
Ben Hutchings committed
42 43 44
+			 fw_priv->fw_name);
 		fw_priv->size = size;
 		fw_state_done(fw_priv);
Ben Hutchings's avatar
Ben Hutchings committed
45
 		break;
46
 	}
47
 	__putname(path);
48
 
Ben Hutchings's avatar
Ben Hutchings committed
49
+	if (rc)
50
+		dev_err(device, "firmware: failed to load %s (%d)\n",
Ben Hutchings's avatar
Ben Hutchings committed
51
+			fw_priv->fw_name, rc);
Ben Hutchings's avatar
Ben Hutchings committed
52 53 54
+
 	return rc;
 }
Ben Hutchings's avatar
Ben Hutchings committed
55
 
Ben Hutchings's avatar
Ben Hutchings committed
56
@@ -1120,7 +1121,7 @@ static int fw_load_from_user_helper(stru
Ben Hutchings's avatar
Ben Hutchings committed
57
 	if (opt_flags & FW_OPT_NOWAIT) {
Ben Hutchings's avatar
Ben Hutchings committed
58 59 60 61 62
 		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);
Ben Hutchings's avatar
Ben Hutchings committed
63 64
 			return -EBUSY;
 		}