diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-05 19:29:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-05 19:29:19 -0400 |
commit | ec064d3c6b40697fd72f4b1eeabbf293b7947a04 (patch) | |
tree | 1c7dcd0105d2cc9da3861452da9708ca03f2ece6 /drivers/base/firmware_loader/main.c | |
parent | abf7dba7c4f77d781f6df50fefb19a64c5dc331f (diff) | |
parent | 8c97a46af04b4f7c0a0dded031fef1806872e648 (diff) |
Merge tag 'driver-core-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH:
"Here is the driver core patchset for 4.18-rc1.
The large chunk of these are firmware core documentation and api
updates. Nothing major there, just better descriptions for others to
be able to understand the firmware code better. There's also a user
for a new firmware api call.
Other than that, there are some minor updates for debugfs, kernfs, and
the driver core itself.
All of these have been in linux-next for a while with no reported
issues"
* tag 'driver-core-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (23 commits)
driver core: hold dev's parent lock when needed
driver-core: return EINVAL error instead of BUG_ON()
driver core: add __printf verification to device_create_groups_vargs
mm: memory_hotplug: use put_device() if device_register fail
base: core: fix typo 'can by' to 'can be'
debugfs: inode: debugfs_create_dir uses mode permission from parent
debugfs: Re-use kstrtobool_from_user()
Documentation: clarify firmware_class provenance and why we can't rename the module
Documentation: remove stale firmware API reference
Documentation: fix few typos and clarifications for the firmware loader
ath10k: re-enable the firmware fallback mechanism for testmode
ath10k: use firmware_request_nowarn() to load firmware
firmware: add firmware_request_nowarn() - load firmware without warnings
firmware_loader: make firmware_fallback_sysfs() print more useful
firmware_loader: move kconfig FW_LOADER entries to its own file
firmware_loader: replace ---help--- with help
firmware_loader: enhance Kconfig documentation over FW_LOADER
firmware_loader: document firmware_sysfs_fallback()
firmware: rename fw_sysfs_fallback to firmware_fallback_sysfs()
firmware: use () to terminate kernel-doc function names
...
Diffstat (limited to 'drivers/base/firmware_loader/main.c')
-rw-r--r-- | drivers/base/firmware_loader/main.c | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c index eb34089e4299..0943e7065e0e 100644 --- a/drivers/base/firmware_loader/main.c +++ b/drivers/base/firmware_loader/main.c | |||
@@ -443,7 +443,7 @@ static int fw_add_devm_name(struct device *dev, const char *name) | |||
443 | #endif | 443 | #endif |
444 | 444 | ||
445 | int assign_fw(struct firmware *fw, struct device *device, | 445 | int assign_fw(struct firmware *fw, struct device *device, |
446 | unsigned int opt_flags) | 446 | enum fw_opt opt_flags) |
447 | { | 447 | { |
448 | struct fw_priv *fw_priv = fw->priv; | 448 | struct fw_priv *fw_priv = fw->priv; |
449 | int ret; | 449 | int ret; |
@@ -558,7 +558,7 @@ static void fw_abort_batch_reqs(struct firmware *fw) | |||
558 | static int | 558 | static int |
559 | _request_firmware(const struct firmware **firmware_p, const char *name, | 559 | _request_firmware(const struct firmware **firmware_p, const char *name, |
560 | struct device *device, void *buf, size_t size, | 560 | struct device *device, void *buf, size_t size, |
561 | unsigned int opt_flags) | 561 | enum fw_opt opt_flags) |
562 | { | 562 | { |
563 | struct firmware *fw = NULL; | 563 | struct firmware *fw = NULL; |
564 | int ret; | 564 | int ret; |
@@ -581,7 +581,7 @@ _request_firmware(const struct firmware **firmware_p, const char *name, | |||
581 | dev_warn(device, | 581 | dev_warn(device, |
582 | "Direct firmware load for %s failed with error %d\n", | 582 | "Direct firmware load for %s failed with error %d\n", |
583 | name, ret); | 583 | name, ret); |
584 | ret = fw_sysfs_fallback(fw, name, device, opt_flags, ret); | 584 | ret = firmware_fallback_sysfs(fw, name, device, opt_flags, ret); |
585 | } else | 585 | } else |
586 | ret = assign_fw(fw, device, opt_flags); | 586 | ret = assign_fw(fw, device, opt_flags); |
587 | 587 | ||
@@ -597,7 +597,7 @@ _request_firmware(const struct firmware **firmware_p, const char *name, | |||
597 | } | 597 | } |
598 | 598 | ||
599 | /** | 599 | /** |
600 | * request_firmware: - send firmware request and wait for it | 600 | * request_firmware() - send firmware request and wait for it |
601 | * @firmware_p: pointer to firmware image | 601 | * @firmware_p: pointer to firmware image |
602 | * @name: name of firmware file | 602 | * @name: name of firmware file |
603 | * @device: device for which firmware is being loaded | 603 | * @device: device for which firmware is being loaded |
@@ -632,7 +632,34 @@ request_firmware(const struct firmware **firmware_p, const char *name, | |||
632 | EXPORT_SYMBOL(request_firmware); | 632 | EXPORT_SYMBOL(request_firmware); |
633 | 633 | ||
634 | /** | 634 | /** |
635 | * request_firmware_direct: - load firmware directly without usermode helper | 635 | * firmware_request_nowarn() - request for an optional fw module |
636 | * @firmware: pointer to firmware image | ||
637 | * @name: name of firmware file | ||
638 | * @device: device for which firmware is being loaded | ||
639 | * | ||
640 | * This function is similar in behaviour to request_firmware(), except | ||
641 | * it doesn't produce warning messages when the file is not found. | ||
642 | * The sysfs fallback mechanism is enabled if direct filesystem lookup fails, | ||
643 | * however, however failures to find the firmware file with it are still | ||
644 | * suppressed. It is therefore up to the driver to check for the return value | ||
645 | * of this call and to decide when to inform the users of errors. | ||
646 | **/ | ||
647 | int firmware_request_nowarn(const struct firmware **firmware, const char *name, | ||
648 | struct device *device) | ||
649 | { | ||
650 | int ret; | ||
651 | |||
652 | /* Need to pin this module until return */ | ||
653 | __module_get(THIS_MODULE); | ||
654 | ret = _request_firmware(firmware, name, device, NULL, 0, | ||
655 | FW_OPT_UEVENT | FW_OPT_NO_WARN); | ||
656 | module_put(THIS_MODULE); | ||
657 | return ret; | ||
658 | } | ||
659 | EXPORT_SYMBOL_GPL(firmware_request_nowarn); | ||
660 | |||
661 | /** | ||
662 | * request_firmware_direct() - load firmware directly without usermode helper | ||
636 | * @firmware_p: pointer to firmware image | 663 | * @firmware_p: pointer to firmware image |
637 | * @name: name of firmware file | 664 | * @name: name of firmware file |
638 | * @device: device for which firmware is being loaded | 665 | * @device: device for which firmware is being loaded |
@@ -657,7 +684,7 @@ int request_firmware_direct(const struct firmware **firmware_p, | |||
657 | EXPORT_SYMBOL_GPL(request_firmware_direct); | 684 | EXPORT_SYMBOL_GPL(request_firmware_direct); |
658 | 685 | ||
659 | /** | 686 | /** |
660 | * firmware_request_cache: - cache firmware for suspend so resume can use it | 687 | * firmware_request_cache() - cache firmware for suspend so resume can use it |
661 | * @name: name of firmware file | 688 | * @name: name of firmware file |
662 | * @device: device for which firmware should be cached for | 689 | * @device: device for which firmware should be cached for |
663 | * | 690 | * |
@@ -681,7 +708,7 @@ int firmware_request_cache(struct device *device, const char *name) | |||
681 | EXPORT_SYMBOL_GPL(firmware_request_cache); | 708 | EXPORT_SYMBOL_GPL(firmware_request_cache); |
682 | 709 | ||
683 | /** | 710 | /** |
684 | * request_firmware_into_buf - load firmware into a previously allocated buffer | 711 | * request_firmware_into_buf() - load firmware into a previously allocated buffer |
685 | * @firmware_p: pointer to firmware image | 712 | * @firmware_p: pointer to firmware image |
686 | * @name: name of firmware file | 713 | * @name: name of firmware file |
687 | * @device: device for which firmware is being loaded and DMA region allocated | 714 | * @device: device for which firmware is being loaded and DMA region allocated |
@@ -713,7 +740,7 @@ request_firmware_into_buf(const struct firmware **firmware_p, const char *name, | |||
713 | EXPORT_SYMBOL(request_firmware_into_buf); | 740 | EXPORT_SYMBOL(request_firmware_into_buf); |
714 | 741 | ||
715 | /** | 742 | /** |
716 | * release_firmware: - release the resource associated with a firmware image | 743 | * release_firmware() - release the resource associated with a firmware image |
717 | * @fw: firmware resource to release | 744 | * @fw: firmware resource to release |
718 | **/ | 745 | **/ |
719 | void release_firmware(const struct firmware *fw) | 746 | void release_firmware(const struct firmware *fw) |
@@ -734,7 +761,7 @@ struct firmware_work { | |||
734 | struct device *device; | 761 | struct device *device; |
735 | void *context; | 762 | void *context; |
736 | void (*cont)(const struct firmware *fw, void *context); | 763 | void (*cont)(const struct firmware *fw, void *context); |
737 | unsigned int opt_flags; | 764 | enum fw_opt opt_flags; |
738 | }; | 765 | }; |
739 | 766 | ||
740 | static void request_firmware_work_func(struct work_struct *work) | 767 | static void request_firmware_work_func(struct work_struct *work) |
@@ -755,7 +782,7 @@ static void request_firmware_work_func(struct work_struct *work) | |||
755 | } | 782 | } |
756 | 783 | ||
757 | /** | 784 | /** |
758 | * request_firmware_nowait - asynchronous version of request_firmware | 785 | * request_firmware_nowait() - asynchronous version of request_firmware |
759 | * @module: module requesting the firmware | 786 | * @module: module requesting the firmware |
760 | * @uevent: sends uevent to copy the firmware image if this flag | 787 | * @uevent: sends uevent to copy the firmware image if this flag |
761 | * is non-zero else the firmware copy must be done manually. | 788 | * is non-zero else the firmware copy must be done manually. |
@@ -824,7 +851,7 @@ EXPORT_SYMBOL(request_firmware_nowait); | |||
824 | static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain); | 851 | static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain); |
825 | 852 | ||
826 | /** | 853 | /** |
827 | * cache_firmware - cache one firmware image in kernel memory space | 854 | * cache_firmware() - cache one firmware image in kernel memory space |
828 | * @fw_name: the firmware image name | 855 | * @fw_name: the firmware image name |
829 | * | 856 | * |
830 | * Cache firmware in kernel memory so that drivers can use it when | 857 | * Cache firmware in kernel memory so that drivers can use it when |
@@ -866,7 +893,7 @@ static struct fw_priv *lookup_fw_priv(const char *fw_name) | |||
866 | } | 893 | } |
867 | 894 | ||
868 | /** | 895 | /** |
869 | * uncache_firmware - remove one cached firmware image | 896 | * uncache_firmware() - remove one cached firmware image |
870 | * @fw_name: the firmware image name | 897 | * @fw_name: the firmware image name |
871 | * | 898 | * |
872 | * Uncache one firmware image which has been cached successfully | 899 | * Uncache one firmware image which has been cached successfully |
@@ -1042,7 +1069,7 @@ static void __device_uncache_fw_images(void) | |||
1042 | } | 1069 | } |
1043 | 1070 | ||
1044 | /** | 1071 | /** |
1045 | * device_cache_fw_images - cache devices' firmware | 1072 | * device_cache_fw_images() - cache devices' firmware |
1046 | * | 1073 | * |
1047 | * If one device called request_firmware or its nowait version | 1074 | * If one device called request_firmware or its nowait version |
1048 | * successfully before, the firmware names are recored into the | 1075 | * successfully before, the firmware names are recored into the |
@@ -1075,7 +1102,7 @@ static void device_cache_fw_images(void) | |||
1075 | } | 1102 | } |
1076 | 1103 | ||
1077 | /** | 1104 | /** |
1078 | * device_uncache_fw_images - uncache devices' firmware | 1105 | * device_uncache_fw_images() - uncache devices' firmware |
1079 | * | 1106 | * |
1080 | * uncache all firmwares which have been cached successfully | 1107 | * uncache all firmwares which have been cached successfully |
1081 | * by device_uncache_fw_images earlier | 1108 | * by device_uncache_fw_images earlier |
@@ -1092,7 +1119,7 @@ static void device_uncache_fw_images_work(struct work_struct *work) | |||
1092 | } | 1119 | } |
1093 | 1120 | ||
1094 | /** | 1121 | /** |
1095 | * device_uncache_fw_images_delay - uncache devices firmwares | 1122 | * device_uncache_fw_images_delay() - uncache devices firmwares |
1096 | * @delay: number of milliseconds to delay uncache device firmwares | 1123 | * @delay: number of milliseconds to delay uncache device firmwares |
1097 | * | 1124 | * |
1098 | * uncache all devices's firmwares which has been cached successfully | 1125 | * uncache all devices's firmwares which has been cached successfully |