Skip to content

Commit

Permalink
firmware: add helper to check to see if fw cache is setup
Browse files Browse the repository at this point in the history
Add a helper to check if the firmware cache is already setup for a device.
This will be used later.

Signed-off-by: Luis R. Rodriguez <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
mcgrof authored and gregkh committed Mar 20, 2018
1 parent d15d731 commit 3194d06
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions drivers/base/firmware_loader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,23 @@ static struct fw_name_devm *fw_find_devm_name(struct device *dev,
return fwn;
}

/* add firmware name into devres list */
static int fw_add_devm_name(struct device *dev, const char *name)
static bool fw_cache_is_setup(struct device *dev, const char *name)
{
struct fw_name_devm *fwn;

fwn = fw_find_devm_name(dev, name);
if (fwn)
return true;

return false;
}

/* add firmware name into devres list */
static int fw_add_devm_name(struct device *dev, const char *name)
{
struct fw_name_devm *fwn;

if (fw_cache_is_setup(dev, name))
return 0;

fwn = devres_alloc(fw_name_devm_release, sizeof(struct fw_name_devm),
Expand Down

0 comments on commit 3194d06

Please sign in to comment.