firmware: log the firmware name that failed to load
[pandora-kernel.git] / drivers / base / firmware_class.c
index 06ed6b4..cd3206e 100644 (file)
@@ -79,7 +79,7 @@ enum {
        FW_STATUS_ABORT,
 };
 
-static int loading_timeout = 60;       /* In seconds */
+static int loading_timeout = 10;       /* In seconds */
 
 /* fw_lock could be moved to 'struct firmware_priv' but since it is just
  * guarding for corner cases a global lock should be OK */
@@ -226,13 +226,13 @@ static ssize_t firmware_loading_store(struct device *dev,
        int loading = simple_strtol(buf, NULL, 10);
        int i;
 
+       mutex_lock(&fw_lock);
+
+       if (!fw_priv->fw)
+               goto out;
+
        switch (loading) {
        case 1:
-               mutex_lock(&fw_lock);
-               if (!fw_priv->fw) {
-                       mutex_unlock(&fw_lock);
-                       break;
-               }
                firmware_free_data(fw_priv->fw);
                memset(fw_priv->fw, 0, sizeof(struct firmware));
                /* If the pages are not owned by 'struct firmware' */
@@ -243,7 +243,6 @@ static ssize_t firmware_loading_store(struct device *dev,
                fw_priv->page_array_size = 0;
                fw_priv->nr_pages = 0;
                set_bit(FW_STATUS_LOADING, &fw_priv->status);
-               mutex_unlock(&fw_lock);
                break;
        case 0:
                if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) {
@@ -274,7 +273,8 @@ static ssize_t firmware_loading_store(struct device *dev,
                fw_load_abort(fw_priv);
                break;
        }
-
+out:
+       mutex_unlock(&fw_lock);
        return count;
 }
 
@@ -541,7 +541,7 @@ static int _request_firmware(const struct firmware **firmware_p,
        }
 
        if (uevent)
-               dev_dbg(device, "firmware: requesting %s\n", name);
+               dev_info(device, "firmware: requesting %s\n", name);
 
        fw_priv = fw_create_instance(firmware, name, device, uevent, nowait);
        if (IS_ERR(fw_priv)) {
@@ -573,6 +573,7 @@ static int _request_firmware(const struct firmware **firmware_p,
 
 out:
        if (retval) {
+               dev_warn(device, "firmware: failed to get '%s'\n", name);
                release_firmware(firmware);
                *firmware_p = NULL;
        }