firmware loader: introduce cache_firmware and uncache_firmware
This patches introduce two kernel APIs of cache_firmware and uncache_firmware, both of which take the firmware file name as the only parameter. So any drivers can call cache_firmware to cache the specified firmware file into kernel memory, and can use the cached firmware in situations which can't request firmware from user space. Signed-off-by: Ming Lei <ming.lei@canonical.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
1f2b79599e
commit
2887b3959c
@@ -47,6 +47,8 @@ int request_firmware_nowait(
|
||||
void (*cont)(const struct firmware *fw, void *context));
|
||||
|
||||
void release_firmware(const struct firmware *fw);
|
||||
int cache_firmware(const char *name);
|
||||
int uncache_firmware(const char *name);
|
||||
#else
|
||||
static inline int request_firmware(const struct firmware **fw,
|
||||
const char *name,
|
||||
@@ -65,6 +67,16 @@ static inline int request_firmware_nowait(
|
||||
static inline void release_firmware(const struct firmware *fw)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int cache_firmware(const char *name)
|
||||
{
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
static inline int uncache_firmware(const char *name)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user