aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/firmware_loader/firmware.h
diff options
context:
space:
mode:
authorAndres Rodriguez <andresx7@gmail.com>2018-05-10 16:08:37 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-14 10:43:09 -0400
commiteb33eb04926e40331750f538a58d93cde87afaa4 (patch)
tree5b02d76d2521a37893d1b7ba3ec4a9969c0de5ff /drivers/base/firmware_loader/firmware.h
parent84d0c27d6233a9ba0578b20f5a09701eb66cee42 (diff)
firmware: wrap FW_OPT_* into an enum
This should let us associate enum kdoc to these values. While at it, kdocify the fw_opt. Signed-off-by: Andres Rodriguez <andresx7@gmail.com> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Luis R. Rodriguez <mcgrof@kernel.org> [mcgrof: coding style fixes, merge kdoc with enum move] Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/firmware_loader/firmware.h')
-rw-r--r--drivers/base/firmware_loader/firmware.h37
1 files changed, 29 insertions, 8 deletions
diff --git a/drivers/base/firmware_loader/firmware.h b/drivers/base/firmware_loader/firmware.h
index 64acbb1a392c..4f433b447367 100644
--- a/drivers/base/firmware_loader/firmware.h
+++ b/drivers/base/firmware_loader/firmware.h
@@ -2,6 +2,7 @@
2#ifndef __FIRMWARE_LOADER_H 2#ifndef __FIRMWARE_LOADER_H
3#define __FIRMWARE_LOADER_H 3#define __FIRMWARE_LOADER_H
4 4
5#include <linux/bitops.h>
5#include <linux/firmware.h> 6#include <linux/firmware.h>
6#include <linux/types.h> 7#include <linux/types.h>
7#include <linux/kref.h> 8#include <linux/kref.h>
@@ -10,13 +11,33 @@
10 11
11#include <generated/utsrelease.h> 12#include <generated/utsrelease.h>
12 13
13/* firmware behavior options */ 14/**
14#define FW_OPT_UEVENT (1U << 0) 15 * enum fw_opt - options to control firmware loading behaviour
15#define FW_OPT_NOWAIT (1U << 1) 16 *
16#define FW_OPT_USERHELPER (1U << 2) 17 * @FW_OPT_UEVENT: Enables the fallback mechanism to send a kobject uevent
17#define FW_OPT_NO_WARN (1U << 3) 18 * when the firmware is not found. Userspace is in charge to load the
18#define FW_OPT_NOCACHE (1U << 4) 19 * firmware using the sysfs loading facility.
19#define FW_OPT_NOFALLBACK (1U << 5) 20 * @FW_OPT_NOWAIT: Used to describe the firmware request is asynchronous.
21 * @FW_OPT_USERHELPER: Enable the fallback mechanism, in case the direct
22 * filesystem lookup fails at finding the firmware. For details refer to
23 * fw_sysfs_fallback().
24 * @FW_OPT_NO_WARN: Quiet, avoid printing warning messages.
25 * @FW_OPT_NOCACHE: Disables firmware caching. Firmware caching is used to
26 * cache the firmware upon suspend, so that upon resume races against the
27 * firmware file lookup on storage is avoided. Used for calls where the
28 * file may be too big, or where the driver takes charge of its own
29 * firmware caching mechanism.
30 * @FW_OPT_NOFALLBACK: Disable the fallback mechanism. Takes precedence over
31 * &FW_OPT_UEVENT and &FW_OPT_USERHELPER.
32 */
33enum fw_opt {
34 FW_OPT_UEVENT = BIT(0),
35 FW_OPT_NOWAIT = BIT(1),
36 FW_OPT_USERHELPER = BIT(2),
37 FW_OPT_NO_WARN = BIT(3),
38 FW_OPT_NOCACHE = BIT(4),
39 FW_OPT_NOFALLBACK = BIT(5),
40};
20 41
21enum fw_status { 42enum fw_status {
22 FW_STATUS_UNKNOWN, 43 FW_STATUS_UNKNOWN,
@@ -110,6 +131,6 @@ static inline void fw_state_done(struct fw_priv *fw_priv)
110} 131}
111 132
112int assign_fw(struct firmware *fw, struct device *device, 133int assign_fw(struct firmware *fw, struct device *device,
113 unsigned int opt_flags); 134 enum fw_opt opt_flags);
114 135
115#endif /* __FIRMWARE_LOADER_H */ 136#endif /* __FIRMWARE_LOADER_H */