Skip to content

Commit e771d1a

Browse files
Ming Leigregkh
authored andcommitted
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>
1 parent f8878dc commit e771d1a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎drivers/base/firmware_class.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,8 @@ _request_firmware_prepare(struct firmware **firmware_p, const char *name,
993993
return 1; /* need to load */
994994
}
995995

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)
997998
{
998999
struct firmware_buf *buf = fw->priv;
9991000

@@ -1010,7 +1011,7 @@ static int assign_firmware_buf(struct firmware *fw, struct device *device)
10101011
* device may has been deleted already, but the problem
10111012
* should be fixed in devres or driver core.
10121013
*/
1013-
if (device)
1014+
if (device && !skip_cache)
10141015
fw_add_devm_name(device, buf->fw_id);
10151016

10161017
/*
@@ -1066,8 +1067,10 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
10661067
if (!fw_get_filesystem_firmware(device, fw->priv))
10671068
ret = fw_load_from_user_helper(fw, name, device,
10681069
uevent, nowait, timeout);
1070+
1071+
/* don't cache firmware handled without uevent */
10691072
if (!ret)
1070-
ret = assign_firmware_buf(fw, device);
1073+
ret = assign_firmware_buf(fw, device, !uevent);
10711074

10721075
usermodehelper_read_unlock();
10731076

0 commit comments

Comments
 (0)