aboutsummaryrefslogtreecommitdiff
path: root/drivers/base/firmware_loader/main.c
AgeCommit message (Collapse)AuthorFilesLines
2018-05-14firmware: add firmware_request_nowarn() - load firmware without warningsAndres Rodriguez1-0/+27
Currently the firmware loader only exposes one silent path for querying optional firmware, and that is firmware_request_direct(). This function also disables the sysfs fallback mechanism, which might not always be the desired behaviour [0]. This patch introduces a variations of request_firmware() that enable the caller to disable the undesired warning messages but enables the sysfs fallback mechanism. This is equivalent to adding FW_OPT_NO_WARN to the old behaviour. [0]: https://git.kernel.org/linus/c0cc00f250e1 Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Luis R. Rodriguez <[email protected]> [mcgrof: used the old API calls as the full rename is not done yet, and add the caller for when FW_LOADER is disabled, enhance documentation ] Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-05-14firmware: rename fw_sysfs_fallback to firmware_fallback_sysfs()Andres Rodriguez1-1/+1
This is done since this call is now exposed through kernel-doc, and since this also paves the way for different future types of fallback mechanims. Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Luis R. Rodriguez <[email protected]> [mcgrof: small coding style changes] Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-05-14firmware: use () to terminate kernel-doc function namesAndres Rodriguez1-11/+11
The kernel-doc spec dictates a function name ends in (). Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Randy Dunlap <[email protected]> Acked-by: Luis R. Rodriguez <[email protected]> [mcgrof: adjust since the wide API rename is not yet merged] Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-05-14firmware: wrap FW_OPT_* into an enumAndres Rodriguez1-3/+3
This should let us associate enum kdoc to these values. While at it, kdocify the fw_opt. Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Luis R. Rodriguez <[email protected]> [mcgrof: coding style fixes, merge kdoc with enum move] Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-22firmware: add firmware_request_cache() to help with cache on rebootLuis R. Rodriguez1-0/+24
Some devices have an optimization in place to enable the firmware to be retaineed during a system reboot, so after reboot the device can skip requesting and loading the firmware. This can save up to 1s in load time. The mt7601u 802.11 device happens to be such a device. When these devices retain the firmware on a reboot and then suspend they can miss looking for the firmware on resume. To help with this we need a way to cache the firmware when such an optimization has taken place. Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-20firmware: ensure the firmware cache is not used on incompatible callsLuis R. Rodriguez1-0/+14
request_firmware_into_buf() explicitly disables the firmware cache, meanwhile the firmware cache cannot be used when request_firmware_nowait() is used without the uevent. Enforce a sanity check for this to avoid future issues undocumented behaviours should misuses of the firmware cache happen later. One of the reasons we want to enforce this is the firmware cache is used for helping with suspend/resume, and if incompatible calls use it they can stall suspend. Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-20firmware: add helper to check to see if fw cache is setupLuis R. Rodriguez1-2/+12
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]>
2018-03-20firmware: fix checking for return values for fw_add_devm_name()Luis R. Rodriguez1-3/+9
Currently fw_add_devm_name() returns 1 if the firmware cache was already set. This makes it complicated for us to check for correctness. It is actually non-fatal if the firmware cache is already setup, so just return 0, and simplify the checkers. fw_add_devm_name() adds device's name onto the devres for the device so that prior to suspend we cache the firmware onto memory, so that on resume the firmware is reliably available. We never were checking for success for this call though, meaning in some really rare cases we my have never setup the firmware cache for a device, which could in turn make resume fail. This is all theoretical, no known issues have been reported. This small issue has been present way since the addition of the devres firmware cache names on v3.7. Fixes: f531f05ae9437 ("firmware loader: store firmware name into devres list") Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-20firmware: move firmware loader into its own directoryLuis R. Rodriguez1-0/+1189
This will make it much easier to manage as we manage to keep trimming componnents down into their own files to more easily manage and maintain this codebase. Suggested-by: Kees Cook <[email protected]> Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>