Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

driver core: firmware loader: kill FW_ACTION_NOHOTPLUG requests before suspend

This patch kills the firmware loading requests of FW_ACTION_NOHOTPLUG
before suspend to avoid blocking suspend because there is no timeout
for these requests.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ming Lei and committed by
Greg Kroah-Hartman
af5bc11e e771d1aa

+17
+17
drivers/base/firmware_class.c
··· 128 128 size_t size; 129 129 #ifdef CONFIG_FW_LOADER_USER_HELPER 130 130 bool is_paged_buf; 131 + bool need_uevent; 131 132 struct page **pages; 132 133 int nr_pages; 133 134 int page_array_size; ··· 874 873 } 875 874 876 875 if (uevent) { 876 + buf->need_uevent = true; 877 877 dev_set_uevent_suppress(f_dev, false); 878 878 dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id); 879 879 if (timeout != MAX_SCHEDULE_TIMEOUT) ··· 1414 1412 spin_unlock(&fwc->name_lock); 1415 1413 } 1416 1414 1415 + /* kill pending requests without uevent to avoid blocking suspend */ 1416 + static void kill_requests_without_uevent(void) 1417 + { 1418 + struct firmware_buf *buf; 1419 + struct firmware_buf *next; 1420 + 1421 + mutex_lock(&fw_lock); 1422 + list_for_each_entry_safe(buf, next, &pending_fw_head, pending_list) { 1423 + if (!buf->need_uevent) 1424 + fw_load_abort(buf); 1425 + } 1426 + mutex_unlock(&fw_lock); 1427 + } 1428 + 1417 1429 /** 1418 1430 * device_cache_fw_images - cache devices' firmware 1419 1431 * ··· 1507 1491 switch (mode) { 1508 1492 case PM_HIBERNATION_PREPARE: 1509 1493 case PM_SUSPEND_PREPARE: 1494 + kill_requests_without_uevent(); 1510 1495 device_cache_fw_images(); 1511 1496 break; 1512 1497