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

driver core: firmware loader: don't cache FW_ACTION_NOHOTPLUG firmware

Generally there are only two drivers which don't need uevent to
handle firmware loading, so don't cache these firmwares during
suspend for these drivers since doing that may block firmware
loading forever.

Both the two drivers are involved in private firmware images, so
they don't hit in direct loading too.

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
e771d1aa f8878dcb

+6 -3
+6 -3
drivers/base/firmware_class.c
··· 993 993 return 1; /* need to load */ 994 994 } 995 995 996 - static int assign_firmware_buf(struct firmware *fw, struct device *device) 996 + static int assign_firmware_buf(struct firmware *fw, struct device *device, 997 + bool skip_cache) 997 998 { 998 999 struct firmware_buf *buf = fw->priv; 999 1000 ··· 1011 1010 * device may has been deleted already, but the problem 1012 1011 * should be fixed in devres or driver core. 1013 1012 */ 1014 - if (device) 1013 + if (device && !skip_cache) 1015 1014 fw_add_devm_name(device, buf->fw_id); 1016 1015 1017 1016 /* ··· 1067 1066 if (!fw_get_filesystem_firmware(device, fw->priv)) 1068 1067 ret = fw_load_from_user_helper(fw, name, device, 1069 1068 uevent, nowait, timeout); 1069 + 1070 + /* don't cache firmware handled without uevent */ 1070 1071 if (!ret) 1071 - ret = assign_firmware_buf(fw, device); 1072 + ret = assign_firmware_buf(fw, device, !uevent); 1072 1073 1073 1074 usermodehelper_read_unlock(); 1074 1075