diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-01-31 05:13:57 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-03 20:57:40 -0500 |
commit | 807be03cae191cb88e2f267adcd49aba785c658b (patch) | |
tree | 2063de0e040c7985db3a70e26cfc9c19d899ab5b | |
parent | cd7239fab7d32e56909027bfb5a6c2d7d3d862f8 (diff) |
firmware: Ignore abort check when no user-helper is used
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.
Acked-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/base/firmware_class.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 51e62ca1d574..4a223fedcd73 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -454,6 +454,9 @@ static void fw_load_abort(struct firmware_priv *fw_priv) | |||
454 | complete_all(&buf->completion); | 454 | complete_all(&buf->completion); |
455 | } | 455 | } |
456 | 456 | ||
457 | #define is_fw_load_aborted(buf) \ | ||
458 | test_bit(FW_STATUS_ABORT, &(buf)->status) | ||
459 | |||
457 | static ssize_t firmware_timeout_show(struct class *class, | 460 | static ssize_t firmware_timeout_show(struct class *class, |
458 | struct class_attribute *attr, | 461 | struct class_attribute *attr, |
459 | char *buf) | 462 | char *buf) |
@@ -891,6 +894,10 @@ fw_load_from_user_helper(struct firmware *firmware, const char *name, | |||
891 | { | 894 | { |
892 | return -ENOENT; | 895 | return -ENOENT; |
893 | } | 896 | } |
897 | |||
898 | /* No abort during direct loading */ | ||
899 | #define is_fw_load_aborted(buf) false | ||
900 | |||
894 | #endif /* CONFIG_FW_LOADER_USER_HELPER */ | 901 | #endif /* CONFIG_FW_LOADER_USER_HELPER */ |
895 | 902 | ||
896 | 903 | ||
@@ -901,7 +908,7 @@ static int sync_cached_firmware_buf(struct firmware_buf *buf) | |||
901 | 908 | ||
902 | mutex_lock(&fw_lock); | 909 | mutex_lock(&fw_lock); |
903 | while (!test_bit(FW_STATUS_DONE, &buf->status)) { | 910 | while (!test_bit(FW_STATUS_DONE, &buf->status)) { |
904 | if (test_bit(FW_STATUS_ABORT, &buf->status)) { | 911 | if (is_fw_load_aborted(buf)) { |
905 | ret = -ENOENT; | 912 | ret = -ENOENT; |
906 | break; | 913 | break; |
907 | } | 914 | } |
@@ -963,7 +970,7 @@ static int assign_firmware_buf(struct firmware *fw, struct device *device) | |||
963 | struct firmware_buf *buf = fw->priv; | 970 | struct firmware_buf *buf = fw->priv; |
964 | 971 | ||
965 | mutex_lock(&fw_lock); | 972 | mutex_lock(&fw_lock); |
966 | if (!buf->size || test_bit(FW_STATUS_ABORT, &buf->status)) { | 973 | if (!buf->size || is_fw_load_aborted(buf)) { |
967 | mutex_unlock(&fw_lock); | 974 | mutex_unlock(&fw_lock); |
968 | return -ENOENT; | 975 | return -ENOENT; |
969 | } | 976 | } |