Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2e9a855 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by Greg Kroah-Hartman
Browse files

firmware: simplify CONFIG_FW_LOADER_USER_HELPER_FALLBACK further



All CONFIG_FW_LOADER_USER_HELPER_FALLBACK really is, is just a bool,
initailized at build time. Define it as such. This simplifies the
logic even further, removing now all explicit #ifdefs around the code.

Acked-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8ddfb472
Loading
Loading
Loading
Loading
+18 −7
Original line number Original line Diff line number Diff line
@@ -266,6 +266,22 @@ static inline bool fw_state_is_aborted(struct fw_priv *fw_priv)


#ifdef CONFIG_FW_LOADER_USER_HELPER
#ifdef CONFIG_FW_LOADER_USER_HELPER


/**
 * struct firmware_fallback_config - firmware fallback configuratioon settings
 *
 * Helps describe and fine tune the fallback mechanism.
 *
 * @force_sysfs_fallback: force the sysfs fallback mechanism to be used
 * 	as if one had enabled CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y.
 */
struct firmware_fallback_config {
	bool force_sysfs_fallback;
};

static const struct firmware_fallback_config fw_fallback_config = {
	.force_sysfs_fallback = IS_ENABLED(CONFIG_FW_LOADER_USER_HELPER_FALLBACK),
};

static inline bool fw_sysfs_done(struct fw_priv *fw_priv)
static inline bool fw_sysfs_done(struct fw_priv *fw_priv)
{
{
	return __fw_state_check(fw_priv, FW_STATUS_DONE);
	return __fw_state_check(fw_priv, FW_STATUS_DONE);
@@ -1151,19 +1167,14 @@ static int fw_load_from_user_helper(struct firmware *firmware,
	return ret;
	return ret;
}
}


#ifdef CONFIG_FW_LOADER_USER_HELPER_FALLBACK
static bool fw_force_sysfs_fallback(unsigned int opt_flags)
static bool fw_force_sysfs_fallback(unsigned int opt_flags)
{
{
	if (fw_fallback_config.force_sysfs_fallback)
		return true;
		return true;
}
#else
static bool fw_force_sysfs_fallback(unsigned int opt_flags)
{
	if (!(opt_flags & FW_OPT_USERHELPER))
	if (!(opt_flags & FW_OPT_USERHELPER))
		return false;
		return false;
	return true;
	return true;
}
}
#endif


static bool fw_run_sysfs_fallback(unsigned int opt_flags)
static bool fw_run_sysfs_fallback(unsigned int opt_flags)
{
{