FW_STATUS_ABORT can be set only during the user-helper invocation,
thus we can ignore the check when CONFIG_HW_LOADER_USER_HELPER is
disabled.

Signed-off-by: Takashi Iwai <ti...@suse.de>
---
 drivers/base/firmware_class.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 8c40257..9753a78 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -447,6 +447,9 @@ static void fw_load_abort(struct firmware_priv *fw_priv)
        complete_all(&buf->completion);
 }
 
+#define is_fw_load_aborted(buf)        \
+       test_bit(FW_STATUS_ABORT, &(buf)->status)
+
 static int loading_timeout = 60;       /* In seconds */
 
 static inline long firmware_loading_timeout(void)
@@ -914,6 +917,10 @@ fw_load_from_user_helper(struct firmware *firmware, const 
char *name,
 {
        return -ENOENT;
 }
+
+/* No abort during direct loading */
+#define is_fw_load_aborted(buf) false
+
 #endif /* CONFIG_FW_LOADER_USER_HELPER */
 
 
@@ -924,7 +931,7 @@ static int sync_cached_firmware_buf(struct firmware_buf 
*buf)
 
        mutex_lock(&fw_lock);
        while (!test_bit(FW_STATUS_DONE, &buf->status)) {
-               if (test_bit(FW_STATUS_ABORT, &buf->status)) {
+               if (is_fw_load_aborted(buf)) {
                        ret = -ENOENT;
                        break;
                }
@@ -986,7 +993,7 @@ static int assign_firmware_buf(struct firmware *fw, struct 
device *device)
        struct firmware_buf *buf = fw->priv;
 
        mutex_lock(&fw_lock);
-       if (!buf->size || test_bit(FW_STATUS_ABORT, &buf->status)) {
+       if (!buf->size || is_fw_load_aborted(buf)) {
                mutex_unlock(&fw_lock);
                return -ENOENT;
        }
-- 
1.8.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to