diff options
-rw-r--r-- | drivers/base/firmware_class.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index f3c6434b586b..c4150431185f 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -128,6 +128,7 @@ struct firmware_buf { | |||
128 | size_t size; | 128 | size_t size; |
129 | #ifdef CONFIG_FW_LOADER_USER_HELPER | 129 | #ifdef CONFIG_FW_LOADER_USER_HELPER |
130 | bool is_paged_buf; | 130 | bool is_paged_buf; |
131 | bool need_uevent; | ||
131 | struct page **pages; | 132 | struct page **pages; |
132 | int nr_pages; | 133 | int nr_pages; |
133 | int page_array_size; | 134 | int page_array_size; |
@@ -873,6 +874,7 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
873 | } | 874 | } |
874 | 875 | ||
875 | if (uevent) { | 876 | if (uevent) { |
877 | buf->need_uevent = true; | ||
876 | dev_set_uevent_suppress(f_dev, false); | 878 | dev_set_uevent_suppress(f_dev, false); |
877 | dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id); | 879 | dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id); |
878 | if (timeout != MAX_SCHEDULE_TIMEOUT) | 880 | if (timeout != MAX_SCHEDULE_TIMEOUT) |
@@ -1412,6 +1414,20 @@ static void __device_uncache_fw_images(void) | |||
1412 | spin_unlock(&fwc->name_lock); | 1414 | spin_unlock(&fwc->name_lock); |
1413 | } | 1415 | } |
1414 | 1416 | ||
1417 | /* kill pending requests without uevent to avoid blocking suspend */ | ||
1418 | static void kill_requests_without_uevent(void) | ||
1419 | { | ||
1420 | struct firmware_buf *buf; | ||
1421 | struct firmware_buf *next; | ||
1422 | |||
1423 | mutex_lock(&fw_lock); | ||
1424 | list_for_each_entry_safe(buf, next, &pending_fw_head, pending_list) { | ||
1425 | if (!buf->need_uevent) | ||
1426 | fw_load_abort(buf); | ||
1427 | } | ||
1428 | mutex_unlock(&fw_lock); | ||
1429 | } | ||
1430 | |||
1415 | /** | 1431 | /** |
1416 | * device_cache_fw_images - cache devices' firmware | 1432 | * device_cache_fw_images - cache devices' firmware |
1417 | * | 1433 | * |
@@ -1491,6 +1507,7 @@ static int fw_pm_notify(struct notifier_block *notify_block, | |||
1491 | switch (mode) { | 1507 | switch (mode) { |
1492 | case PM_HIBERNATION_PREPARE: | 1508 | case PM_HIBERNATION_PREPARE: |
1493 | case PM_SUSPEND_PREPARE: | 1509 | case PM_SUSPEND_PREPARE: |
1510 | kill_requests_without_uevent(); | ||
1494 | device_cache_fw_images(); | 1511 | device_cache_fw_images(); |
1495 | break; | 1512 | break; |
1496 | 1513 | ||