162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef __FIRMWARE_FALLBACK_H 362306a36Sopenharmony_ci#define __FIRMWARE_FALLBACK_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/firmware.h> 662306a36Sopenharmony_ci#include <linux/device.h> 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#include "firmware.h" 962306a36Sopenharmony_ci#include "sysfs.h" 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifdef CONFIG_FW_LOADER_USER_HELPER 1262306a36Sopenharmony_ciint firmware_fallback_sysfs(struct firmware *fw, const char *name, 1362306a36Sopenharmony_ci struct device *device, 1462306a36Sopenharmony_ci u32 opt_flags, 1562306a36Sopenharmony_ci int ret); 1662306a36Sopenharmony_civoid kill_pending_fw_fallback_reqs(bool only_kill_custom); 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_civoid fw_fallback_set_cache_timeout(void); 1962306a36Sopenharmony_civoid fw_fallback_set_default_timeout(void); 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#else /* CONFIG_FW_LOADER_USER_HELPER */ 2262306a36Sopenharmony_cistatic inline int firmware_fallback_sysfs(struct firmware *fw, const char *name, 2362306a36Sopenharmony_ci struct device *device, 2462306a36Sopenharmony_ci u32 opt_flags, 2562306a36Sopenharmony_ci int ret) 2662306a36Sopenharmony_ci{ 2762306a36Sopenharmony_ci /* Keep carrying over the same error */ 2862306a36Sopenharmony_ci return ret; 2962306a36Sopenharmony_ci} 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_cistatic inline void kill_pending_fw_fallback_reqs(bool only_kill_custom) { } 3262306a36Sopenharmony_cistatic inline void fw_fallback_set_cache_timeout(void) { } 3362306a36Sopenharmony_cistatic inline void fw_fallback_set_default_timeout(void) { } 3462306a36Sopenharmony_ci#endif /* CONFIG_FW_LOADER_USER_HELPER */ 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#ifdef CONFIG_EFI_EMBEDDED_FIRMWARE 3762306a36Sopenharmony_ciint firmware_fallback_platform(struct fw_priv *fw_priv); 3862306a36Sopenharmony_ci#else 3962306a36Sopenharmony_cistatic inline int firmware_fallback_platform(struct fw_priv *fw_priv) 4062306a36Sopenharmony_ci{ 4162306a36Sopenharmony_ci return -ENOENT; 4262306a36Sopenharmony_ci} 4362306a36Sopenharmony_ci#endif 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#endif /* __FIRMWARE_FALLBACK_H */ 46