Skip to content

Commit

Permalink
driver core: firmware loader: don't cache FW_ACTION_NOHOTPLUG firmware
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ming Lei authored and Greg Kroah-Hartman committed Jun 3, 2013
1 parent f8878dc commit e771d1a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/base/firmware_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,8 @@ _request_firmware_prepare(struct firmware **firmware_p, const char *name,
return 1; /* need to load */
}

static int assign_firmware_buf(struct firmware *fw, struct device *device)
static int assign_firmware_buf(struct firmware *fw, struct device *device,
bool skip_cache)
{
struct firmware_buf *buf = fw->priv;

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

/*
Expand Down Expand Up @@ -1066,8 +1067,10 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
if (!fw_get_filesystem_firmware(device, fw->priv))
ret = fw_load_from_user_helper(fw, name, device,
uevent, nowait, timeout);

/* don't cache firmware handled without uevent */
if (!ret)
ret = assign_firmware_buf(fw, device);
ret = assign_firmware_buf(fw, device, !uevent);

usermodehelper_read_unlock();

Expand Down

0 comments on commit e771d1a

Please sign in to comment.